http://stackoverflow.com/comment/43358800
type: Comment
comment on: http://stackoverflow.com/a/27459751
type: AnswerComment
score: 0
has text: I've literally seached for 1 hour now and couldn't manage it.. could you give me an example for your "raw byte stream" ?

http://stackoverflow.com/a/27348356
score: 2
downvote count: 0
upvote count: 2
has body: You could try something like this too: public class MainClass { public static void main(String[] args) { Random bob = new Random(); Scanner bill = new Scanner(System.in); String yesOrNo = ""; do { int numToGuess = bob.nextInt(20); int numOfTries = 0; int guess = 0; boolean win = false; while (win == false) { System.out .println("I'm thinking of a number between 1 and 20, can you guess it?"); guess = Bill.nextInt(); numOfTries++; if (guess == numToGuess) { win = true; } else if (guess &lt; numToGuess) { System.out.println("Your guess is too low"); } else if (guess &gt; numToGuess) { System.out.println("Your guess is too high"); } } System.out.println("Congratulations!"); System.out.println("The number was " + NumToGuess); System.out.println("It took you " + NumOfTries + " tries"); yesOrNo = bill.nextLine(); System.out.println("Would you like to play again? " + yesOrNo); yesOrNo = bill.nextLine(); } while (yesOrNo.equalsIgnoreCase("yes")); System.out.println("Ok, maybe next time."); System.exit(0); } }
answers question: http://stackoverflow.com/q/27348175
type: Answer

http://stackoverflow.com/q/27424760
tagged with: spring-data-jpa
has answer: http://stackoverflow.com/a/27424933
tagged with: spring
has title: Spring Framework: findBy throws Illegal Argument Exception
type: AnsweredQuestion
has body: This is my Entity Class. @Entity public class Profile { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Long profileId; @Transient private String name; @ElementCollection(fetch = FetchType.EAGER) private Map&lt;String, String&gt; trNames; //Key: LanguageCode, Value: translated text ... } ProfileRepository Class public interface ProfileRepository extends JpaRepository&lt;Profile, Long&gt; { //This method should go through the Map Collection and return a profile whose name matches the given parameter value. Profile findByTrNames(String code, String name); } I created a JUnit Test Class to test this method. This line of code Profile found = repository.findByTrNames("en", "Interview IT"); throws an exception. org.springframework.dao.InvalidDataAccessApiUsageException: Parameter value [en] did not match expected type [java.util.Map]; nested exception is java.lang.IllegalArgumentException: Parameter value [en] did not match expected type [java.util.Map] at org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(EntityManagerFactoryUtils.java:301) at etc.. Could anyone please help me? Thank you very much.
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27424933
answer count: 1
tagged with: persistence
score: 0

http://stackoverflow.com/q/27413927
answer count: 2
tagged with: applet
score: 0
tagged with: japplet
has comment: http://stackoverflow.com/comment/43271948
type: UnansweredQuestion
has title: How do I fix IllegalArgumentException?
has body: I am currently programming a game and had this error thrown at me. How do I fix it? The Code where the IllegalArgumentException is appearing is in the SpriteScreen.java SpriteScreen.java package game.gfx; import java.awt.image.BufferedImage; import java.io.IOException; import javax.imageio.ImageIO; public class SpriteSheet { public String path; public int width, height; public int[] pixels; public SpriteSheet(String path) { BufferedImage image = null; try { image = ImageIO.read(SpriteSheet.class.getResourceAsStream(path)); //THIS IS LINE #18 (WHERE THE ERROR IS OCCURING)! } catch (IOException e) { e.printStackTrace(); } if (image == null) { return; } this.path = path; this.width = image.getWidth(); this.height = image.getHeight(); pixels = image.getRGB(0, 0, width, height, null, 0, width); for (int i = 0; i &lt; pixels.length; i++) { pixels[i] = (pixels[i] * 0xff) / 64; } for (int i = 0; i &lt; 8; i++) { System.out.println(pixels[i]); } } } Error Exception in thread "main" java.lang.IllegalArgumentException: input == null! at javax.imageio.ImageIO.read(Unknown Source) at game.gfx.SpriteSheet.&lt;init&gt;(SpriteSheet.java:18) at game.Game.&lt;init&gt;(Game.java:24) at game.Game.main(Game.java:130)
has answer: http://stackoverflow.com/a/27414230
has comment: http://stackoverflow.com/comment/43272018
has answer: http://stackoverflow.com/a/27413964
has comment: http://stackoverflow.com/comment/43272041
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43271947

http://stackoverflow.com/q/27451278
answer count: 1
tagged with: java
tagged with: hibernate
tagged with: mysql
has body: Here is the data modelling scenario: For illustrative purposes consider this simple data model: ManyToMany From Project to Department ManyToMany From Project to Employee Consider this entitiy: @Entity @NamedQueries( { @NamedQuery(name = "project.getProjectByDepartmentAndEmployee", query = "SELECT p from Project p WHERE (:dept) in p.department and (:emp) in p.employees"), }) public class ConfigFile extends BaseUpdatableEntity implements Serializable { private Long id; @ManyToMany private List&lt;Department&gt; departments; @ManyToMany private List&lt;Employee&gt; employees; } in My Dao Layer, I want to execute the following: public Project getProject(Department dept, Employee emp){ Query query = getEntityManager().createNamedQuery("project.getProjectByDepartmentAndEmployee"); query.setParameter("dept", dept) .setParameter("emp",emp); return (UserSession) query.getResultList().get(0); } The problem I see with NamedQueryConstruction above. How will I bind parameters in Where clause on left side. Thanks for help NOTE Answer below will work. but I am looking for a solution without using JOIN if possible
tagged with: jpa
downvote count: 0
has answer: http://stackoverflow.com/a/27452414
type: UnansweredQuestion
score: 1
tagged with: jpql
has title: how to perform parameter binding for in clause for Collection in JPQL without using JOIN?
type: Question
favorite count: 0
upvote count: 1

http://stackoverflow.com/q/27355365
has comment: http://stackoverflow.com/comment/43164109
score: -1
has answer: http://stackoverflow.com/a/27355461
linked to: http://stackoverflow.com/q/15657569
answer count: 2
linked to: http://stackoverflow.com/q/18224184
upvote count: 0
tagged with: frame
has comment: http://stackoverflow.com/comment/43165798
favorite count: 0
has comment: http://stackoverflow.com/comment/43164207
has answer: http://stackoverflow.com/a/27355576
has comment: http://stackoverflow.com/comment/43164374
duplicate of: http://stackoverflow.com/q/15657569
accepted answer: http://stackoverflow.com/a/27355461
possible better answer: http://stackoverflow.com/a/27355576
has body: I have created simple form using Swing. In this form I have 2 fields named username and password. In the first line, I am setting the title to 'Login'. How may I replace the icon to the left of it with a custom image? class LoginForm extends JFrame { public static boolean flag = false; JButton login, cancel; JTextField uname; JPasswordField pass; JLabel u, p; final CheckUser user = new CheckUser(); private static final Insets insets = new Insets(0, 0, 0, 0); private static ArrayList&lt;JavaBean&gt; store = new ArrayList&lt;JavaBean&gt;(); JavaBean bean = new JavaBean(); ArrayList&lt;JavaBean&gt; list = new ArrayList&lt;JavaBean&gt;(); int n = 0; public void login() { setTitle("Login"); setLayout(new GridLayout(3, 2)); setDefaultCloseOperation(EXIT_ON_CLOSE); setVisible(true); u = new JLabel("Username"); p = new JLabel("Password"); uname = new JTextField(20); pass = new JPasswordField(20); login = new JButton("Login"); cancel = new JButton("Cancel"); add(u); add(uname); add(p); add(pass); add(login); add(cancel); uname.requestFocus(); cancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { System.exit(0); } }); login.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { String un = uname.getText(); String pa = new String(pass.getPassword()); // JavaBean bean = new JavaBean(); bean.setUsername(un); bean.setPassword(pa); System.out.println("Username :" + un + pa); store.add(bean); setList(store); dispose(); //boolean checkUser = user.checkUser(un, pa, "https://greenhouse.lotus.com/connections/opensocial/basic/rest/activitystreams/@me/@mentions/@all?shortStrings=true&amp;format=atom"); boolean checkUser = user.checkUser(un, pa, "https://greenhouse.lotus.com/connections/opensocial/basic/rest/activitystreams/@me/@responses/@all?shortStrings=true&amp;format=atom"); if (checkUser) { System.out.println("------------getData"); System.out.println("Check User Boolean!!!" + checkUser); try…
has comment: http://stackoverflow.com/comment/43164482
tagged with: java
tagged with: swing
has title: How to customize the icon in the window title using Swing?
linked to: http://stackoverflow.com/q/19209650
downvote count: 1
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/27387224
answer count: 1
favorite count: 0
has body: double[]percentage=new double[vote.length]; for (int m=0;m&lt;vote.length;m++) { percentage[m] = (double)(vote[j] / total_votes)*100; } I am trying to calculate the percentage for each candidate, although I keep getting an error while I am running the code. I don't know what is the problem.
type: UnansweredQuestion
score: -4
has answer: http://stackoverflow.com/a/27387264
tagged with: java
has comment: http://stackoverflow.com/comment/43222508
tagged with: percentage
has comment: http://stackoverflow.com/comment/43222446
type: Question
has comment: http://stackoverflow.com/comment/43222477
downvote count: 4
upvote count: 0
has title: Calculating the percentage of each candidates votes
has comment: http://stackoverflow.com/comment/43222445

http://stackoverflow.com/comment/43300299
has text: But the user needs to choose the length of characters that will be generated and returned from the method. I have to use JOptionPane for input.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27429423

java
tags question: http://stackoverflow.com/q/27392178
tags question: http://stackoverflow.com/q/27389040
tags question: http://stackoverflow.com/q/27427264
tags question: http://stackoverflow.com/q/27420502
tags question: http://stackoverflow.com/q/27433414
tags question: http://stackoverflow.com/q/27474238
tags question: http://stackoverflow.com/q/27314049
tags question: http://stackoverflow.com/q/27451179
tags question: http://stackoverflow.com/q/27366428
tags question: http://stackoverflow.com/q/27338158
tags question: http://stackoverflow.com/q/27464425
tags question: http://stackoverflow.com/q/27404624
tags question: http://stackoverflow.com/q/27432472
tags question: http://stackoverflow.com/q/27324881
tags question: http://stackoverflow.com/q/27333660
tags question: http://stackoverflow.com/q/27393840
tags question: http://stackoverflow.com/q/27422173
tags question: http://stackoverflow.com/q/27387635
tags question: http://stackoverflow.com/q/27353482
tags question: http://stackoverflow.com/q/27398861
tags question: http://stackoverflow.com/q/27415693
tags question: http://stackoverflow.com/q/27341848
tags question: http://stackoverflow.com/q/27417376
tags question: http://stackoverflow.com/q/27397199
tags question: http://stackoverflow.com/q/27330338
tags question: http://stackoverflow.com/q/27363052
tags question: http://stackoverflow.com/q/27356859
tags question: http://stackoverflow.com/q/27376358
tags question: http://stackoverflow.com/q/27464325
tags question: http://stackoverflow.com/q/27316185
tags question: http://stackoverflow.com/q/27314836
tags question: http://stackoverflow.com/q/27419360
tags question: http://stackoverflow.com/q/27348868
tags question: http://stackoverflow.com/q/27395123
tags question: http://stackoverflow.com/q/27325854
tags question: http://stackoverflow.com/q/27344418
tags question: http://stackoverflow.com/q/27322530
tags question: http://stackoverflow.com/q/27460476
tags question: http://stackoverflow.com/q/27402839
tags question: http://stackoverflow.com/q/27408125
tags question: http://stackoverflow.com/q/27438465
tags question: http://stackoverflow.com/q/27391007
tags question: http://stackoverflow.com/q/27428041
tags question: http://stackoverflow.com/q/27459279
tags question: http://stackoverflow.com/q/27329114
tags question: http://stackoverflow.com/q/27390395
tags question: http://stackoverflow.com/q/27368432
tags question: http://stackoverflow.com/q/27452088
tags question: http://stackoverflow.com/q/27409786
tags question: http://stackoverflow.com/q/27324189
tags question: http://stackoverflow.com/q/27389882
tags question: http://stackoverflow.com/q/27381021
tags question: http://stackoverflow.com/q/27386351
tags question: http://stackoverflow.com/q/27328329
tags question: http://stackoverflow.com/q/27341530
tags question: http://stackoverflow.com/q/27343917
tags question: http://stackoverflow.com/q/27415066
tags question: http://stackoverflow.com/q/27393611
tags question: http://stackoverflow.com/q/27327018
tags question: http://stackoverflow.com/q/27340481
tags question: http://stackoverflow.com/q/27447540
tags question: http://stackoverflow.com/q/27452012
tags question: http://stackoverflow.com/q/27400682
tags question: http://stackoverflow.com/q/27338544
tags question: http://stackoverflow.com/q/27368205
tags question: http://stackoverflow.com/q/27443982
tags question: http://stackoverflow.com/q/27371075
tags question: http://stackoverflow.com/q/27403866
tags question: http://stackoverflow.com/q/27449365
tags question: http://stackoverflow.com/q/27383814
tags question: http://stackoverflow.com/q/27413894
tags question: http://stackoverflow.com/q/27418822
tags question: http://stackoverflow.com/q/27345439
tags question: http://stackoverflow.com/q/27330081
tags question: http://stackoverflow.com/q/27446695
tags question: http://stackoverflow.com/q/27392714
tags question: http://stackoverflow.com/q/27413741
tags question: http://stackoverflow.com/q/27328088
tags question: http://stackoverflow.com/q/27354895
tags question: http://stackoverflow.com/q/27374297

http://stackoverflow.com/a/27448353
answers question: http://stackoverflow.com/q/27438467
upvote count: 1
type: AcceptedAnswer
has body: To answer your question: "how to get data from radio buttons in gwt?": radioButton.getValue(); or radioButton.isChecked(); I'm not sure what do you want to achieve with the if-clause. If you need an initial value then just set it. What you probably want to do is to register when the button is clicked: rbtnUTrue.addValueChangeHandler(new ValueChangeHandler&lt;Boolean&gt;() { @Override public void onValueChange(ValueChangeEvent&lt;Boolean&gt; event) { if (rbtnUTrue.isChecked()) { dummy_u = 1; } else if (rbtnUFalse.isChecked()) { dummy_u = 0; } } });
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27438467

http://stackoverflow.com/comment/43312206
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27435653
has text: It's bad to declare just about any method in Java B-)
score: 0

http://stackoverflow.com/comment/43137434
type: Comment
has text: The code above compiles for me. What are the error messages and what did you change?
type: AnswerComment
comment on: http://stackoverflow.com/a/27340665
score: 0

http://stackoverflow.com/q/27408647
tagged with: spring
has answer: http://stackoverflow.com/a/27416210
accepted answer: http://stackoverflow.com/a/27416210
type: AnsweredQuestion
tagged with: transactions
tagged with: java
tagged with: hibernate
type: Question
answer count: 1
tagged with: jta
score: 0
has title: Questions regarding JtaTransactionManager
has body: I am looking for a way to put CRUD of two data source into one transaction by Spring/JTA, but have following questions: Is it ok that the datasource is is made oforg.apache.commons.dbcp.BasicDataSource instead of JNDI? There are two parameters to intitiate a JtaTransactionManager: public JtaTransactionManager(UserTransaction userTransaction, TransactionManager transactionManager) From Spring document: userTransaction - the JTA UserTransaction to use as direct reference transactionManager - the JTA TransactionManager to use as direct reference If I have a datasource DS_A and another datasource DS_B, which both requires within the same transaction manager, then which should be the UserTransaction and how to define the TransactionManager, as I am just creating the JtaTransactionManager, does it mean another JtaTransactionManager? Also it looks both parameters are not required so how JtaTransactionManager can detect them from: &lt;context:annotation-driven/&gt; &lt;tx:jta-transaction-manager/&gt; If everything is well defined in application context, then which transaction manager bean should referred in @Transactional annotation, if there are two datasources?

http://stackoverflow.com/q/27396478
has comment: http://stackoverflow.com/comment/43239737
tagged with: java
tagged with: servlets
score: 0
upvote count: 1
downvote count: 1
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27397074
accepted answer: http://stackoverflow.com/a/27397074
tagged with: spring
has title: Spring MVC HTTP Error 500 : Servlet.init() for servlet notices threw exception
tagged with: spring-mvc
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43239906
tagged with: http
type: Question
has body: I'm trying to run a simple Spring MVC project. It should basically run a .jsp file from the WEB-INF and show "Hello World!" as the tutorial suggested. When I'm running the project it's showing: HTTP Status 500 - Servlet.init() for servlet notices threw exception Here is what the error page contains: type Exception report message Servlet.init() for servlet notices threw exception description The server encountered an internal error that prevented it from fulfilling this request. exception javax.servlet.ServletException: Servlet.init() for servlet notices threw exception org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1085) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658) org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1556) org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1513) java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Unknown Source) root cause org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/notices-servlet.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/WEB-INF/notices-servlet.xml] org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefin…

http://stackoverflow.com/comment/43381994
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27473449
has text: You mean something like: `File f = new File(context.getResource(path).toURI());` ?

http://stackoverflow.com/comment/43377172
comment on: http://stackoverflow.com/q/27471200
type: Comment
score: 0
type: QuestionComment
has text: Why ASCII? This is 2014. Why not use Unicode code points?

http://stackoverflow.com/comment/43198880
type: Comment
type: QuestionComment
score: 1
has text: Is this the only case? Do you have cases such as `\\"Hello"` where the ``\`` is escaped?
comment on: http://stackoverflow.com/q/27373989

http://stackoverflow.com/a/27390542
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27390395
type: Answer
answers question: http://stackoverflow.com/q/27390395
upvote count: 1
score: 1
has body: As can be taken from Java Virtual Machine The Java virtual machine is called "virtual" because it is an abstract computer defined by a specification. This tells us that there must be somehow a quite big difference between bytecode generated by a C compiler and/or the Java compiler. If you are using e.g. gcc, as you already mentioned, the code is translated to assembly and then translated to binary by an assembler (let's skip the Linker). These binary instructions are being loaded as you execute your .exe file. Windows reserves some physical pages for your process, sets up the virtual memory and starts to execute your program in userspace but without any detours. The JVM on the other hand is a virtual computer in the sense that it "pretends" to be a machine on its own. This machine only understands the Java-Bytecode (yes, there is such a thing ah "Java-Assembly" too). But there is more. Because in order to actually work, the JVM has to execute that bytecode somehow on that "host machine. So the JVM has to interfere with the underlaying operating system and architecture. And this is what the JVM really does: It is a program that is written for some architectures and runs on some operating systems that pretends to be a "machine" in order to execute Java-Bytecode. This is what it makes "platform independent". Long story short: Basically, there is happenning the "same" thing. Code gets translated to assembly, to binary and then gets executed on a "machine".

http://stackoverflow.com/q/27384191
possible better answer: http://stackoverflow.com/a/27384232
has comment: http://stackoverflow.com/comment/43217214
has answer: http://stackoverflow.com/a/27384232
has comment: http://stackoverflow.com/comment/43217272
has comment: http://stackoverflow.com/comment/43217135
score: 0
upvote count: 1
has answer: http://stackoverflow.com/a/27384325
downvote count: 1
has answer: http://stackoverflow.com/a/27384239
accepted answer: http://stackoverflow.com/a/27384239
has comment: http://stackoverflow.com/comment/43216966
favorite count: 0
has comment: http://stackoverflow.com/comment/43217073
has comment: http://stackoverflow.com/comment/43217099
has title: What is the difference between the following two methods in Java
answer count: 4
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27384329
has body: What is the difference between the following two methods and which one is the best? Method 1 : private String getStringValue(){ if(condition) return string1; return string2; } Method 2 : private String getStringValue(){ if(condition) return string1; else return string2; }
type: Question

http://stackoverflow.com/a/39247214
downvote count: 0
answers question: http://stackoverflow.com/q/27410868
type: Answer
score: 2
upvote count: 2
has body: Just override refresh() method in your UI class. It works with @PreserveOnRefresh so you don't have to reinitialize your UI instance. @Override protected void refresh(VaadinRequest request) { super.refresh(request); // TODO do your thing here }

glassfish-4
tags question: http://stackoverflow.com/q/27443028
type: Tag
tags question: http://stackoverflow.com/q/27334528
tag name: glassfish-4
tags question: http://stackoverflow.com/q/27452749

http://stackoverflow.com/comment/43167741
has text: I used jsoup.jar and json.simple.1.1.1.jar
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27357108

http://stackoverflow.com/comment/91778406
comment on: http://stackoverflow.com/a/28538314
has text: Currently, I using Spring Framework 4.x and I do not want to override jackson file in glassfish. What is other solution to run? Ex: add dependency in pom.xml.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43272494
has text: By removing do you mean reallocation space for the array? Or just putting its value to `null`? Reallocation is a pain. That is why tools such as `List` and `Map` were invented.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27414176
score: 0

http://stackoverflow.com/a/27437887
score: 7
accepted answer of: http://stackoverflow.com/q/27427264
has body: Both approaches can work. Here's why I would pick the Reports API: Reports are more scalable. I believe MWS reports can return an unlimited number of records. ListOrders can only return a maximum of 100 orders. You can get more using ListOrdersByNextToken, but that brings throttling into the problem and it is not clear whether or not you're just paging by an offset (which could cause lost/duplicate orders) or whether it is a snapshot. You can acknowledge reports and filter on unacknowledged reports. Orders can be acknowledged too, but I don't think there is a way of filtering ListOrders based on acknowledgement status. Reports can be scheduled to auto-generate on an interval, as often as every 15 minutes. This means that it may not be as many calls as you think: really, it's only three every interval: one to list unacknowledged order reports, one to pull the report you want and one to acknowledge it.
upvote count: 7
answers question: http://stackoverflow.com/q/27427264
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/27382810
favorite count: 0
has body: How to process different models from POST request on the same URL? For example, I have field action in the user model. If action equals to edit, I know, that user sent me model for editing entity. If action equals to delete, I know, that there are other fields and other model. How to do this on the same URL and don't use any optional GET parameters?
upvote count: 2
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/27382949
linked to: http://stackoverflow.com/q/9208210
score: 2
has title: Spring, POST different models on the same URL
tagged with: java
has comment: http://stackoverflow.com/comment/43215842
type: Question
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/43110046
score: 0
comment on: http://stackoverflow.com/q/27324517
type: Comment
type: QuestionComment
has text: Most likely your problem is that your trying to access an object (text field) that only exists on frame 2, from frame 1. Am I right? If your text field isn't on frame 1 with the instance name of `myResult` then the code will throw the 1009 error.

utf
tag name: utf
tags question: http://stackoverflow.com/q/27407920
type: Tag
tags question: http://stackoverflow.com/q/27391619

jfreechart
type: Tag
tags question: http://stackoverflow.com/q/27474415
tags question: http://stackoverflow.com/q/27359359
tag name: jfreechart

http://stackoverflow.com/q/27323563
tagged with: java
type: Question
tagged with: matrix-multiplication
has answer: http://stackoverflow.com/a/27323679
has body: i am trying to compile this program where i entered two 3*3 arrays and i am multipyling and adding both of them. However it is giving me some errors at the end due to which its not running. I cant remove these errors and i need help regarding how can i remove them. import java.util.Scanner; public class Matrix{ public static void main(String [] args){ int a [][]= new int [3][3]; int b [][]= new int [3][3]; int C [][]= new int [3][3]; int d [][]= new int [3][3]; Scanner in= new Scanner(System.in); System.out.println("Enter Numbers in first matrix"); for( int r=0; r&lt;3; r++){ for( int c=0; c&lt;3; c++){ a [r][c]= in.nextInt(); } } System.out.println("Matrix 1 : "); for(int i = 0; i &lt; 3; i++) { for(int j = 0; j &lt; 3; j++) { System.out.print(" "+ a[i][j]); } System.out.println(); } System.out.println("Enter Numbers in 2nd matrix"); for( int n=0; n&lt;3; n++){ for( int m=0; m&lt;3; m++){ b [n][m]= in.nextInt(); } } System.out.println("Matrix 2 : "); for(int k = 0; k &lt; 3; k++) { for(int l = 0; l &lt; 3; l++) { System.out.print(" "+b[k][l]); } System.out.println(); } //for multiplication of the matrices for(int f = 0; f &lt; 3; f++) { for(int s = 0; s &lt; 3; s++) { for(int d = 0; d &lt; 3; d++){ C[f][s] += a[f][d]*b[d][s]; } } } System.out.println("Multiplication of both matrix : "); for(int x = 0; x &lt; 3; x++) { for(int y = 0; y &lt; 3; y++) { System.out.print(" "+C[x][y]); } System.out.println(); } } // for addition of both matrices for(int w=0; w &lt; 3; w++) { for(int u=0; u &lt; 3; u++) { d[w][u] = a[w][u]+b[w][u]; } } System.out.println("Addition of both matrix : "); for(int p = 0; p &lt; 3; p++) { for(int q = 0; q &lt; 3; q++) { System.out.print(" "+ d[p][q]); } System.out.println(); } } }
tagged with: arrays
downvote count: 5
answer count: 2
upvote count: 0
tagged with: matrix
has comment: http://stackoverflow.com/comment/43106304
has comment: http://stackoverflow.com/comment/43106407
favorite count: 0
tagged with: multidimensional-array
type: UnansweredQuestion
has title: Syntax problems in Matrix addition and multipication program
has answer: http://stackoverflow.com/a/27323660
has comment: http://stackoverflow.com/comment/43106301
score: -5

http://stackoverflow.com/a/27432267
has body: Following @moskito-x's advice, I inserted fileA = chooseSong; [...] chooseSong = chooseSong.replace(" ", ""); fileA = chooseSong; [...] which worked.
type: Answer
answers question: http://stackoverflow.com/q/27430919
score: 0

http://stackoverflow.com/comment/43263190
score: 1
has text: Could you simply add all the numbers to a single array, randomize the order of that array, and then slice it into 6 element pieces and reconstruct the 2d array?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27409444

http://stackoverflow.com/q/27432742
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43307146
has title: Java calendar object date time interpretation?
has comment: http://stackoverflow.com/comment/43306900
answer count: 0
tagged with: java
tagged with: set
tagged with: calendar
type: Question
has comment: http://stackoverflow.com/comment/43336233
tagged with: gettime
score: 0
has comment: http://stackoverflow.com/comment/43306677
has body: I've an application that uses java.util.Calendar object. I do multiple set on the calendar object and also based on certain conditions. However, at the end of it all the last calculated date/time value appears different. I then figured out the invoking the set method doesn't compute the values on the calendar object until you invoke get methods. See below from Javadocs Getting and Setting Calendar Field Values The calendar field values can be set by calling the set methods. Any field values set in a Calendar will not be interpreted until it needs to calculate its time value (milliseconds from the Epoch) or values of the calendar fields. Calling the get, getTimeInMillis, getTime, add and roll involves such calculation. So my question is if there is any mode on the Calendar object that sets the value even before calling getters before setting next value / constant? The code below works differently if you remove System.out statements. Declaration -> Calendar computeTime, int skipCycle, int[] days, int dayOfMonth, int weekOfMonth, int monthInYear, int hourToFire computeTime.add( Calendar.YEAR, skipCycle ); computeTime.set( Calendar.MONTH, monthInYear ); System.out.println( "getcomputeTime:2 " + computeTime.getTime() ); computeTime.set( Calendar.DAY_OF_MONTH, 1 ); System.out.println( "getcomputeTime:3 " + computeTime.getTime() ); computeTime.set( Calendar.HOUR_OF_DAY, 00 ); System.out.println( "getcomputeTime:4 " + computeTime.getTime() ); computeTime.set( Calendar.MINUTE, 00 ); System.out.println( "getcomputeTime:5 " + computeTime.getTime() ); computeTime.set( Calendar.SECOND, 00 ); System.out.println( "getcomputeTime:6 " + computeTime.getTime() ); int maxValue = computeTime.getActualMaximum(Calendar.WEEK_OF_MONTH); weekOfMonth = weekOfMonth < maxValue ? weekOfMonth : maxValue; computeTime.set( Calendar.WEEK_OF_MONTH, weekOfMonth ); System.out.println( "getcomputeTime:7 " + computeTime.getTime() ); if( computeTime.get( Calendar.DAY_OF_WEEK ) > days[ 0 ] ) computeTime.se…

http://stackoverflow.com/comment/43310010
has text: I initialized in the gamePlay() method. I declared on the class level because I wanted to make them available to both methods.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27434558

http://stackoverflow.com/q/27325368
type: Question
has comment: http://stackoverflow.com/comment/43111387
tagged with: java
has comment: http://stackoverflow.com/comment/43109965
has answer: http://stackoverflow.com/a/27325669
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/43110418
tagged with: arraylist
has answer: http://stackoverflow.com/a/27325898
has comment: http://stackoverflow.com/comment/43110016
has body: I am reading a logfile into java. For each line in the logfile, I am checking to see if the line contains an ip address. If the line contains an ip address, I want to then +1 to the count of the number of times that ip address showed up in the log file. How can I accomplish this in Java? The code below successfully extracts the ip address from each line that contains an ip address, but the process for counting occurrences of ip addresses does not work. void read(String fileName) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(fileName))); int counter = 0; ArrayList&lt;IPHolder&gt; ips = new ArrayList&lt;IPHolder&gt;(); try { String line; while ((line = br.readLine()) != null) { if(!getIP(line).equals("0.0.0.0")){ if(ips.size()==0){ IPHolder newIP = new IPHolder(); newIP.setIp(getIP(line)); newIP.setCount(0); ips.add(newIP); } for(int j=0;j&lt;ips.size();j++){ if(ips.get(j).getIp().equals(getIP(line))){ ips.get(j).setCount(ips.get(j).getCount()+1); }else{ IPHolder newIP = new IPHolder(); newIP.setIp(getIP(line)); newIP.setCount(0); ips.add(newIP); } } if(counter % 1000 == 0){System.out.println(counter+", "+ips.size());} counter+=1; } } } finally {br.close();} for(int k=0;k&lt;ips.size();k++){ System.out.println("ip, count: "+ips.get(k).getIp()+" , "+ips.get(k).getCount()); } } public String getIP(String ipString){//extracts an ip from a string if the string contains an ip String IPADDRESS_PATTERN = "(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)"; Pattern pattern = Pattern.compile(IPADDRESS_PATTERN); Matcher matcher = pattern.matcher(ipString); if (matcher.find()) { return matcher.group(); } else{ return "0.0.0.0"; } } The holder class is: public class IPHolder { private String ip; private int count; public String getIp(){return ip;} public void setIp(String i){ip=i;} public int getCount(){return count;} public void setCount(int ct){count=ct;} }
has comment: http://stackoverflow.com/comment/43109992
has title: counting unique occurrences of string in document
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/27325042

http://stackoverflow.com/comment/43953348
has text: Duplicate of http://stackoverflow.com/questions/6784463/error-trustanchors-parameter-must-be-non-empty/6788682#6788682
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27327931

http://stackoverflow.com/comment/43369067
type: Comment
comment on: http://stackoverflow.com/q/27466041
type: QuestionComment
score: 0
has text: You have a Activity 'SignUpOrLogInActivity' that contains two button "log in" and "sign up" after log in or sign up control goes to another activity that contains four tab bar.. and last one has a log out button. after click this button control again goes to 'SignUpOrLogInActivity' this activity... am i right .... now you can post you logcat...

http://stackoverflow.com/q/27331274
tagged with: java
downvote count: 1
type: Question
has body: I am getting started to learn Java and I wrote a simple array example program, public class ExampleArray { public static void main(String[] args) { // TODO Auto-generated method stub int a[] = {10, 20, 30, 40, 50}; System.out.println(a[2] + " " + a[4]); for (int temp : a) { System.out.println(temp); } } } This is the output: 30 50 10 20 30 40 50 It prints all the values from an array. May I know, what is the use of temp in Java? Can anyone explain this keyword please?
has answer: http://stackoverflow.com/a/27331342
accepted answer: http://stackoverflow.com/a/27331329
answer count: 3
has comment: http://stackoverflow.com/comment/43120481
has title: What is temp and what is the use of temp in java?
has comment: http://stackoverflow.com/comment/43120401
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/43120399
has comment: http://stackoverflow.com/comment/43120368
has comment: http://stackoverflow.com/comment/43120370
has comment: http://stackoverflow.com/comment/43120381
has comment: http://stackoverflow.com/comment/43120367
has comment: http://stackoverflow.com/comment/43120337
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27331320
has answer: http://stackoverflow.com/a/27331329
has answer: http://stackoverflow.com/a/27331320
score: 1

http://stackoverflow.com/a/27342358
answers question: http://stackoverflow.com/q/27342333
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43140458
has body: What's your servlet here? The one that you get by compiling page2.jsp as a servlet? If that's the case, make sure you are retrieving the parameter correctly by using: request["command"] If your servlet is a real servlet (no JSP page), then you need to map a URL to that servlet and invoke the servlet with that URL mapping. Make sure you post more info so you will get better help.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27342333

average
tags question: http://stackoverflow.com/q/27365642
tags question: http://stackoverflow.com/q/27325061
tags question: http://stackoverflow.com/q/27388912
type: Tag
tag name: average

http://stackoverflow.com/comment/43243129
type: Comment
type: QuestionComment
has text: Ok, thanks for the awnser. I already suspected that only JPA was not enough. What is the hibernate solution for this?
comment on: http://stackoverflow.com/q/27387307
score: 0

http://stackoverflow.com/comment/75328247
has text: WHOA! Didn't know I'm allowed to specify projection interfaces inside projections! Is it mentioned somewhere in the docs?
comment on: http://stackoverflow.com/q/27354743
type: Comment
type: QuestionComment
score: 4

http://stackoverflow.com/a/27433685
has body: Thanks to Egor's comment, When I looked closely at my Android Manifest, here's what I saw &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" android:category="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; category should be its own tag, that is &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt;
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/27433481
answers question: http://stackoverflow.com/q/27433481
type: AcceptedAnswer

http://stackoverflow.com/q/27408974
tagged with: nullpointerexception
tagged with: junit
answer count: 1
downvote count: 0
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/43264964
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27409427
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: testing
linked to: http://stackoverflow.com/q/218384
has body: I'm testing two activities: the first one completes its tests and finishes, but the first test in the second one crashes with the following error: Test failed to run to completion. Reason: 'Instrumentation run failed due to 'java.lang.NullPointerException''. Check device logcat for details I figured the line activity = getActivity(); in the test class gives a null and thus crashes the test. Here's the relevant part of the test class. Why does this happen, and how do I fix it? public ResultActivityTest() { super(ResultActivity.class); } @Override protected void setUp() throws Exception { super.setUp(); activity = getActivity(); displayoperands = (TextView) activity.findViewById(R.id.result_textview); resultdisplay = (TextView) activity.findViewById(R.id.textView2); canvas = (SurfaceView) activity.findViewById(R.id.surfaceview); layoutRoot = (RelativeLayout) activity.findViewById(R.id.rellay); back = (Button) activity.findViewById(R.id.back_button); activity.setImag1(2.0); activity.setImag2(2.0); activity.setReal1(2.0); activity.setReal2(2.0); activity.setOperation("A"); }
accepted answer: http://stackoverflow.com/a/27409427
has title: JUnit test crashes in setUp

http://stackoverflow.com/comment/43367422
type: QuestionComment
comment on: http://stackoverflow.com/q/27464781
has text: http://stackoverflow.com/questions/12242083/remove-duplicates-from-list-using-guava/12248480#12248480 ?
score: 0
type: Comment

http://stackoverflow.com/comment/43245548
has text: Why do you have two for loops for numOfCanAl?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27399936
type: Comment

http://stackoverflow.com/q/27349947
type: Question
tagged with: libgdx
upvote count: 5
tagged with: java
tagged with: google-play-services
score: 5
tagged with: robovm
answer count: 1
downvote count: 0
tagged with: ios
favorite count: 0
has answer: http://stackoverflow.com/a/27463143
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27463143
has body: I am currently working on porting my LibGDX game to iOS using roboVM. Everything works except I have run into some issues with getting my bindings to work for admob and Google Play Game Services. I was able to workaround an issue with Admob but the same issue has come up for GPGS and I can't find a way around it. The bindings are hooks that tie into various iOS SDK's. I use them to show Admob ads and interface with Google Play services. I tried to follow the Sample.java here: Sample.java But it has some issues for me. First of all the didFinishLaunching() method the sample overrides is wrong and never gets called. It should override didFinishLaunching(UIApplication application, UIApplicationLaunchOptions launchOptions) instead. The main issue I'm having now is that the game does not accept user inputs due to the window.makeKeyAndVisible() call. If I take that method out, everything works great but I cannot show ads nor show the Google Play Services. I will see a warning about the window not being in the view hierarchy. I was able to work around this for the admob interstitial ads by only calling makeKeyAndVisible() before showing the ad and calling setHidden() after it is dismissed in the interstitial's delegate. However I do not have access to do the same with Google Play services. It doesn't seem like anyone else is encountering this issue. What could be the problem? I'm not very familiar with iOS so I don't get what needs to happen to make my app receive inputs properly.
has title: libGDX iOS game does not receive input

http://stackoverflow.com/comment/43377134
has text: @duygumersin A Map can only hold single value for each key. If you want it to hold multiple values for the same key, you can change the value to be a collection. For example, `HashMap<String, List<String>>`. Of course, you wouldn't be able to use putAll in this case. You'll have to iterate over the entries of the source map and add the relevant Strings to the target map
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27471123

http://stackoverflow.com/comment/43210903
has text: `kryo.register(PlayerData[].class); `
comment on: http://stackoverflow.com/q/27380369
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27338475
has answer: http://stackoverflow.com/a/27338588
has answer: http://stackoverflow.com/a/27339714
answer count: 2
has body: I have a tree where the leaves are marked with L and the non-leaf nodes are marked with I. I am given the preorder traversal of the tree. An example is IIILLILILLIIILLLIILILLL. I have to build the huffman tree for this included string. I originally pass in a new Root(), 0, and my treeString for my arguments. TreeString would be the string with the I's and L's pasted above. For some reason my code causes a StackOverflow exception to be thrown. My code is as follows for the makeTree method: public static void makeTree (BinaryNodeInterface&lt;Character&gt; root, int start, String treeString) { if (treeString.charAt(start)=='L'){ root.setLeftChild(null); root.setRightChild(null); return; } BinaryNodeInterface&lt;Character&gt; leftSide = new BinaryNode&lt;Character&gt;(); root.setLeftChild(leftSide); makeTree(root.getLeftChild(), start++, treeString); BinaryNodeInterface&lt;Character&gt; rightSide = new BinaryNode&lt;Character&gt;(); root.setRightChild(rightSide); makeTree(root.getRightChild(), start++, treeString); } I have no idea what is causing the stackoverflow exception to be thrown. I would think that my base case at the beginning would return and handle it.
score: 0
tagged with: preorder
tagged with: huffman-code
has title: Build Binary Tree from Preorder Traversal: Stack Overflow Error
possible better answer: http://stackoverflow.com/a/27339714
tagged with: tree
tagged with: recursion
accepted answer: http://stackoverflow.com/a/27338588
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/43151953
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/27348662
type: Comment
has text: Provide some sample inputs and desired outputs for testing

http://stackoverflow.com/a/27316159
has comment: http://stackoverflow.com/comment/43092515
has comment: http://stackoverflow.com/comment/43093270
has comment: http://stackoverflow.com/comment/43092350
answers question: http://stackoverflow.com/q/27316011
has comment: http://stackoverflow.com/comment/43092445
has body: Try annotating your controller as @Controller and give '/dashboard' default request mapping to the controller so that the dashboard controller can answer to the requests with uri starting as '/dashboard' @Controller @RequestMapping("/dashboard") public class DashboardController Use debug points to see whether the request has fallen thourgh your controller pipeline, white page might be related to an empty template
score: 0
type: Answer

http://stackoverflow.com/a/27338258
type: Answer
has body: http://openjdk.java.net/jeps/180 As of Java 8, HashMap does fall back to a binary tree if there are enough collisions.
has comment: http://stackoverflow.com/comment/81092526
answers question: http://stackoverflow.com/q/27336084
accepted answer of: http://stackoverflow.com/q/27336084
upvote count: 3
type: AcceptedAnswer
downvote count: 0
score: 3

http://stackoverflow.com/a/27327681
score: 0
has body: It sounds like Java object serialization might do the trick for you. With serialization, you can write any object to a file, and later read it in again and reconstruct the original object. If you then have an isEqual() method on the object, you can use that to simply check whether the object is the same. EDIT: reread the question. If you want to compare the file contents, then serialization is not particular useful, as there are bound to be small differences between the two files.
answers question: http://stackoverflow.com/q/27326487
type: Answer

http://stackoverflow.com/comment/43362292
comment on: http://stackoverflow.com/a/27462946
type: AnswerComment
has text: Yes, but at some point this code will generate less than 4 integers
score: 0
type: Comment

http://stackoverflow.com/comment/43188807
has text: when you define an interface, you usually are going to use it. elevating the visibility in the implementation is not going to do anything.
comment on: http://stackoverflow.com/q/27368432
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43216273
has text: Sample as often as you need, and combine over as long a period as necessary to produce a reasonable number: without your hardware in my hand it's hard to give you an idea of how often you should be polling, but the concept should help with some trial and error
comment on: http://stackoverflow.com/q/27383550
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43287498
comment on: http://stackoverflow.com/a/27422523
score: 0
type: AnswerComment
has text: Would it be worthwhile using an array of objects, then getting the primitive from each object in the array?
type: Comment

elasticsearch
tags question: http://stackoverflow.com/q/27438602
tags question: http://stackoverflow.com/q/27435085
type: Tag
tags question: http://stackoverflow.com/q/27374618
tags question: http://stackoverflow.com/q/27380905
tags question: http://stackoverflow.com/q/27440369
tags question: http://stackoverflow.com/q/27353842
tags question: http://stackoverflow.com/q/27397768
tags question: http://stackoverflow.com/q/27359885
tags question: http://stackoverflow.com/q/27395157
tags question: http://stackoverflow.com/q/27427613
tag name: elasticsearch
tags question: http://stackoverflow.com/q/27364378

http://stackoverflow.com/comment/44286779
has text: I assume that the 'goalListView' attribute is the sublist that I want to perform the click upon. How do I get that list subview from the ExpandableListView that I have implemented? (Number 2 in my original comment) As a refresher... An expandable list view is a list of header items, each holding a sub-listview that contains its child views. It is that list of child views that I am trying to perform click events upon.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27923042

http://stackoverflow.com/comment/43345452
type: AnswerComment
has text: I am indeed saying that as far as they are concerned, threads should not know that the object they are requesting has been constructed just now or before. `GetInstance` (and the *singleton* pattern) does the book-keeping for them.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27448245

http://stackoverflow.com/comment/43305439
type: AnswerComment
comment on: http://stackoverflow.com/a/27431995
score: 0
type: Comment
has text: It actually saves a heck of a lot of time. since SSD's never seem to fail (only spinning disk drive, which make me think it could be a hardware issue). Loading about 5gb of image with 4 thread takes truly about a 1/3 - 1/4 of the time. I also feel that it is not the ImageIO cause the issue because if I use an InputStream it still fails I will try to issue a new reader in every thread to see if that solves the issue. Thanks!

http://stackoverflow.com/comment/43335667
has text: @Konato_K How dose it matter if you only measure the time it takes for an operation?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27448158

http://stackoverflow.com/a/27336402
has comment: http://stackoverflow.com/comment/44178642
answers question: http://stackoverflow.com/q/27336283
has comment: http://stackoverflow.com/comment/43129749
has comment: http://stackoverflow.com/comment/43129579
downvote count: 0
score: 1
upvote count: 1
has body: This task can be solved with small modification: static class RegisterHandler&lt;T&gt; { public &lt;E extends T&gt; void register( Class&lt;E&gt; klazz ) { // &lt;== Note additional generics customization. // do something } } Agree, generics are a bit tricky =)
type: Answer

http://stackoverflow.com/comment/43261457
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27408091
type: Comment
has text: @EpicPandaForce. If I make them protected, I am enabling other classes to use those methods inconsistenly. Perhaps I want run() and feedBetter() be executed always in the same order, that's why I wrap its execution in a final method

http://stackoverflow.com/q/27421800
tagged with: arrays
answer count: 0
downvote count: 0
tagged with: sorting
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/85313852
upvote count: 3
has comment: http://stackoverflow.com/comment/43286966
has comment: http://stackoverflow.com/comment/43286017
has title: writing pseudocode for my algorithm
tagged with: java
type: UnansweredQuestion
has body: I have implemented counting sort and I am struggling to write pseudocode for the last step of my algorithm. My code is as follows: public int[] countingSort(int[]array) { int[] aux = new int[array.length]; // find the smallest and the largest value int min = array[0]; int max = array[0]; for (int i = 1; i &lt; array.length; i++) { if (array[i] &lt; min) min = array[i]; else if (array[i] &gt; max) max = array[i]; } // init array of frequencies int[] counts = new int[max - min + 1]; // init the frequencies for (int i = 0; i &lt; array.length; i++) { counts[array[i] - min]++; } // recalculate the array - create the array of occurences counts[0]--; for (int i = 1; i &lt; counts.length; i++) { counts[i] = counts[i] + counts[i-1]; } // Sort the array right to the left // 1) look up in the array of occurences the last occurence of the given value // 2) place it into the sorted array // 3) decrement the index of the last occurence of the given value // 4) continue with the previous value of the input array (goto: 1), terminate if all values were already sorted for (int i = array.length - 1; i &gt;= 0; i--) { aux[counts[array[i] - min]--] = array[i]; } return aux; } My psuedocode is as follows: Procedure: Counting Sort Input: Array (A) Steps: Work out the min and max in the arrray DECLARE MIN AS first element in A DECLARE MAX AS MIN LOOP through elements in A IF the current element is less than MIN SET MIN to current element ELSE IF the current element is greater than MAX SET MAX to current element Initialise the array of frequencies DECLARE array C (counts) of size (MAX - MIN + 1) COUNT the frequency of each element LOOP through elements in A C[array[i]-min] increase by 1 Recalculate the array - Create the array of occurences Decrement C[0] by 1 LOOP through elements in C C[i] = C[i] - C[i-1] Sorting the arrays Look up in the array of occurences the last occurence of the given value LOOP through elements in the array of occurences Place it into the sorted array Decrement th…
score: 3

http://stackoverflow.com/q/27435729
has comment: http://stackoverflow.com/comment/43312345
tagged with: java
has body: In my online Java programming class I have to write a program where the user enters their age, and checks if it's between 0 and 125 - if it isn't, it shows an error code, and I need to use assertions to do that. Here is my code: import java.util.Scanner; public class eproject1 { public static void main(String args[]) { Scanner input = new Scanner(System.in); System.out.print("What is your age? "); int num = input.nextInt(); System.out.println(num); assert(num &gt;= 1 &amp;&amp; num &lt; 125); System.out.printf("You entered %d\n", num); // NEED TO FIX, SOMETHING ISN'T RIGHT } } The problem is that it tells you what age you entered, even if it's out of the range 1 to 124. Research says that I need to actually enable assertions, but the results I found online were very unhelpful as they involved some Eclipse stuff - I'm sure it's some kind of rookie mistake, since i'm not very good at programming. So ... how do you get the assertion stuff to work?
downvote count: 1
type: Question
tagged with: assertion
has answer: http://stackoverflow.com/a/66643682
has comment: http://stackoverflow.com/comment/43312318
has title: How to enable assertions?
score: 15
has answer: http://stackoverflow.com/a/27435742
linked to: http://stackoverflow.com/q/18168257
answer count: 3
has comment: http://stackoverflow.com/comment/43312328
has comment: http://stackoverflow.com/comment/43312312
has comment: http://stackoverflow.com/comment/106165205
has comment: http://stackoverflow.com/comment/43312323
favorite count: 0
has answer: http://stackoverflow.com/a/75035956
linked to: http://stackoverflow.com/q/5509082
type: UnansweredQuestion
upvote count: 16

http://stackoverflow.com/q/27464696
tagged with: scene
tagged with: mouseover
score: 0
answer count: 1
has body: I'm trying to implement a control that exists on a stage that, when moused over will be shown, and then when the mouse leaves it's bounds, hides itself. I've tried Stage.getScene().setOnMouseEntered((MouseEvent mEntered) -&gt; {Stage.show();}); Stage.getScene().setOnMouseExited((MouseEvent mExited) -&gt; {Stage.hide();}); I'm not really very surprised it didn't work, but it doesn't help me very much. Is it possible to detect when the mouse is over the Stage or Scene when it is hidden?
type: UnansweredQuestion
tagged with: stage
has title: Is it possible to detect when the mouse cursor is over a hidden stage or scene in JavaFX?
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/27470201
type: Question

http://stackoverflow.com/q/27318693
has answer: http://stackoverflow.com/a/27318842
tagged with: java
has title: tomcat 7: The requested resource is not available
has comment: http://stackoverflow.com/comment/43109048
has comment: http://stackoverflow.com/comment/43127569
score: 0
has body: I'm writing a full-stack web application using SpringMVC and Tomcat. When I run the program, it seems to work fine, no error messages, nothing in the log. But in Postman, all I'm getting is "The requested resource is not available." Here's my web.xml: contextConfigLocation classpath:spring/business-config.xml org.springframework.web.context.ContextLoaderListener mvc-dispatcher org.springframework.web.servlet.DispatcherServlet mvc-dispatcher / and my mvc-dispatcher-servlet.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <mvc:annotation-driven /> <property name="prefix" value="/WEB-INF/jsp/"/> <property name="suffix" value=".jsp"/> </beans> Any ideas what might be causing this?
answer count: 1
tagged with: tomcat
has comment: http://stackoverflow.com/comment/43096775
has comment: http://stackoverflow.com/comment/43121597
type: UnansweredQuestion
type: Question

http://stackoverflow.com/q/27449639
has comment: http://stackoverflow.com/comment/43343942
tagged with: selenium-webdriver
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43337988
has body: Out of no where, my eclipse project has started throwing the following error. Not sure what am I doing wrong, I have searched this forums and tried googling the problem but to no avail. I can't figure out whether it's something to do with Eclipse or there's something wrong with my code. Let me know if I need to provide some more information. Please help! java.lang.StackOverflowError at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method) at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:221) at org.eclipse.swt.widgets.Widget.mouseUp(Widget.java:1105) at org.eclipse.swt.widgets.Control.mouseUp(Control.java:2569) at org.eclipse.swt.widgets.Display.windowProc(Display.java:5635) at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method) at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:221) at org.eclipse.swt.widgets.Widget.mouseUp(Widget.java:1105) at org.eclipse.swt.widgets.Control.mouseUp(Control.java:2569) at org.eclipse.swt.widgets.Display.windowProc(Display.java:5635) at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method) at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:221) at org.eclipse.swt.widgets.Widget.mouseUp(Widget.java:1105) at org.eclipse.swt.widgets.Control.mouseUp(Control.java:2569) at org.eclipse.swt.widgets.Display.windowProc(Display.java:5635) at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method) at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:221) at org.eclipse.swt.widgets.Widget.mouseUp(Widget.java:1105) at org.eclipse.swt.widgets.Control.mouseUp(Control.java:2569) at org.eclipse.swt.widgets.Display.windowProc(Display.java:5635) at org.eclipse.swt.internal.cocoa.OS.objc_msgSendSuper(Native Method) at org.eclipse.swt.widgets.Widget.callSuper(Widget.java:221) at org.eclipse.swt.widgets.Widget.mouseUp(Widget.java:1105) at org.eclipse.swt.widgets.Control.mouseUp(Control.java:2569) at org.eclipse.swt.widgets.Display.windowProc(Display.java:5635) at org.eclipse.swt.inter…
type: Question
linked to: http://stackoverflow.com/q/214741
tagged with: java
has comment: http://stackoverflow.com/comment/43338032
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43338088
has title: Eclipse keeps throwing Unhandled event loop exception
has comment: http://stackoverflow.com/comment/43338462
score: 0

http://stackoverflow.com/comment/43374865
type: QuestionComment
comment on: http://stackoverflow.com/q/27469881
has text: The compiler is trying to parse as much as possible your code to not stop compiling each time it finds a syntax error (and hence output all the error in one time instead). In your case, it's possible that some fautive code could induce the compiler to interpret some invalid code as "valid". When you'll correct your first syntax error, it'll certainly highlight the second method declaration and so on. In this case, you cannot rely on them until you fix the first error.
score: 0
type: Comment

http://stackoverflow.com/comment/43348522
has text: In more detail: When you call B.m1(), the code in A.m1() will be executed because although class B extends class A, it doesn't overwrite m1. The problem is that A.m1() calls m2() (after printing "A.m1()") which has it's own implementation in B so its the one who is called. But if you put a super.m1() in there, A.m1() is called again, "A.m1()" is printed again and B.m2() is called again and so on. Got it?
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27455223

http://stackoverflow.com/q/27460411
has comment: http://stackoverflow.com/comment/43357476
has title: Java - How to get the Scale that fits on given rectangle
downvote count: 2
has comment: http://stackoverflow.com/comment/43357513
accepted answer: http://stackoverflow.com/a/27460519
has comment: http://stackoverflow.com/comment/43357262
type: Question
type: AnsweredQuestion
tagged with: java
upvote count: 0
score: -2
has body: I have A Paint method in java that Draws a Rectangle Randomly but my problem is that I want to find the perfect algorithm/formula that will fit the picture inside that Rectangle.
answer count: 1
has answer: http://stackoverflow.com/a/27460519
favorite count: 0

http://stackoverflow.com/a/27315704
type: Answer
answers question: http://stackoverflow.com/q/27315487
has body: you could write a second programm that generates "user input" and sends it to the main program via localhost?
score: 0

http://stackoverflow.com/comment/43178451
comment on: http://stackoverflow.com/q/27363235
type: Comment
score: 0
has text: as per java bean naming conventions you should call your method "isLoopquery()"
type: QuestionComment

http://stackoverflow.com/a/27414230
has comment: http://stackoverflow.com/comment/43272706
score: 0
has comment: http://stackoverflow.com/comment/43272507
type: Answer
answers question: http://stackoverflow.com/q/27413927
has body: Code seems OK. I think that the problem is the path. Are you sure that you put the right path in your input? Try to start the path with "/". For example "/resources/sprite_sheet.PNG"

http://stackoverflow.com/q/27352920
tagged with: google-cloud-platform
score: 1
favorite count: 0
has body: I used my datastore entity to store an int value number=0. In an add function I used count = number++. But first time app push to GAE, it shows 0. Then it start from 1. So I changed as int number =10 even though I get the value is zero but datastore store as 10. How can I get the updated value in java page after inserting a record? When I try to get the current value, it shows zero but in datastore it store as 10. Please help me to out this problem. how to get value 10. This happens only at the first time of deploy and first ticket only then it shows correct value (iterator value) thanks here my code @Entity public class Ticket { //static int nextID = 17; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String title; private Text description; static int nextID = 10; private int current; public Ticket(String title, Text description) { current = nextID++; this.title = title; this.priority = priority; this.description = description; }
type: UnansweredQuestion
tagged with: google-app-engine
upvote count: 1
has title: Custom Iterator in Datastore shows zero using JAVA
tagged with: java
type: Question
tagged with: google-cloud-datastore
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27386783

http://stackoverflow.com/comment/45600252
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27320573
has text: The [doc](http://www.gwtproject.org/articles/superdevmode.html) says that this option is for "chrome devtools." Is it supposed to work with Safari? Have you tried with Chrome?
score: 0

http://stackoverflow.com/comment/43161302
type: QuestionComment
score: 0
has text: JPA provides AttributeConverter so you can map any type. So what is the problem using that?
type: Comment
comment on: http://stackoverflow.com/q/27345454

http://stackoverflow.com/q/27462728
downvote count: 0
type: UnansweredQuestion
type: Question
score: 1
tagged with: java
tagged with: vaadin
has answer: http://stackoverflow.com/a/31066614
answer count: 2
upvote count: 1
tagged with: user-interface
has title: How to use Column Generators in a Table Vaadin 7?
has body: I have a problem in implementing ColumnGenerator in Vaadin. I am reading the Book of Vaadin, at chapter 5.21.5. Generated Table Columns, but it seems to be a little bit of lack of instructions in how actually you can implement such functionality. The book says you need to use generated columns when e.g. you have a column which value is given by values of the other columns, or when you want to format table columns in a particular way, then it makes an incomplete example where only an implementation of a single ColumnGenerator is given without actually showing how when this generator is used when rows are added to the table. So I tried to implement such functionality by myself, here is what I got: // Generated Table columns Table tableWithGeneratedCol = new Table(); tableWithGeneratedCol.addContainerProperty( "date", Date.class, null, "Date", null, null); tableWithGeneratedCol.addContainerProperty( "quantity", Double.class, null, "Quantity (l)", null, null); tableWithGeneratedCol.addContainerProperty( "price", Double.class, null, "Price (e/l)", null, null); tableWithGeneratedCol.addContainerProperty( "total", Double.class, null, "Total (e)", null, null); tableWithGeneratedCol.addGeneratedColumn("date", new DateColumnGenerator()); tableWithGeneratedCol.addGeneratedColumn("quantity", new ValueColumnGenerator("%.2f l")); tableWithGeneratedCol.addGeneratedColumn("price", new PriceColumnGeneretor()); tableWithGeneratedCol.addGeneratedColumn("total",new TotalColumnGenerator("%.2f e", "quantity", "price")); // adding some fake rows tableWithGeneratedCol.addItem(new Object[] { new GregorianCalendar().getTime(), // date column new Double(10), // quantity column new Double(10), // price column // nothing here // total column }, 1); // itemId tableWithGeneratedCol.addItem(new Object[] { new GregorianCalendar().getTime(), new Double(16.2), // quantity column new Double(21.2), // price column // nothing here // total column }, 2); // itemId tableWithGeneratedCol.addItem(new Object…
favorite count: 0
has answer: http://stackoverflow.com/a/27462993

http://stackoverflow.com/a/27432272
answers question: http://stackoverflow.com/q/27428623
type: Answer
has body: Ok I found out what was wrong inside OrderPage and CatalogPage there is a form action tag which holds URL to servlet String formURL = "/OrderPage"; // Pass URLs that reference own site through encodeURL. formURL = response.encodeURL(formURL); ..."&lt;FORM ACTION=\"" + formURL + "\"&gt;\n" ... and that must not include slash so when I remove slash that do the trick and I have response from server so the "/OrderPage" must be changed to "OrderPage". http://www.w3schools.com/tags/att_form_action.asp I figure this out when I've check my other working examples of servlets.I think to make this code works as it is design I have to remove / in all form action tags. Thanks to viartemev for his/her answers
score: 0
accepted answer of: http://stackoverflow.com/q/27428623
type: AcceptedAnswer

http://stackoverflow.com/comment/43131716
comment on: http://stackoverflow.com/a/27337462
type: Comment
has text: Your last sentence is confusing, can you please clarify?: the `method(int)` in `Child` has the exact parameter list of the calling expression.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43276837
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27416515
has text: [I@1f96302 is the Java default way to print an object that has no toString() implementation. It is the internal runtime type and memory address: [ means Array, I means integer @ means 'now comes the mem address' and the memory address itself.

http://stackoverflow.com/a/27420394
type: Answer
answers question: http://stackoverflow.com/q/27419893
has body: First, PUT is by default not enabled on web servers (including Tomcat), so before you try this, make sure that PUT is enabled or stick to POST. As mentioned above dispatching is possible if your two servlets (assuming there are 2 servlets) are under the same container. Otherwise if you are doing it from a stand alone client, the approach would be different. The below should work in all environments: Use HttpURLConnection (https://docs.oracle.com/javase/7/docs/api/java/net/HttpURLConnection.html) Use setRequestMethod to POST Use doInput/doOutput if you need to write and read from the stream (in your case I don't think either is necessary). This is relatively straight forward method and would work. If you need more flexibility of the client, you could use Apache Commons HTTP Client. One point of note, if you have nothing to write and nothing really to read, why are you thinking of using PUT?
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27419893
score: 0

http://stackoverflow.com/a/27375755
has comment: http://stackoverflow.com/comment/43202138
has comment: http://stackoverflow.com/comment/43202644
has comment: http://stackoverflow.com/comment/43238809
has comment: http://stackoverflow.com/comment/43237778
has comment: http://stackoverflow.com/comment/43236530
has body: 1- I need to read the reply from rest service and depend on that reply decide either to retry or to finish the process. Any processor (e.g. &lt;int-http:outbound-gateway&gt;) endpoint can be configured with &lt;request-handler-advice-chain&gt;. And there is out-of-the-box advices for you: RequestHandlerRetryAdvice and ExpressionEvaluatingRequestHandlerAdvice. You can specify the retry advice as first one and expression as the second. With the last you can make some decision to throw or not an exception to initiate that wrapping retry. Because this one can retry only on exception. It would be better than get deal with RetryContext to have an ability to specify the custom RetryPolicy independently of exceptions. In addition consider to use request-factory with timeout options to get deal with no response case. 2- I need to get multiple files from dynamic folder names for example ({wherever}/20140101/HERE WILL FIND THE THREE DBF FILES). Consider to use RecursiveLeafOnlyDirectoryScanner to scan those timestamp directories from the specified root dir. From other side you even can provide any DirectoryScanner implementation to achieve the requiremnts. 3- there is any possibility to process dbf files through spring integration and transform it to json No, Spring Integration doesn't support that feature. You can consider to use some existing tool to read DBF (https://github.com/iryndin/jdbf) and then build JSON manually. From other side feel free to contribute it back to the framework as an extension with appropriate adapters.
has comment: http://stackoverflow.com/comment/43204513
has comment: http://stackoverflow.com/comment/43238653
has comment: http://stackoverflow.com/comment/43238424
has comment: http://stackoverflow.com/comment/43238143
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43226734
has comment: http://stackoverflow.com/comment/43237942
has comment: http://stackoverflow.com/comment/43202246
has comment: http://stackoverflow.com/comment/43203825
has comment: http://stackoverflow.com/comment/43205995
score: 0
has comment: http://stackoverflow.com/comment/43237861
accepted answer of: http://stackoverflow.com/q/27372551
type: Answer
answers question: http://stackoverflow.com/q/27372551
has comment: http://stackoverflow.com/comment/43202798
has comment: http://stackoverflow.com/comment/43205617

http://stackoverflow.com/q/27397753
tagged with: spring-boot
tagged with: hibernate-4.x
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43278791
tagged with: jpa-2.1
has title: Spring boot data JPA getting NullPointerException related to transaction manager
has comment: http://stackoverflow.com/comment/43262576
score: 0
has body: At the outset, I have tried the options mentioned in various forums for the same stack trace I get. A few of them did not work while with others (like removing javax.persistence.transactiontype) I did not understand how and where to try it. I am using Spring Boot data JPA (1.2 RC2) + Hibernate (with a custom persistence.xml). Here is my Application.java @Configuration @ComponentScan(&lt;our package&gt;) @EnableAutoConfiguration(exclude = EmbeddedServletContainerAutoConfiguration.class) @EnableTransactionManagement @DependsOn("transactionManager") @EnableJpaRepositories(transactionManagerRef = "transactionManager") public class Application { public static void main(String[] args) { run(Application.class, args); } } My RepositoryConfiguration (as we have custom persistence.xml - currently need to reuse it) @Configuration public class RepositotyConfiguration { @Autowired private DataSource dataSource; @Value("${db.dialect}") private String dialectClass; @Bean(name = "entityManagerFactory") public LocalContainerEntityManagerFactoryBean entityManagerFactory(EntityManagerFactoryBuilder builder) { LocalContainerEntityManagerFactoryBean entityManagerFactory = builder.dataSource(dataSource). persistenceUnit("main").build(); entityManagerFactory.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); Properties additionalProperties = new Properties(); additionalProperties.put("hibernate.dialect", dialectClass); entityManagerFactory.setJpaProperties(additionalProperties); return entityManagerFactory; } @Bean(name = "transactionManager") public PlatformTransactionManager transactionManager(LocalContainerEntityManagerFactoryBean entityManagerFactoryBean) { JpaTransactionManager txManager = new JpaTransactionManager(); txManager.setEntityManagerFactory(entityManagerFactoryBean.getObject()); return txManager; } } The transactionManager here is created if I do not have a single Repository but the moment I add one, ny tests fail with this exception: Caused by: java.lang.NullPointerExc…
has comment: http://stackoverflow.com/comment/43262634
type: UnansweredQuestion
tagged with: transactionmanager
has comment: http://stackoverflow.com/comment/43276762

multimap
tags question: http://stackoverflow.com/q/27381638
type: Tag
tag name: multimap
tags question: http://stackoverflow.com/q/27417494
tags question: http://stackoverflow.com/q/27441790

http://stackoverflow.com/q/27402968
score: 0
answer count: 1
has body: I'm making a question/answer application , kinda like stack-overflow but as a desktop app for a uni project(not asking to do my work for me though , ive done a good part so far). The questions,answers,users and comments are all stored in XML files rather than a SQL databse. Now i have my XMLParser working with DOM , i made all of the needed functions like - User getUserById() - ArrayList&lt;Comment&gt; getCommentsByQid() and so on ... Also done the interface which is similar to this web page but as a java application, all working so far. How the interface looks isnt at all part of the project . The problem is teacher just told us that the files shouldn't be stocked nor treated locally (logical he never asked for it :/), and that i should make all these functions treated by a server which then parses the XML files and then reports the result to the application in XML format so that the application can go ahead and display the info ... Well i know socket programming but re-doing things at this low level would take me forever, and after asking around i learned that it should be easily done since i have the functions ready , and that Netbeans (which im using) has servers like that ... So what id have to do is make the application request something from the server application , like "get all questions tagged java" , the server then calls getQuestionsByTag("java") which i already written, and returns the result as XML ... what is it that im looking for here ? HTTP server ? apache ? a service ? ... link to any good tutorial would do .
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
has title: JAVA Client-Server application communicating with XML
tagged with: java
type: Question
tagged with: client-server
has answer: http://stackoverflow.com/a/27442293

http://stackoverflow.com/a/39565619
type: Answer
has body: Using getText() with an EditText returns an Editable (ie, an editable String). An Editable does not have a deleteCharAt (int index) method like StringBuilder does. However, you can use its delete (int st, int en) method as an alternate, where st is the start index and en is the end index (exclusive). So if you want to delete a single char then make en = st + 1. int index = 4; EditText myEditText = (EditText) findViewById(R.id.editText); Editable text = myEditText.getText(); text.delete(index, index + 1); // delete char at index
answers question: http://stackoverflow.com/q/27385585
score: 0

http://stackoverflow.com/comment/43323475
score: 0
type: AnswerComment
type: Comment
has text: wow, that's working thank you sir, i'm spending 3 hours to solve this, with banging my head into wall, you solve this just within minute :D, a very much thanks sir :*
comment on: http://stackoverflow.com/a/27441924

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

http://stackoverflow.com/a/27371748
answers question: http://stackoverflow.com/q/27371659
has comment: http://stackoverflow.com/comment/43195773
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/43195251
downvote count: 0
has body: If you need to parse a JSON string, you do not need to use any JSONParser class. The JSONObject itself can be used for parsing JSON. Pass the JSON string to a new JSON object as following: JSONObject responseObject = new JSONObject(response); //response is the JSON string that you get as response String name = responseObject.get("name"); Similarly you can get the values directly from the responseObject itself. No need to use any third party libraries. You can find a very good documentation here. EDIT: I prefer Android Asynchronous Http Client for making web requests.
has comment: http://stackoverflow.com/comment/43195411
has comment: http://stackoverflow.com/comment/43195673
has comment: http://stackoverflow.com/comment/43328474
score: 4
accepted answer of: http://stackoverflow.com/q/27371659
type: AcceptedAnswer

http://stackoverflow.com/a/27390973
has comment: http://stackoverflow.com/comment/43229892
accepted answer of: http://stackoverflow.com/q/27390883
score: 0
answers question: http://stackoverflow.com/q/27390883
type: Answer
has body: This is similar to a BubbleSort algorithm, the inner loop is to find the value if any that needs to be swapped to the current slot of the array here is an example using a number array say you have 10 numbers in an array 1 2 5 7 8 3 4 6 9 0 you want to sort them from highest to lowest after one iteration of the code you provided if it was set for integers would look like this 9 2 5 7 8 3 4 6 1 0 it found the 9 and swapped the 1 with it so the 9 is now at the top of the list and it will do this for the entire array until the array looks like this 9 8 7 6 5 4 3 2 1 0
has comment: http://stackoverflow.com/comment/43229898
type: AcceptedAnswer

http://stackoverflow.com/q/27327008
has title: java - reading an arraylist collection from binary files and assigning each element in new array
has body: Previously, I have wrote a arraylist data into a binary file called (ItStateBinary.dat) and now I am trying to read the arraylist from the binary file, then assign each of the element in arraylist to the array. so far i have this: public CarOwner[] readListFromBinary() throws Exception { String fileName = "ItStateBinary.dat"; FileInputStream inStream = new FileInputStream(fileName); ObjectInputStream objectInputFile = new ObjectInputStream(inStream); //need to create CarOwner[] object called temp and return } readListFromBinary() method Reads an ArrayList collection from a binary file (ltStateBinary.dat). Then, each ArrayList object item is then written to a newly created CarOwner[] called temp. temp is returned to the calling method. edit: public CarOwner[] readListFromBinary() throws Exception { String fileName = "ItStateBinary.dat"; FileInputStream inStream = new FileInputStream(fileName); ObjectInputStream objectInputFile = new ObjectInputStream(inStream); ArrayList&lt;CarOwner&gt; read = (ArrayList&lt;CarOwner&gt;)objectInputFile.readObject(); CarOwner[] temp = read.toArray(new CarOwner[read.size()]); return temp; } does anybody know whats wrong with this method? it gives me compiler warning
answer count: 1
tagged with: arrays
tagged with: arraylist
tagged with: binary
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27327173
score: 0
accepted answer: http://stackoverflow.com/a/27327173

http://stackoverflow.com/a/27432058
accepted answer of: http://stackoverflow.com/q/27413296
answers question: http://stackoverflow.com/q/27413296
score: 3
downvote count: 0
upvote count: 3
type: AcceptedAnswer
has body: Add MANIFEST.MF to YOUR_PROJECT_NAME/web/src/main/webapp/META-INF/ folder with the simple content: Manifest-Version: 1.0 Or you can generate it using IntelliJ Artifacts Configuring
type: Answer

http://stackoverflow.com/a/27404987
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27404864
score: 1
downvote count: 0
has body: JLabel's name is different than the text it displays. To get the text from a JLabel, use getText().

http://stackoverflow.com/q/27419208
score: 0
has comment: http://stackoverflow.com/comment/43281497
has body: I am new to android, So i need a basic knowledge,How to connect to the database and Select some of the values from it. These are all the following steps i have already completed by watching and reading some online tutorials. Created a New ANDROID Project Named And2. Created a New JAVA Project named MYSQLConnection which is used to store the database connection. I have Downloaded mysql-connector-java-5.1.34 file Online and added it. I have attached the Screen Shot the total overview of my eclipse. Now i just needed to access the database in And2 and Write a Simple Select Query So that i can make sure that connection is created. Shown below is the Java file for DB Connection. import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Connection; import java.sql.Statement; import com.mysql.jdbc.*; //import com.mysql.jdbc.Connection; //import com.mysql.jdbc.Statement; public class Main { public static void main(String[] args) throws Exception { Class.forName("com.mysql.jdbc.Driver"); try { String connectionUrl = "jdbc:mysql://localhost:3306/testdatabase"; String connectionUser = "root"; String connectionPassword = "12345"; Connection conn = DriverManager.getConnection(connectionUrl, connectionUser, connectionPassword); //Statement stmt = conn.createStatement(); // ResultSet reset = stmt.executeQuery("select * from TableName"); // // //Print the data to the console // while(reset.next()){ // Log.w("Data:",reset.getString(3)); // // } } catch ( SQLException err ) { System.out.println("Database connection failed"); } } } Any Help appreciated.
has title: Android-MysqlConnectivity in eclipse
type: UnansweredQuestion
tagged with: android
tagged with: jdbc
has comment: http://stackoverflow.com/comment/43281798
answer count: 0
tagged with: java
tagged with: mysql
type: Question
tagged with: eclipse

http://stackoverflow.com/comment/43128696
type: QuestionComment
has text: I have tried different Layouts using setLayout(new layout) but that hasn't helped. what is and how do I use this use method
comment on: http://stackoverflow.com/q/27335149
score: 0
type: Comment

for-loop
tags question: http://stackoverflow.com/q/27376071
tags question: http://stackoverflow.com/q/27370159
tags question: http://stackoverflow.com/q/27327607
tags question: http://stackoverflow.com/q/27373731
tags question: http://stackoverflow.com/q/27370947
tags question: http://stackoverflow.com/q/27467550
tags question: http://stackoverflow.com/q/27392644
tags question: http://stackoverflow.com/q/27387784
tags question: http://stackoverflow.com/q/27338544
tags question: http://stackoverflow.com/q/27465169
tags question: http://stackoverflow.com/q/27471822
tags question: http://stackoverflow.com/q/27452831
tag name: for-loop
tags question: http://stackoverflow.com/q/27355938
tags question: http://stackoverflow.com/q/27386626
tags question: http://stackoverflow.com/q/27392432
tags question: http://stackoverflow.com/q/27456286
tags question: http://stackoverflow.com/q/27393142
tags question: http://stackoverflow.com/q/27472707
tags question: http://stackoverflow.com/q/27336523
tags question: http://stackoverflow.com/q/27431920
tags question: http://stackoverflow.com/q/27436303
tags question: http://stackoverflow.com/q/27453057
tags question: http://stackoverflow.com/q/27427922
tags question: http://stackoverflow.com/q/27319475
tags question: http://stackoverflow.com/q/27320961
tags question: http://stackoverflow.com/q/27352589
tags question: http://stackoverflow.com/q/27463951
type: Tag
tags question: http://stackoverflow.com/q/27319776
tags question: http://stackoverflow.com/q/27391777
tags question: http://stackoverflow.com/q/27328142
tags question: http://stackoverflow.com/q/27453820
tags question: http://stackoverflow.com/q/27345834
tags question: http://stackoverflow.com/q/27430305
tags question: http://stackoverflow.com/q/27383419
tags question: http://stackoverflow.com/q/27369952
tags question: http://stackoverflow.com/q/27350398
tags question: http://stackoverflow.com/q/27416337
tags question: http://stackoverflow.com/q/27390883

http://stackoverflow.com/q/27335073
has body: How can I add a new map to existing map. The maps have the same type Map&lt;String, Integer&gt;. If the key from new map exists in the old map the values should be added. Map&lt;String, Integer&gt; oldMap = new TreeMap&lt;&gt;(); Map&lt;String, Integer&gt; newMap = new TreeMap&lt;&gt;(); //Data added //Now what is the best way to iterate these maps to add the values from both?
answer count: 2
downvote count: 0
tagged with: iteration
favorite count: 0
has answer: http://stackoverflow.com/a/27335123
tagged with: merge
tagged with: dictionary
upvote count: 6
linked to: http://stackoverflow.com/q/40158605
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27335189
accepted answer: http://stackoverflow.com/a/27335189
score: 6
tagged with: collections
has comment: http://stackoverflow.com/comment/84296638
type: Question
possible better answer: http://stackoverflow.com/a/27335123
has title: What is the best practices to merge two maps
tagged with: java

http://stackoverflow.com/comment/43105112
has text: @MichalWilkowski How do I show web.xml? I will list my directory structure above!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27322818
score: 0

aop
tags question: http://stackoverflow.com/q/27353368
tag name: aop
tags question: http://stackoverflow.com/q/27332950
tags question: http://stackoverflow.com/q/27442366
tags question: http://stackoverflow.com/q/27422220
type: Tag
tags question: http://stackoverflow.com/q/27376570

http://stackoverflow.com/q/27424549
tagged with: hadoop
downvote count: 0
answer count: 1
has title: Garbage Collection information with Hadoop Jar
favorite count: 0
has body: Is there a way to see the garbage collection information when running a jar file using hadoop? e.g.: $ hadoop jar test.jar I tried to -verbose:gc flag with the above command but it didn't work.
type: UnansweredQuestion
tagged with: garbage-collection
upvote count: 1
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/31710372
type: Question

http://stackoverflow.com/comment/43276993
score: 0
has text: This is a function of the operating system, not of Java. If the operating system supports it, you can do it.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27416182

http://stackoverflow.com/q/27381659
has title: Java Methods and classes help for noob
tagged with: java
tagged with: methods
linked to: http://stackoverflow.com/q/2036970
has comment: http://stackoverflow.com/comment/43212659
type: Question
has comment: http://stackoverflow.com/comment/43212098
has comment: http://stackoverflow.com/comment/43212579
has answer: http://stackoverflow.com/a/27381757
has comment: http://stackoverflow.com/comment/43212113
score: -1
tagged with: class
tagged with: random
has body: I have this code: Scanner scan = new Scanner(System.in); Random rand = new Random(); int num1 = rand.nextInt(100); int num2 = rand.nextInt(100); What I am asking here is how can I get these into another method if they are created in a different method for example.. I create method 'x' with that code in, I then create another method 'y' which need to use these variables inside of 'x' method Am I trying something that can't be done? Or should I be using objects/classes or whatever Please help.
answer count: 1
has comment: http://stackoverflow.com/comment/43212057
favorite count: 0
has comment: http://stackoverflow.com/comment/43212115
type: UnansweredQuestion
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/43212150
has comment: http://stackoverflow.com/comment/43212235

http://stackoverflow.com/q/27413404
has answer: http://stackoverflow.com/a/27413503
accepted answer: http://stackoverflow.com/a/27413503
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/43271020
has comment: http://stackoverflow.com/comment/43306682
has title: How to format integers using DecimalFormat in Java?
has comment: http://stackoverflow.com/comment/43271031
has comment: http://stackoverflow.com/comment/43271079
has body: How does the syntax of DecimaFormat work? I'm trying to make 1234567890 --> 1-234-56789-0. So I tried DecimalFormat("#-###-#####-#); But that's clearly wrong!
has comment: http://stackoverflow.com/comment/43271016
type: Question
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43271068
tagged with: java
has comment: http://stackoverflow.com/comment/43271053

http://stackoverflow.com/a/27340945
answers question: http://stackoverflow.com/q/27338614
type: Answer
has body: When we use == operator, it checks if the objects point to the same location on the memory but the .equals on the other hand apart from checking if the objects point to the same location also checks for the equality of the object content in the memory location, thus providing double check. You can also override the equals class to perform other checks. So, always use the .equals to check equality of 2 objects.
score: 0

http://stackoverflow.com/q/27438705
has comment: http://stackoverflow.com/comment/43322547
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43630544
has body: I need some help with creating .xlsm file from a string data in java. I have a .xlsm file with multiple sheets, stored as text in sybase database. I read this file content from the database in a java string and now I want to create .xlsm file from this string data. is this possible ? Any help is highly appreciated. thank you.
answer count: 0
tagged with: java
has title: creating .xlsm file from a string data
type: Question
tagged with: xlsm
has comment: http://stackoverflow.com/comment/43618401
score: 0
has comment: http://stackoverflow.com/comment/43319374
has comment: http://stackoverflow.com/comment/43318119
has comment: http://stackoverflow.com/comment/43630853

http://stackoverflow.com/comment/43336369
comment on: http://stackoverflow.com/q/27448559
score: 0
has text: Nice tutorial on 9 patches: http://radleymarx.com/blog/simple-guide-to-9-patch/
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43266154
type: QuestionComment
has text: Post the code of the Car class if you have.
score: 0
comment on: http://stackoverflow.com/q/27410803
type: Comment

http://stackoverflow.com/comment/43186567
comment on: http://stackoverflow.com/a/27365898
has text: I didn't think about moving the contents manually across the JFrame. Thank you. Although I just hooked the controls to 2 buttons and move each individual element with setBounds(0, y, 650, 70) across the null layout JFrame since I have them all inside an ArrayList.
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43236867
type: QuestionComment
comment on: http://stackoverflow.com/q/27395049
has text: You will need to find a method that returns all the keys and values, then search through it looking for a value that matches. (The `TreeMap` does not order things by value, so a brute force search will be necessary.) Start by looking at the [javadoc](http://docs.oracle.com/javase/8/docs/api/java/util/TreeMap.html) for a method that returns the keys and values.
score: 0
type: Comment

http://stackoverflow.com/q/27346907
has comment: http://stackoverflow.com/comment/43149049
downvote count: 1
has comment: http://stackoverflow.com/comment/43148694
type: Question
has body: I want to create an application that reads from a text file with multiple lines of words. It will output the wordcount by counting the number of spaces between the words and adding a correction factor. I'm not sure what input methods to use to do this. My output with the current code is not correct. It will not count the words after the first and it does not count spaces at all. How can I fix it? public static void main(String[] args) throws IOException { Scanner in = new Scanner(new FileReader( "/input5.txt"));//file read System.out.println("Echo print of the input file is " + in.nextLine()); int i = 0; int counter = 0; String a = in.next(); while (in.hasNextLine()) { while (i &lt; a.length()) { if (a.charAt(i) == ' ') { counter++; } i++; } i = 0; } int wordcount = (counter + 1); System.out.println("The word count is " + wordcount); } bet Aiwegfu24r;q0912j cold jus not Money Nil Nelzik1-aj 129puehilhwueildgyuol That the input file. public static void main(String[] args) throws IOException { int count = 0; Scanner in = new Scanner(new FileReader( "/input5.txt"));//file read while (in.hasNextLine()) { System.out.println("echo print of the input: " + in.nextLine()); in.reset(); } while (in.hasNext()) { count++; in.next(); } System.out.println("The word count is " + count); } That's the new code.
possible better answer: http://stackoverflow.com/a/27346939
tagged with: if-statement
accepted answer: http://stackoverflow.com/a/27346956
answer count: 3
tagged with: while-loop
has comment: http://stackoverflow.com/comment/43148922
has title: Count spaces from text file to find its word count
favorite count: 0
has answer: http://stackoverflow.com/a/27346947
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27346956
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27346939
upvote count: 1

http://stackoverflow.com/comment/43289129
comment on: http://stackoverflow.com/q/27423563
has text: What do mean by 'without any contact to the main display'?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/27440701
accepted answer: http://stackoverflow.com/a/27441412
has body: There are two good (as considered by most) java practices that i try to combine and fail. Never leak this in a constructor. Use enum instead of singleton pattern. So, I want a singleton that as soon as created, listens for some event. Here's an example. First, the event listener interface: public interface EventListener { void doSomething(); } Then, the event producer: public class EventProducer implements Runnable{ private EventListener listener; public EventProducer(EventListener listener) { if (listener == null) { throw new NullPointerException("Listener should not be null."); } this.listener = listener; } @Override public void run() { listener.doSomething(); //This may run before the listener is initialized. do { long startTime = System.currentTimeMillis(); long currentTime; do { currentTime = System.currentTimeMillis(); } while ((currentTime - startTime) &lt; 1000); listener.doSomething(); } while (!Thread.currentThread().isInterrupted()); listener = null; //Release the reference so the listener may be GCed } } Then, the enum (as the 2nd listed java practice suggests): public enum ListenerEnum implements EventListener{ INSTANCE; private int counter; private final ExecutorService exec; private ListenerEnum() { EventProducer ep = new EventProducer(this); //Automatically unregisters when the producer is done. counter = 0; exec = Executors.newSingleThreadExecutor(); exec.submit(ep); } @Override public void doSomething() { System.out.println("Did something."); counter++; if (counter &gt;= 5) { exec.shutdownNow(); } } } And finally, something to get things started: public class TestRunner { public static void main(String[] args) { ListenerEnum.INSTANCE.doSomething(); } } The problem lies in the first line of the ListenerEnum constructor, as we are leaking this, thus not conforming to the 1st listed java practice. This is why our event producer can call a listener's method before the listener is constructed. How do I deal with this? Normally I would use a Builder patt…
type: AnsweredQuestion
score: 3
tagged with: enums
upvote count: 3
tagged with: java
has title: Java enum that registers as listener on creation
has answer: http://stackoverflow.com/a/27441346
type: Question
possible better answer: http://stackoverflow.com/a/27441491
has answer: http://stackoverflow.com/a/27441491
has comment: http://stackoverflow.com/comment/43321811
downvote count: 0
has comment: http://stackoverflow.com/comment/43321584
has comment: http://stackoverflow.com/comment/43321638
answer count: 3
tagged with: singleton
has comment: http://stackoverflow.com/comment/43321202
has answer: http://stackoverflow.com/a/27441412
has comment: http://stackoverflow.com/comment/43322006
has comment: http://stackoverflow.com/comment/43325765
has comment: http://stackoverflow.com/comment/43321517
favorite count: 0
tagged with: listener
has comment: http://stackoverflow.com/comment/43321313

http://stackoverflow.com/comment/83751697
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/44923402
has text: Just to clarify what do you mean by "refresh"? In what cases would that event be triggered? PS: new to spring boot

http://stackoverflow.com/q/27426786
has body: I'm trying to make database for my program and I'm having a lot of dumb problems... This is a fragment of the main activity: Database db = new Database(this,editText.getText().toString()); String text = db.printRow(); textView.setText(text); Now database class: String nickname="EmptyNick"; public Database(Context context, String name) { super(context, "database.db", null, 1); nickname = name; } public void onCreate(SQLiteDatabase db) { if(!nickname.equals("EmptyNick")) { db.execSQL("create table player(id integer primary key autoincrement,nick text);"); Users user = new Users(); user.setNick("Mariusz"); addPlayer(user); } else { //not important } } private void addPlayer(Users user) { SQLiteDatabase db = getWritableDatabase(); ContentValues values = new ContentValues(); values.put("nick",user.getNick()); db.insertOrThrow("player",null,values); } public String printRow() { String string=null; if(!nickname.equals("EmptyNick")) { String[] columns = {"id","nick"}; SQLiteDatabase db = getReadableDatabase(); Cursor cursor = db.query("player",columns,null,null,null,null,null); cursor.moveToFirst(); while (cursor.moveToNext()) { string += cursor.getString(1); } } else { //not important } return string; } Errors: no such table: player Caused by: java.lang.reflect.InvocationTargetException Caused by: android.database.sqlite.SQLiteException: no such table: player (code 1): , while compiling: SELECT id, nick FROM player I really can't see what's wrong. Error says there is no table 'player', but it is. In the beginning of onCreate method on line: db.execSQL("create table player(id integer primary key autoincrement,nick text);"); Can somebody help me? If I make Toast instead of text.setText(...) it shows me empty field, so yes, it can't create specific row. I understand the error, but do not from where and why it comes.
upvote count: 1
tagged with: sqlite
favorite count: 0
has comment: http://stackoverflow.com/comment/43295423
has comment: http://stackoverflow.com/comment/43296290
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/43297283
linked to: http://stackoverflow.com/q/21881992
has comment: http://stackoverflow.com/comment/43299622
tagged with: java
has title: SQLite Java Android no such table, program crashes
type: Question
has answer: http://stackoverflow.com/a/27427168
has answer: http://stackoverflow.com/a/27429016
answer count: 2
downvote count: 2
score: -1

http://stackoverflow.com/comment/43106182
type: QuestionComment
has text: And you're seeing the `toString()` returned from a JCombBox. I'm guessing that you're calling `System.out.println(cmb);` or something similar to that, which is not what you want to do.
type: Comment
comment on: http://stackoverflow.com/q/27323421
score: 1

http://stackoverflow.com/q/27386513
has answer: http://stackoverflow.com/a/27392208
tagged with: box-api
type: AnsweredQuestion
upvote count: 3
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27392208
score: 3
has body: I am using the Java SDK (version 3.1.7) and cannot seem to find a way to find a file by path; the only way seems to be to walk through the root, check that the name exists, that it is a directory, pick its id, goto 1. Also, there doesn't seem to be a search option for that either. So, is it possible at all?
has title: Can you lookup files by path using the box API?
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/43264475
has text: I did it how you told me, with if and else if but now it doesn't go through the operations +,-,/,*. I want it to execute the input operation but with the numbers obtained after multiplication by 2.
type: Comment
comment on: http://stackoverflow.com/a/27395990
type: AnswerComment
score: 0

http://stackoverflow.com/q/27318443
type: UnansweredQuestion
has title: I can not import filters in playframework 2.3.7
has comment: http://stackoverflow.com/comment/43097409
has comment: http://stackoverflow.com/comment/43126533
tagged with: playframework-2.3
tagged with: java
type: Question
has body: I have seen this same question for scala language, but it didn't help my problem. I can not import filters in playframework 2.3.0 I want to add the CSRFFilter but I can't import play.filters.csrf.*;, project doesn't see this class. Global.java import play.GlobalSettings; import play.api.mvc.EssentialFilter; import play.filters.csrf.*; public class Global extends GlobalSettings { public &lt;T extends EssentialFilter&gt; Class&lt;T&gt;[] filters() { return new Class[] { CSRFFilter.class }; } } build.sbt name := """AppName""" version := "1.0-SNAPSHOT" lazy val root = (project in file(".")).enablePlugins(PlayJava) scalaVersion := "2.11.1" libraryDependencies ++= Seq( "mysql" % "mysql-connector-java" % "5.1.18", filters, javaJdbc, javaEbean, cache, javaWs ) and plugins.sbt resolvers += "Typesafe repository" at "https://repo.typesafe.com/typesafe/releases/" // The Play plugin addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.6") // web plugins addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.1") addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.1") addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.0.0") addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.0.0") Thanks in advance for your help.
score: 0
has comment: http://stackoverflow.com/comment/43127604
has comment: http://stackoverflow.com/comment/43124560
tagged with: playframework
answer count: 0
linked to: http://stackoverflow.com/q/24257288

http://stackoverflow.com/q/27361711
has answer: http://stackoverflow.com/a/27361770
has answer: http://stackoverflow.com/a/27361896
tagged with: arraylist
tagged with: bluej
has comment: http://stackoverflow.com/comment/43175529
possible better answer: http://stackoverflow.com/a/27362377
accepted answer: http://stackoverflow.com/a/27361896
has body: I was trying to build a simple Rock-Paper-Scissors game in Java. Basically, the idea is that players get eliminated when they make the wrong move. The final player remaining is the winner. I am relatively inexperienced and don't know too much. I ran into this ConcurrentModification exception when I ran it. I tried to Google a bit, but didn't get any easy fix. There were discussions about things like iterators which I don't quite know/understand. I tried it like below- GameStarter class: public class GameStarter { public static void main(String[] args) { RPS g = new RPS(); g.play(); } } RPS class: import java.util.ArrayList; public class RPS { Player p1 = new Player(" A "); Player p2 = new Player(" B "); Player p3 = new Player(" C "); Player p4 = new Player(" D "); Player p5 = new Player(" E "); ArrayList&lt;Integer&gt; hold =new ArrayList&lt;Integer&gt;(); ArrayList&lt;Player&gt; active = new ArrayList&lt;Player&gt;(); { active.add(p1); active.add(p2); active.add(p3); active.add(p4); active.add(p5); } public void play() { int i,j; while(active.size()&gt;1) { for(Player p:active) { System.out.print("\n Currently active players are: "+p.name+" , "); } System.out.println("\n\n"); for(Player p:active) { p.rpsThrow(); hold.add(p.cur); } if(hold.contains(1) &amp;&amp; hold.contains(2) &amp;&amp; !hold.contains(3)) { for(Player p: active) { if(p.cur==1) { active.remove(p); System.out.println("Player "+p.name+" eliminated "); } } } if(hold.contains(1) &amp;&amp; !hold.contains(2) &amp;&amp; hold.contains(3)) { for(Player p: active) { if(p.cur==3) { active.remove(p); System.out.println("Player "+p.name+" eliminated "); } } } if(!hold.contains(1) &amp;&amp; hold.contains(2) &amp;&amp; hold.contains(3)) { for(Player p: active) { if(p.cur==2) { active.remove(p); System.out.println("Player "+p.name+" eliminated "); } } } hold.clear(); try { Thread.sleep(3500); } catch(Exception ex) { } } if(active.size()==1) { for(Player p:active) { System.out.println("\n\n The winner is : \n"+p…
has answer: http://stackoverflow.com/a/27362377
answer count: 5
tagged with: concurrentmodification
type: AnsweredQuestion
has title: Any easy way to deal with ConcurrentModificationException in this java game?
has answer: http://stackoverflow.com/a/27361884
has comment: http://stackoverflow.com/comment/43175675
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27361762
type: Question

http://stackoverflow.com/comment/43282938
has text: No problem, your questions are trivial but not stupid :) You are right, if you create a Hello World in Eclipse, you can export it to a jar file. Then you create a text file (in the same directory as your jar is - just to simplify it). In the text file you put the command: `java -jar yourprogram.jar`. Finally rename your file from .txt to .bat and run it. This will execute your hello world program outside of your IDE.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27419714

http://stackoverflow.com/comment/43266400
has text: @stefan-armbuster high five for this precise and exhaustive answer Hello world works :)
comment on: http://stackoverflow.com/a/27407924
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27473045
has body: I have the following problem using the Eclipse debugger. I have to inspect a ResultSet rs object containing some rows obtained from a query. I put my rs object into the Eclipse debugger expression area to analize it content but I can't understand how do the following things: Where are stored the number of rows contained into my ResultSet object. How can I see the rows inside the expression area of the debugger? (I want see the rows and its content)
tagged with: java
type: Question
tagged with: debugging
has answer: http://stackoverflow.com/a/59289445
has title: How can I see the content of a ResultSet object inspecting it using the Eclipse debugger?
upvote count: 11
tagged with: eclipse
answer count: 1
downvote count: 0
tagged with: ide
has comment: http://stackoverflow.com/comment/43382449
favorite count: 0
tagged with: resultset
type: UnansweredQuestion
score: 11

http://stackoverflow.com/a/27406912
answers question: http://stackoverflow.com/q/27406433
has comment: http://stackoverflow.com/comment/43259440
score: 0
has body: Bloch is distinguishing inheritance of interface from inheritance of implementation. It is impossible to know from a slide deck what he said at this point in his presentation, but a typical argument for avoiding one public class inheriting from another is that it permanently ties the subclass to the superclass's implementation. For example, Properties cannot ever implement its property storage in HashMap form or any other form other than a HashTable. Another argument is that it couples the classes too tightly together. Modifications that would be beneficial to the superclass can break the subclass, or render its behavior worse. A third argument is that the subclass inherits methods from the superclass that may not make sense for it, or may do so in the future if the methods are added to the superclass. For example, because Stack extends Vector, it is possible to examine arbitrary elements below the top one, and even to add, remove, or modify internal elements. This one applies to some extent also to inheritance of interface, but it is not usually as much of a problem in that case. The first two arguments remain applicable to some extent even when the super- and subclasses have an is-a relationship.
type: Answer

http://stackoverflow.com/q/27446257
tagged with: java
has answer: http://stackoverflow.com/a/27588865
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/27446505
tagged with: jpanel
has body: I'm writing code in a JPanel, it's all working fine. However, the categories are not displayed when I view the panel. Here's the code I wrote: for(Category c : categories){ comboModel.addElement(c); NoResultsLabel.setVisible(false); } CategoriesCombo.setModel(comboModel); So that in the customized code inside the design I write the following: CategoriesCombo.setModel(comboModel); However, the categories still don't show in the combobox.
score: 0
has title: Categories don't show on JComboBox
answer count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43332901
tagged with: jcombobox

http://stackoverflow.com/a/27486798
score: 0
type: Answer
has body: Do you see anything in the logs when your app is run: http://www.jwrapper.com/guide-where-your-app-is-installed-and-logs.html The order of run is: Wrapper-... GenericUpdater-... YourVirtualAppName-... If you look in the latest one based on that order (or just the one most recently created) you can look at the end to see if it logged any errors?
answers question: http://stackoverflow.com/q/27472454

http://stackoverflow.com/q/27385333
tagged with: shapes
downvote count: 1
score: 1
tagged with: java
tagged with: slick2d
tagged with: coordinates
type: Question
tagged with: intersection
has comment: http://stackoverflow.com/comment/43219126
has comment: http://stackoverflow.com/comment/43219020
has title: Find coordinates of shapes intersecting
has body: I am trying to find the point where two shapes, (a line and circle), intersect and the coordinate where they do intersect with the end intention of creating a third line to use cosine rule with in order to calculate the angle which the first two lines meet at. This is using Java with slick2d. Thanks! public double angleBetweenLines(Line line1, Line line2){ Circle c = new Circle(self.drawX + 20, self.drawY + 20, line1.getBoundingCircleRadius()); Line line3 = new Line(/*x Coordinate of where line1 intersects c*/, /*y Coordinate of where line1 intersects c*/, /*x Coordinate of where line2 intersects c*/, /*y Coordinate of where line2 intersects c*/); } public void mouseInput(GameContainer container, StateBasedGame game, int delta){ Input input = container.getInput(); int mouseX = input.getMouseX(); int mouseY = input.getMouseY(); Line l = new Line(self.drawX + 20, self.drawY + 20, mouseX, mouseY); Line n = new Line(800, 0, 800, 900); double desiredAngle = angleBetweenLines(l, n); } The angleBetweenLines method should return the angle between line 1 and 2. This image shows a diagram of the situation https://www.dropbox.com/s/i8sbq728awqso1l/angle.png?dl=0
favorite count: 0
has comment: http://stackoverflow.com/comment/43219432
answer count: 0
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/27349749
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/43154267
tagged with: syntax
has answer: http://stackoverflow.com/a/43275128
tagged with: java
has title: Java Chat P2P Code Suggestion/Guidance
type: Question
has comment: http://stackoverflow.com/comment/43154061
tagged with: p2p
score: 0
has body: I have developed code to create a p2p chat program. My ChatServer code and ChatServerReturns compiles, but I keep running the other programs and getting errors such as "illegal start of expression" on the ChatClientGUI code at the public static void ACTION_B_SEND and public static void ACTION_B_DISCONNECT. I get the same errors on ChatCLIENT code at public void SEND(String X). I don't know why those errors occur. Chat Server Code import java.io.; import java.net.; import java.util.; import javax.swing.; public class ChatServer { //Array list to hold the Sockets public static ArrayList&lt;Socket&gt; ConnectionArray = new ArrayList&lt;Socket&gt;(); //Array list to hold all of the users public static ArrayList&lt;String&gt; CurrentUsers = new ArrayList&lt;String&gt;(); public static void main(String[] args) throws Exception { try { final int PORT = 2345; ServerSocket SERVER = new ServerSocket(PORT); System.out.println("Waiting for clients"); while(true) { //create new socket object Socket SOCK = SERVER.accept(); //add to array list of sockets ConnectionArray.add(SOCK); System.out.println("Client connected from: "+SOCK.getLocalAddress().getHostName()); AddUserName(SOCK); ChatServerReturn CHAT = new ChatServerReturn(SOCK); Thread X = new Thread(CHAT); X.start(); } } catch(Exception X) { System.out.print(X); } } public static void AddUserName(Socket X) throws IOException { //Crreate scanner object Scanner INPUT = new Scanner(X.getInputStream()); String UserName = INPUT.nextLine(); CurrentUsers.add(UserName); for(int i = 1; i &lt;= ChatServer.ConnectionArray.size(); i++) { Socket TEMP_SOCK = (Socket) ChatServer.ConnectionArray.get(i-1); PrintWriter OUT = new PrintWriter(TEMP_SOCK.getOutputStream()); OUT.println("!!!" + CurrentUsers); OUT.flush(); } } } ChatServerReturn import java.io.; import java.net.; import java.util.*; public class ChatServerReturn implements Runnable { //Globals Socket SOCK; private Scanner INPUT; private PrintWriter OUT; String MESSAGE = ""; public C…
answer count: 1

http://stackoverflow.com/a/27416910
downvote count: 0
has body: So, to rephrase @trashgod comments and mine (thanks @trashgod), you can use a MouseListener.mouseCLicked on your menus and pass the key as a constructor argument of the listener: class MenuMouseListener extends MouseAdapter { private String id; public MenuMouseListener(String id) { this.id = id; } @Override public void mouseClicked(MouseEvent arg0) { System.out.println("Selected: " + id); } } instead of jDistrict.setActionCommand("" + key + ""); jDistrict.addActionListener(new MenuActionListener()); you now have jDistrict.addMouseListener(new MenuMouseListener("" + key + ""));
type: Answer
score: 1
answers question: http://stackoverflow.com/q/27398872
upvote count: 1

http://stackoverflow.com/a/27470337
has comment: http://stackoverflow.com/comment/43375640
has comment: http://stackoverflow.com/comment/43375767
has comment: http://stackoverflow.com/comment/43375951
has comment: http://stackoverflow.com/comment/43375709
score: 0
has comment: http://stackoverflow.com/comment/43376214
type: Answer
accepted answer of: http://stackoverflow.com/q/27470303
has comment: http://stackoverflow.com/comment/43375916
has body: You need to call the methods that generate random numbers like this: if(command.equals("character")){ System.out.println("How many characters would you like generated?"); int numcharacter = input.nextInt(); RandomDataGenerator.random(numcharacter);//Call the methods } else if (command.equals("integer")){ System.out.println("What is the upper limit and lower limit of the integers you want to generate?"); int maxn1 = input.nextInt(); int minn2 = input.nextInt(); System.out.println("How many integers do you want to generate?"); int numinteger = input.nextInt(); RandomDataGenerator.random(minn2,maxn1,numinteger); //Call the method } else if (command.equals("double")){ System.out.println("What is the upper limit and lower limit of the doubles you want to generate?"); double maxn3 = input.nextDouble(); double minn4 = input.nextDouble(); System.out.println("How many doubles do you want to generate?"); int numdouble = input.nextInt(); RandomDataGenerator.random(maxn3,minn4,numdouble); //Call the method } Do note that you haven't completed making the random method which prints random characters.So nothing except new-lines will be printed when you call RandomDataGenerator.random(numcharacter);
answers question: http://stackoverflow.com/q/27470303
has comment: http://stackoverflow.com/comment/43376087
has comment: http://stackoverflow.com/comment/43375822
has comment: http://stackoverflow.com/comment/43375681
has comment: http://stackoverflow.com/comment/43376575
has comment: http://stackoverflow.com/comment/43375795
type: AcceptedAnswer

http://stackoverflow.com/comment/134095332
type: AnswerComment
score: 0
type: Comment
has text: note, global settings will be overriden by properties.gradle, and just commenting the line will not help. I had have to set Xmx2048 despite on global memory setting 4096
comment on: http://stackoverflow.com/a/67674074

http://stackoverflow.com/a/27316491
type: Answer
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27316329
downvote count: 0
has body: Put the call inside a method: Try this: class Overload { B4 subOb = new B4(1, 2, 3); void overLoad(){ subOb.show("This is k: "); subOb.show(); } }

http://stackoverflow.com/comment/43296126
type: Comment
has text: java.lang.IllegalArgumentException: wrong number of arguments means that the datatype you are trying to create or use has the wrong input, for instance String lol = new String("only one string is accepted", "i'm giving 2 over here") this would give the same error, try looking up what line has the problem and what datatypes are used on those lines, then look up how the datatypes work
type: QuestionComment
comment on: http://stackoverflow.com/q/27427254
score: 0

http://stackoverflow.com/q/27352952
type: Question
has comment: http://stackoverflow.com/comment/43159715
has body: I have the following simple code iterating over a PersistentSet: if (workers instanceof PersistentSet) { for (Object worker : workers) { // failed to lazily initialize a collection of role: ... } } I get the following exception: failed to lazily initialize a collection of role... What is the wrong thing in my code?
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27353133
possible better answer: http://stackoverflow.com/a/74226539
favorite count: 0
has answer: http://stackoverflow.com/a/74226539
has title: Exception while iterating over PersistentSet in Hibernate
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/27353133
upvote count: 1

http://stackoverflow.com/a/27414003
has comment: http://stackoverflow.com/comment/43272188
has comment: http://stackoverflow.com/comment/43272175
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27413990
has body: Use x.indexOf("l");, with "l" being the character to search for. This method returns the first occurence of the character. Take a look here for more info.

http://stackoverflow.com/a/27460709
has comment: http://stackoverflow.com/comment/43368038
answers question: http://stackoverflow.com/q/27460679
has comment: http://stackoverflow.com/comment/43389088
downvote count: 0
has body: Java Documentation says that If present, the invocation of another constructor must be the first line in the constructor.
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/27472681
has comment: http://stackoverflow.com/comment/43380946
has comment: http://stackoverflow.com/comment/43381062
has comment: http://stackoverflow.com/comment/43380605
has comment: http://stackoverflow.com/comment/43381193
score: 0
answers question: http://stackoverflow.com/q/27471301
has body: try: doMethod(new HashMap(){{ put("key", "value"); put("another", "value2"); }}); Explenation: Outer {} block means that this instance is of an anonymous class extends HashMap. Inner {} block means a code that is copied to the anonymous class's constructor.
type: Answer

http://stackoverflow.com/q/27345133
has body: I have JPQL/Hibernate for DA layer. I have a table as following: CREATE TABLE Log_Tbl ( id number, name varchar2(30), ); and I have a entity for above table as following: @Entity @Table(name = "Log_Tbl") public class ELog { @Column(name = "id") private long entity_id; @Column(name = "name") private String entity_name; } and map Log entity to Log_Tbl table by jpa; I have two JPQL queries as following: select ELog from ELog where entity_name = 'Job' select ELog from ELog where name = 'Job' Both queries returned the correct result. My question is: Why does the second query return the correct result although I used the column name instead of the entity_name property?
type: AnsweredQuestion
tagged with: jpa
downvote count: 0
has comment: http://stackoverflow.com/comment/43147514
has comment: http://stackoverflow.com/comment/43146445
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/43146350
upvote count: 6
has comment: http://stackoverflow.com/comment/43146721
has answer: http://stackoverflow.com/a/27356721
tagged with: java
tagged with: hibernate
answer count: 1
has title: use column name instead of entity property in JPQL
linked to: http://stackoverflow.com/q/3917312
score: 6
tagged with: jpql
accepted answer: http://stackoverflow.com/a/27356721

http://stackoverflow.com/q/27391320
has title: Wondering what I did wrong on my Java Thread Program?
type: UnansweredQuestion
tagged with: multithreading
has comment: http://stackoverflow.com/comment/43230400
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43230452
has body: I've been working on threads in Java, and this is my attempt at doing running 2 different threads to output the even numbers from 1-30, as well as the odd numbers from 1-30, each in a different thread. I am not sure if I've done something wrong or not, and I hope you can lend me some help. public class evenThread implements Runnable{ public static void run(){ System.out.println("Even Numbers: ") for(int j = 2; j &lt;= 30; j + 2){ System.out.println(", " &amp; j); } } } public class oddThread implements Runnable{ public static void run(){ System.out.println("Odd Numbers: ") for(int i = 1; i &lt;= 30; i + 2){ System.out.print(", " &amp; i); } } } public static void main(String args[]){ evenThread t1 = new evenThread(); oddThread t2 = new oddThread(); t1.start(); t2.start(); } }
type: Question
has answer: http://stackoverflow.com/a/27391374
answer count: 3
has comment: http://stackoverflow.com/comment/43253390
has answer: http://stackoverflow.com/a/27392870
linked to: http://stackoverflow.com/q/16689449
has answer: http://stackoverflow.com/a/27391376

android
tags question: http://stackoverflow.com/q/27405401
tags question: http://stackoverflow.com/q/27456023
tags question: http://stackoverflow.com/q/27455943
tags question: http://stackoverflow.com/q/27415434
tags question: http://stackoverflow.com/q/27462383
tags question: http://stackoverflow.com/q/27339518
tags question: http://stackoverflow.com/q/27330827
tags question: http://stackoverflow.com/q/27447129
tags question: http://stackoverflow.com/q/27471061
tags question: http://stackoverflow.com/q/27459242
tags question: http://stackoverflow.com/q/27352561
tags question: http://stackoverflow.com/q/27330787
tags question: http://stackoverflow.com/q/27354255
tags question: http://stackoverflow.com/q/27354703
tags question: http://stackoverflow.com/q/27346852
tags question: http://stackoverflow.com/q/27372118
tags question: http://stackoverflow.com/q/27335886
tags question: http://stackoverflow.com/q/27370216
tags question: http://stackoverflow.com/q/27451420
tags question: http://stackoverflow.com/q/27418441
tags question: http://stackoverflow.com/q/27417111
tags question: http://stackoverflow.com/q/27372779
tags question: http://stackoverflow.com/q/27459135
tags question: http://stackoverflow.com/q/27459804
tags question: http://stackoverflow.com/q/27343500
tags question: http://stackoverflow.com/q/27334042
tags question: http://stackoverflow.com/q/27375623
tags question: http://stackoverflow.com/q/27378459
tags question: http://stackoverflow.com/q/27402616
tags question: http://stackoverflow.com/q/27437536
tags question: http://stackoverflow.com/q/27389557
tags question: http://stackoverflow.com/q/27394499
tags question: http://stackoverflow.com/q/27417330
tags question: http://stackoverflow.com/q/27435313
tags question: http://stackoverflow.com/q/27401381
tags question: http://stackoverflow.com/q/27385585
tags question: http://stackoverflow.com/q/27470845
tags question: http://stackoverflow.com/q/27371621
tags question: http://stackoverflow.com/q/27458447
tags question: http://stackoverflow.com/q/27471784
tags question: http://stackoverflow.com/q/27424571
tags question: http://stackoverflow.com/q/27431266
tags question: http://stackoverflow.com/q/27462094
tags question: http://stackoverflow.com/q/27362223
tags question: http://stackoverflow.com/q/27382202
tags question: http://stackoverflow.com/q/27320120
tags question: http://stackoverflow.com/q/27459443
tags question: http://stackoverflow.com/q/27446383
tags question: http://stackoverflow.com/q/27471110
tags question: http://stackoverflow.com/q/27446975
tags question: http://stackoverflow.com/q/27326463
tags question: http://stackoverflow.com/q/27334392
tags question: http://stackoverflow.com/q/27388223
tags question: http://stackoverflow.com/q/27345657
tags question: http://stackoverflow.com/q/27331041
tags question: http://stackoverflow.com/q/27441520
tags question: http://stackoverflow.com/q/27463318
tags question: http://stackoverflow.com/q/27333797
tags question: http://stackoverflow.com/q/27415664
tags question: http://stackoverflow.com/q/27347381
tags question: http://stackoverflow.com/q/27441933
tags question: http://stackoverflow.com/q/27321541
tags question: http://stackoverflow.com/q/27362603
tags question: http://stackoverflow.com/q/27449035
tags question: http://stackoverflow.com/q/27392027
tags question: http://stackoverflow.com/q/27345055
tags question: http://stackoverflow.com/q/27315411
tags question: http://stackoverflow.com/q/27371266
tags question: http://stackoverflow.com/q/27436802
tags question: http://stackoverflow.com/q/27329140
tags question: http://stackoverflow.com/q/27417739
tags question: http://stackoverflow.com/q/27468223
tags question: http://stackoverflow.com/q/27439567
tags question: http://stackoverflow.com/q/27395094
tags question: http://stackoverflow.com/q/27399318
tags question: http://stackoverflow.com/q/27339576
tags question: http://stackoverflow.com/q/27419208
tags question: http://stackoverflow.com/q/27468382
tags question: http://stackoverflow.com/q/27361215
tags question: http://stackoverflow.com/q/27378720

http://stackoverflow.com/comment/43255303
type: QuestionComment
has text: still not working I cannot figure out why
comment on: http://stackoverflow.com/q/27385274
score: 0
type: Comment

http://stackoverflow.com/q/27335794
favorite count: 0
score: 0
has body: I am a beginner in java, I have tried to solve the below program, but getting error, can anyone tell me where I am doing mistake? public class TestGlass { public static void main(String [] args) { Glass milk = new Glass(15); // 15 ounces of milk Glass juice = new Glass(3); // 3 ources of juice milk.drink(2); milk.drink(1); milk.report(); juice.fill(6); // went from 3 to 9 ounces juice.drink(1); // now down to 8 ounces juice.report(); juice.spill(); juice.report(); } } class Glass { int ounce; public void spill() { ounce = 0; } public void drink(int x){ ounce = ounce-x; } public void fill(int x){ ounce = ounce+x; } public int getOunce() { return ounce; } public void report() { int x = getOunce(); System.out.println("Glass has " + x + " ounces"); } } Here is the error, TestGlass.java:5: error: constructor Glass in class Glass cannot be applied to given types; Glass milk = new Glass(15); // 15 ounces of milk ^ required: no arguments found: int reason: actual and formal argument lists differ in length TestGlass.java:6: error: constructor Glass in class Glass cannot be applied to given types; Glass juice = new Glass(3); // 3 ources of juice ^ required: no arguments found: int reason: actual and formal argument lists differ in length 2 errors
has comment: http://stackoverflow.com/comment/43128760
downvote count: 1
accepted answer: http://stackoverflow.com/a/27335807
has comment: http://stackoverflow.com/comment/43128749
has comment: http://stackoverflow.com/comment/43128737
has answer: http://stackoverflow.com/a/27335817
has comment: http://stackoverflow.com/comment/43128421
has answer: http://stackoverflow.com/a/27335807
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/27335817
has comment: http://stackoverflow.com/comment/43128830
has comment: http://stackoverflow.com/comment/43128403
has title: Java program gives error
type: Question
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/43128453

http://stackoverflow.com/comment/43141749
has text: So now you should be able to do `rs.getString("TITLE")` and `rs.getString("ISBN")`, what more do you need?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27342755
score: 1

http://stackoverflow.com/comment/43309962
has text: thank you i figured that i just wanted to make sure that was the proper solution.
type: AnswerComment
comment on: http://stackoverflow.com/a/27434509
score: 0
type: Comment

http://stackoverflow.com/comment/43131448
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27337182
has text: Agree with Radiodef, a ListSelectionListener attached to the ColumnModel would be a safer approach. It is unlikely that the selection will have changed when the MouseListener is called
score: 0

http://stackoverflow.com/q/27348296
upvote count: 0
has comment: http://stackoverflow.com/comment/43151330
has comment: http://stackoverflow.com/comment/43151440
has answer: http://stackoverflow.com/a/27348405
has comment: http://stackoverflow.com/comment/43151274
has comment: http://stackoverflow.com/comment/43151379
has comment: http://stackoverflow.com/comment/43151317
has comment: http://stackoverflow.com/comment/43151276
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43151402
has comment: http://stackoverflow.com/comment/43151261
favorite count: 0
has comment: http://stackoverflow.com/comment/43151312
has comment: http://stackoverflow.com/comment/43151331
type: Question
downvote count: 2
accepted answer: http://stackoverflow.com/a/27348405
has comment: http://stackoverflow.com/comment/43151293
score: -2
answer count: 1
has body: I have a genreic object Class. When I add integers to the object and compare them it is returning the wrong answer. bsTree&lt;Integer&gt; tree = new bsTree&lt;Integer&gt;(); tree.add(6); Then in the comparison add(T value) { Node nodeWithData = root; System.out.println(Integer.parseInt(value.toString) &lt;= Integer.parse(nodeWithData.getContent().toString()) } The node content is equal to 5 but it prints true. Why? Current code that compiles public class bsTree&lt;T&gt; { private bNode root; private bNode currentNode = root; public bsTree() { root = null; } public bsTree(T[] anArray) { if(anArray==null) { return; } for(int i = 0; i&lt;anArray.length; i++) { add(anArray[i]); } } public void add(T value) { if(root == null) { System.out.println("Setting first node to " + value); root = new bNode(value); return; } else { //System.out.println("Value is = " + value); currentNode = root; while(currentNode != null) { if(Integer.parseInt(currentNode.getContent().toString()) &lt;= Integer.parseInt(value.toString())) { System.out.println(value + " &lt;= " + currentNode.getContent()); if(currentNode.getlChild() == null) { System.out.println("Setting left Child"); currentNode.setlChild(new bNode(value)); return; } else { System.out.println("Going left"); currentNode = currentNode.getlChild(); } } else { } } } } public static void main(String[] args) { bsTree&lt;Integer&gt; tree = new bsTree&lt;Integer&gt;(); tree.add(5); tree.add(6); tree.add(7); tree.add(8); tree.add(9); } }
has comment: http://stackoverflow.com/comment/43151462
tagged with: java
has comment: http://stackoverflow.com/comment/43151514
has comment: http://stackoverflow.com/comment/43151357
has comment: http://stackoverflow.com/comment/43151404
has title: Comparing parsed integer values returning wrong java
has comment: http://stackoverflow.com/comment/43151398

http://stackoverflow.com/q/27377027
type: UnansweredQuestion
has title: How to find out opened readers in Lucene
has answer: http://stackoverflow.com/a/27377616
tagged with: java
type: Question
tagged with: lucene
score: 0
answer count: 1
has body: I have some IndexReaders (for different commits) and a single IndexWriter opened. I index some documents, and in the end only one reader should be opened and the old ones should be closed. The readers should be closed, but when I restart the system(meaning I restart the IndexWriter), actually the size of the index in disk shrinks at least by half, meaning that probably some readers were still opened. Is there any way to figure out the readers per commit that are still in use in a certain moment?

http://stackoverflow.com/q/27397663
answer count: 1
type: UnansweredQuestion
has body: I am dealing with the log forging issue for the code : log.error("Request: " + req.getRequestURL() + " raised " + exception); This element’s value (req.getRequestURL()) flows through the code without being properly sanitized or validated, and is eventually used in writing an audit log in handleError I tried to remove the \n\r characters but with no success. I have gone through different sites searching for the same but did not find the helpful content. Can anyone please explain the solution for this or a small guide to fix it. Thanks
tagged with: log-forging
tagged with: logging
has comment: http://stackoverflow.com/comment/43248455
has answer: http://stackoverflow.com/a/37807628
tagged with: java
has comment: http://stackoverflow.com/comment/43245114
has comment: http://stackoverflow.com/comment/43241621
type: Question
has title: Log forging with the request object
has comment: http://stackoverflow.com/comment/43243650
score: 0

http://stackoverflow.com/a/57592172
has comment: http://stackoverflow.com/comment/133436361
answers question: http://stackoverflow.com/q/27405713
downvote count: 1
score: 19
upvote count: 20
has comment: http://stackoverflow.com/comment/138736433
has comment: http://stackoverflow.com/comment/114071243
has comment: http://stackoverflow.com/comment/140182073
has body: Best way to execute block of code after Spring Boot application started is using PostConstruct annotation.Or also you can use command line runner for the same. 1. Using PostConstruct annotation @Configuration public class InitialDataConfiguration { @PostConstruct public void postConstruct() { System.out.println("Started after Spring boot application !"); } } 2. Using command line runner bean @Configuration public class InitialDataConfiguration { @Bean CommandLineRunner runner() { return args -&gt; { System.out.println("CommandLineRunner running in the UnsplashApplication class..."); }; } }
type: Answer

http://stackoverflow.com/q/27471733
has title: The mean and the standard deviation of the values in its array parameter
accepted answer: http://stackoverflow.com/a/27471757
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27471757
tagged with: java
downvote count: 2
has body: Here's My Code; and I can find an array with this and I would like to calculate the mean of the values (overall) after this I would like to calculate standard deviation of this but I couldn't understand the question exactly so I dont have a method for now. Here's the question for standard deviation (Write a method that takes two parameters --a set of int values in an array and a double value representing their mean-- and computes and returns the standard deviation of the values using the given mean.) import java.util.*; public class Test { final static int N = 100; static int limit = 0; static int[] list; static int i, j; static int sum = 0; static Scanner scan = new Scanner (System.in); public static int[] generateArray () { System.out.print ("Enter your array limit: "); limit = scan.nextInt(); list = new int[limit]; for(i = 0; i &lt; limit; i++) { list[i] = (int) (Math.random() * 2 * N - N); } return list; } public static void printArray() { for(j = 0; j &lt; limit; j++) System.out.print (list[j] + "\t"); } public static void meanArray() { sum = sum + list[j]; //PROBLEM HERE System.out.println (sum); } public static void main(String[] args) { generateArray(); printArray(); meanArray(); //PROBLEM HERE } }
type: Question
score: -2
tagged with: jcreator
upvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/43103647
has text: `getModelTableName()` does this method gets your value as expected?
comment on: http://stackoverflow.com/q/27322199
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27357768
favorite count: 0
has answer: http://stackoverflow.com/a/27358108
has comment: http://stackoverflow.com/comment/43167958
has title: Inverted triangle in Java
answer count: 5
has body: I was trying to make an inverted triangle in java but I don't know what's wrong with my code public void Tr1(int height, int begin, int pos, char ch){ for (int i = 0;i &lt; height;i++){ for (int k = height;k &gt; height - 1 - i;k--){ System.out.print(" "); } for (int j = 0;j &lt; pos;j++){ System.out.print(" "); } for (int v = 0;v &lt; i*2+begin;v++){ System.out.print(ch); } System.out.println(); } } The result is: ** **** ****** ******** ********** ************ ************** **************** ****************** ******************** And I want this ******************* * * * * * * * * * * * * * * * * *
accepted answer: http://stackoverflow.com/a/27358108
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43169187
upvote count: 2
tagged with: java
downvote count: 2
linked to: http://stackoverflow.com/q/26459514
type: Question
has answer: http://stackoverflow.com/a/27357931
has comment: http://stackoverflow.com/comment/43167799
possible better answer: http://stackoverflow.com/a/27357923
has comment: http://stackoverflow.com/comment/43167837
has answer: http://stackoverflow.com/a/27357923
score: 0
has comment: http://stackoverflow.com/comment/43171303
has answer: http://stackoverflow.com/a/27359385
has comment: http://stackoverflow.com/comment/43167877
has answer: http://stackoverflow.com/a/27358380
has comment: http://stackoverflow.com/comment/43167855

http://stackoverflow.com/q/27390363
score: 8
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27390414
type: Question
has title: Spring: how to inject an inline list of strings using @Value annotation
linked to: http://stackoverflow.com/q/12576156
tagged with: java
has body: How do I inject a list of string values using the @Value annotation. I'm using Spring 4.1.2. I've tried: @Value(value = "top, person, organizationalPerson, user") private List<String> userObjectClasses and then based on the spring el documentation for inline lists: @Value(value = "{top, person, organizationalPerson, user}") private List<String> userObjectClasses These attempts only inject a string literal of the value given as the only element in the list. EDIT In this case, I'd like to be able to simply hard-code the values rather than read from a property file. This approach seems a little less smelly than: private List<String> userObjectClasses = Arrays.asList(new String[] {"top", "person", "organizationalPerson", "user"}); In the past, I've used spring's XML configuration to wire up beans, and in that case I could do (assuming the bean had a public setter for the userObjectClasses property): top person organizationalPerson user Is there an analog to this when using annotation based configuration?
duplicate of: http://stackoverflow.com/q/12576156
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27390414
favorite count: 0
upvote count: 8
has comment: http://stackoverflow.com/comment/49726533
tagged with: spring

http://stackoverflow.com/comment/43151901
type: QuestionComment
comment on: http://stackoverflow.com/q/27348605
has text: `if (a || b) { ... }`
score: 0
type: Comment

http://stackoverflow.com/comment/43234890
has text: No, I don't have a backup of it. How can I get data from this database now?? I have most important data on it
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27391958

http://stackoverflow.com/q/27463173
has title: @override method does not override or implement a method from a supertype
tagged with: java
answer count: 1
downvote count: 1
has body: I'm having a small problem regarding my coding for android. I'm still very new to this and run into a small issue. No matter what I seem to do I cant seem to clear the error on my @override. The error is @override method does not override or implement a method from a supertype and the error is on all 3 of the last 3 @Override. Through that it comes up with an error for Menu, menu, MenuItem, itmsearch and KeyEvent saying cannot find symbol. Any help would be great and thank you in advance. import android.os.Bundle; import android.widget.ArrayAdapter; public class MainActivity extends ListActivity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); super.setTitle("My Films"); setContentView(R.layout.main); setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.film_list_cell, R.id.text, CELLS)); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main_menu, menu); return true; } @Override public boolean onOptionsItemsSelected(MenuItem item) { if (item.getItemId() ==R.id.itmsearch) { onSearchRequested(); return true; } return false; } @Override public boolean onKeyUp(int keyCode, KeyEvent event) { if( keyCode == KeyEvent.KEYCODE_SEARCH) { onSearchRequested(); return true; } return false; } static final String[] CELLS = new String[] {"Cell 0", "Cell 1", "Cell 2", "Cell 3", "Cell 4", "Cell 5", "Cell 6", "Cell 7", "Cell 8", "Cell 9", "CEll 10"}; }
accepted answer: http://stackoverflow.com/a/27463244
upvote count: 4
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/43362580
favorite count: 0
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/27463244

http://stackoverflow.com/a/27340198
has comment: http://stackoverflow.com/comment/43137230
type: AcceptedAnswer
upvote count: 1
has comment: http://stackoverflow.com/comment/43136993
type: Answer
accepted answer of: http://stackoverflow.com/q/27340189
has comment: http://stackoverflow.com/comment/43136796
answers question: http://stackoverflow.com/q/27340189
has body: you have to add your intent-filter to your activity not in manifest tag : <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
has comment: http://stackoverflow.com/comment/43137262
has comment: http://stackoverflow.com/comment/43136733
downvote count: 0
has comment: http://stackoverflow.com/comment/43136723
score: 1

http://stackoverflow.com/comment/43177108
has text: What error does it return?
score: 0
comment on: http://stackoverflow.com/q/27362499
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43300927
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27429868
type: Comment
has text: this answer has been flagged as a low quality answer. please post some explanation to your post.

http://stackoverflow.com/comment/43154839
has text: Thanks.. So, in essence, the "parameters" of the model are saved with the model, because the generated model depends upon the parameters. I wasn't sure whether you had to specify the same parameters when loading/testing against the model... which now that I say that out loud /doesn't/ make much sense. Hmm. Just loading the model should be sufficient.
comment on: http://stackoverflow.com/a/27350109
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27335077
type: Question
tagged with: adt
score: 0
tagged with: sdk
has body: When i open the eclipse(adt) sdk manager it always prompt me these errors: Failed to fetch URL http://dl-ssl.google.com/android/repository/addons_list-2.xml, reason: Unknown Host dl-ssl.google.com and Failed to fetch URL http://dl-ssl.google.com/android/repository/repository-10.xml, reason: IO Unknown Host dl-ssl.google.com And the SDK manager doesn't loads all the packages and SDK. Does someone had the same problem? How did you solve it? Is there another way to download all the SDK and packages?
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/27335193
has title: How to download additional android SDK on eclipse adt
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27335193
tagged with: eclipse

http://stackoverflow.com/q/27446844
has body: In delete function, how to compare the value in hashTable and the value you input, my code was stuck there: //delete router public void delRouter(String routerNum){ Iterator it = ht.keySet().iterator(); while (it.hasNext()){ String key = it.next().toString(); //take Router object out Router router = (Router)ht.get(key); if(router.getRouterNum().equals(routerNum)){ // delete object ht.remove(routerNum); } } } I think the problem is ht.remove(); Please give me a hand. Thank you guys!
type: AnsweredQuestion
has title: Delete function in hashTable about the object select
upvote count: 0
type: Question
favorite count: 0
score: -1
has answer: http://stackoverflow.com/a/27447326
answer count: 2
downvote count: 1
accepted answer: http://stackoverflow.com/a/27447326
tagged with: java
possible better answer: http://stackoverflow.com/a/27447011
has answer: http://stackoverflow.com/a/27447011

http://stackoverflow.com/comment/43271805
type: QuestionComment
has text: It's simple. I want to make webdesktop app in which users could add new apps at runtime. I'm just looking for a way to do this. I know I could use just javascript but I don't like javascript as such and I have much more experience in developing software in vaadin. Normally this functionality wouldn't be needed as all client side components would be already compiled in but I just want to have an option to recompile everything when needed by new uncommon client side control to be added to the project.
comment on: http://stackoverflow.com/q/27386012
score: 0
type: Comment

http://stackoverflow.com/comment/43374353
type: Comment
type: QuestionComment
has text: As much as I understand (and as wikipedia states) decorator pattern requires `some groundwork is done at design time`. And since I'm not going to modify `JText*` classes source, I don't see how it can be acheived...
score: 0
comment on: http://stackoverflow.com/q/27469655

http://stackoverflow.com/comment/43462790
comment on: http://stackoverflow.com/a/27451145
type: AnswerComment
has text: [5, 6, 7, 8] [ 2,4,6,8, 8,7,9,1, 3,5,1,2, ] Exception in thread "main" java.lang.NullPointerException at ArrayPrinter.main(ArrayPrinter.java:16)
type: Comment
score: 0

http://stackoverflow.com/a/27331129
has comment: http://stackoverflow.com/comment/43120492
has comment: http://stackoverflow.com/comment/43120720
downvote count: 0
has comment: http://stackoverflow.com/comment/43120402
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43120671
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43120282
has comment: http://stackoverflow.com/comment/43120421
has comment: http://stackoverflow.com/comment/43120540
has comment: http://stackoverflow.com/comment/43120117
has comment: http://stackoverflow.com/comment/43121005
has comment: http://stackoverflow.com/comment/43120300
has comment: http://stackoverflow.com/comment/43120363
has body: If you maintain array of top 3 numbers and keep sorting it... Scanner scanner = new Scanner(System.in); int[] largest = new int[3]; while (scanner.hasNext()) { int number = scanner.nextInt(); scanner.nextLine(); if (number == 0) { break; } if (number &gt; largest[0]) { largest[0] = number; } Arrays.sort(largest); System.out.println(Arrays.toString(largest)); System.out.println(largest[0]); } scanner.close(); System.out.println("Third largest " + largest[0]);
has comment: http://stackoverflow.com/comment/43120570
has comment: http://stackoverflow.com/comment/43120262
type: Answer
has comment: http://stackoverflow.com/comment/43120417
accepted answer of: http://stackoverflow.com/q/27331042
has comment: http://stackoverflow.com/comment/43120390
has comment: http://stackoverflow.com/comment/43120289
answers question: http://stackoverflow.com/q/27331042

http://stackoverflow.com/a/27375482
type: Answer
has comment: http://stackoverflow.com/comment/43265275
accepted answer of: http://stackoverflow.com/q/27347018
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27347018
downvote count: 0
has body: just interpret the 32 bit int value as a 32 bit RGBA value. I dont know why you dont have to change the order of the channels, but using the int array as input for your cv::Mat you automatically get an BGRA ordering. Then you only have to remove the alpha channel, if needed. int main() { // the idea is that each int is 32 bit which is 4 channels of 8 bit color values instead of 3 channels, so assume a 4th channel. // first I create fake intArray which should be replaced by your input... const int imgWidth = 320; const int imgHeight = 210; int intArray[imgWidth*imgHeight]; // int array // fill the array with some test values: for(unsigned int pos = 0; pos &lt; imgWidth*imgHeight; ++pos) intArray[pos] = 8453889; // 00000000 10000000 11111111 00000001 =&gt; R = 128, G = 255, B = 1 //intArray[pos] = 65280; // green //intArray[pos] = 16711680; // red //intArray[pos] = 255; // blue // test: int firstVal = intArray[0]; std::cout &lt;&lt; "values: " &lt;&lt; " int: " &lt;&lt; firstVal &lt;&lt; " R = " &lt;&lt; ((firstVal &gt;&gt; 16) &amp; 0xff) &lt;&lt; " G = " &lt;&lt; ((firstVal &gt;&gt; 8) &amp; 0xff) &lt;&lt; " B = " &lt;&lt; (firstVal &amp; 0xff) &lt;&lt; std::endl; // here you create the Mat and use your int array as input cv::Mat intMat_BGRA = cv::Mat(imgHeight,imgWidth,CV_8UC4, intArray); // now you have a 4 channel mat with each pixel is one of your int, but with wrong order... std::cout &lt;&lt; "BGRA ordering: " &lt;&lt; intMat_BGRA.at&lt;cv::Vec4b&gt;(0,0) &lt;&lt; std::endl; // this is in fact the BGRA ordering but you have to remove the alpha channel to get BGR values: // (unless you can live with BGRA values =&gt; you have to check whether there is garbage or 0s/255s in the byte area // so split the channels... std::vector&lt;cv::Mat&gt; BGRA_channels; cv::split(intMat_BGRA, BGRA_channels); // remove the alpha channel: BGRA_channels.pop_back(); // and merge back to image: cv::Mat intMat_BGR; cv::merge(BGRA_channels, intMat_BGR); std::cout &lt;&lt; "BGR order…
has comment: http://stackoverflow.com/comment/43266405
type: AcceptedAnswer

http://stackoverflow.com/a/27465129
has comment: http://stackoverflow.com/comment/43367717
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43367699
answers question: http://stackoverflow.com/q/27465024
has body: Take a look at the TextWatcher class. It will allow you to intercept and manipulate user inputs as appropriate (depending on your boolean flag's value) as each character is entered. You can set a TextWatcher on an EditText using the addTextChangedListener method.
downvote count: 0
has comment: http://stackoverflow.com/comment/43367292
has comment: http://stackoverflow.com/comment/43367079
has comment: http://stackoverflow.com/comment/43367272
has comment: http://stackoverflow.com/comment/43367276
type: Answer

http://stackoverflow.com/q/27468986
favorite count: 0
has answer: http://stackoverflow.com/a/30851913
has answer: http://stackoverflow.com/a/30594064
type: UnansweredQuestion
has title: android - combine horizontal viewpager with vertical viewpager
linked to: http://stackoverflow.com/q/13477820
score: 6
upvote count: 6
has body: I want to combine a default horizontal ViewPager with some kind of a vertical ViewPager. My approach would be that the Fragments provided by the horizontal ViewPager, are subclassing the vertical ViewPager. public class SubWebViewFragment extends Fragment, VerticalViewPager { } Thus each Fragment provided by the horizontal ViewPager should at the same time act as a VerticalViewPager, building up some kind of a matrix. In addition I have to have the possibility to go to a certain page in this matrix. E.g. I want to select page 2 of the horizontal ViewPager, and of this page two I want to go to page three of the vertical ViewPager. // pseudo code HorizontalViewPager.setCurrentItem(1, true); activeHorizontalPage.getVerticalViewPager.setCurrentItem(2, true); I'm a bit lost on how to approach this issue.
tagged with: java
type: Question
tagged with: android-viewpager
linked to: http://stackoverflow.com/q/8456554
downvote count: 0
has answer: http://stackoverflow.com/a/27470070
answer count: 3
tagged with: android

http://stackoverflow.com/comment/51850890
has text: Include the relevant parts of the link into your answer to demonstrate examples of code. Currently this answer is very spammy, especially linking to a DropBox .rar... Why not use GitHub to share? Seems more legitimate.
comment on: http://stackoverflow.com/a/31971724
type: Comment
score: 1
type: AnswerComment

http://stackoverflow.com/comment/43211426
has text: Why `_`? Should be `-`.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27380689
type: AnswerComment

http://stackoverflow.com/a/27410111
answers question: http://stackoverflow.com/q/27410004
score: 1
downvote count: 0
has body: The good practice will be to use a BufferedFileReader BufferedFileReader bf = new BufferedFileReader(new FileReader(new File("your_file.your_extention"))); Then you can read lines in your file : // Initilisation of the inLine variable... String inLine = null; while((inLine = bf.readLine()) != null){ System.out.println(inLine); }
type: Answer
upvote count: 1

http://stackoverflow.com/a/42843644
has body: I recently encountered this and i resolved it by just using a relative path like this: /greeting?name=Test
answers question: http://stackoverflow.com/q/27347282
score: 0
type: Answer

http://stackoverflow.com/a/27473564
type: Answer
answers question: http://stackoverflow.com/q/27473519
score: 2
upvote count: 2
downvote count: 0
has body: You can wrap an unchecked exception with a checked exception try { // do something } catch (RuntimeException re) { throw new CheckedException("Some message", re); }

http://stackoverflow.com/a/27393019
type: Answer
has body: shiftIn.setBorder(new CompoundBorder( new TitledBorder(new EmptyBorder(0, 0, 0, 0), "Shift Key"), shiftIn.getBorder())); This is not the sort of thing that a titled border was made for! Use a JLabel and put it in the PAGE_START of a BorderLayout, put the JSpinner in the PAGE_END. Add that container (the panel) where the spinner is currently added. (Then add a mnemonic for the label and make it the 'label for' the spinner.) This is how to use that idea inside another layout (GridLayout in this example).. import java.awt.*; import javax.swing.*; import javax.swing.border.*; public class ex extends JFrame { public static void main(String[] args) { new ex(); } ex() { super("test"); // imagine this is actually using GridBagLayout JPanel ui = new JPanel(new GridLayout(0, 3,4,4)); ui.setBorder(new EmptyBorder(4, 4, 4, 4)); SpinnerModel sm = new SpinnerNumberModel(3, 1, 25, 1); JSpinner shiftIn = new JSpinner(sm); JLabel l = new JLabel("Shift Key"); JPanel p = new JPanel(new BorderLayout()); p.add(l, BorderLayout.PAGE_START); p.add(shiftIn, BorderLayout.PAGE_END); add(ui); for (int ii=0; ii&lt;9; ii++) { if (ii==4) { ui.add(p); } else { ui.add(new JButton("Button")); } } pack(); setVisible(true); } }
answers question: http://stackoverflow.com/q/27392652
accepted answer of: http://stackoverflow.com/q/27392652
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43233413
score: 4
has comment: http://stackoverflow.com/comment/43233446
has comment: http://stackoverflow.com/comment/43233504
has comment: http://stackoverflow.com/comment/43233565

http://stackoverflow.com/q/27471706
tagged with: bluetooth
has title: Pass data continuosly from class to activity
type: Question
tagged with: android
has body: I beginner in android.Goal of my project is to plot graph from continuous data received from Bluetooth which is accelerometer data consist of x,y,z values.Now I want to pass these values to another activity which will plot graph from it.I have taken Blueterm app sourcecode and extended it to extract accel x,y,z values.My question whether intent will do job or I will need to use some other method? Below is that thread class which receives data continuously: private class ConnectedThread extends Thread { private final BluetoothSocket mmSocket; private final InputStream mmInStream; private final OutputStream mmOutStream; public ConnectedThread(BluetoothSocket socket) { Log.d(TAG, "create ConnectedThread"); mmSocket = socket; InputStream tmpIn = null; OutputStream tmpOut = null; // Get the BluetoothSocket input and output streams try { tmpIn = socket.getInputStream(); tmpOut = socket.getOutputStream(); } catch (IOException e) { Log.e(TAG, "temp sockets not created", e); } mmInStream = tmpIn; mmOutStream = tmpOut; } public void run() { Log.i(TAG, "BEGIN mConnectedThread"); byte[] buffer = new byte[128]; int bytes; // Keep listening to the InputStream while connected while (true) { try { // Read from the InputStream bytes = mmInStream.read(buffer); int buflen=buffer.length; String str = new String(buffer, "UTF-8"); // prints character Log.d("Data Transmitted", str); int slen=str.length(); String sl=String.valueOf(slen); Log.d("String length",sl); int spaceIndex = str.indexOf(" "); if (spaceIndex != -1) { str = str.substring(0, spaceIndex); } // Log.d("Data Edited", str); boolean v1=str.contains("a"); boolean v2=str.contains("b"); boolean v3=str.contains("c"); boolean v4=str.contains("d"); int count1 = str.length() - str.replace("a", "").length(); int count2 = str.length() - str.replace("b", "").length(); int count3 = str.length() - str.replace("c", "").length(); int count4 = str.length() - str.replace("d", "").length(); int count5 = str.length() - str.replace("e", "").len…
answer count: 1
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27471967
type: UnansweredQuestion

http://stackoverflow.com/comment/43103414
type: QuestionComment
has text: Go to Tools -> options -> editor -> highlighting
score: 0
comment on: http://stackoverflow.com/q/27321945
type: Comment

http://stackoverflow.com/comment/43376999
type: QuestionComment
has text: @almasshaikh: Thanks for the response. I did search for the information but I couldn't get any. Guess i'm missing something out when going through the framework control flow. I'll have a look at it again.
comment on: http://stackoverflow.com/q/27470341
score: 1
type: Comment

http://stackoverflow.com/q/27465031
accepted answer: http://stackoverflow.com/a/27465093
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43366375
has comment: http://stackoverflow.com/comment/43366345
has comment: http://stackoverflow.com/comment/43366415
type: Question
has answer: http://stackoverflow.com/a/27465050
tagged with: java
has body: I learned that static methods are used to create an instance of a class type. I see that some classes using static method have to declare a private constructor for that class. What is the use of private constructor? Can we still create an instance of a class without using the private constructor? Thanks.
has comment: http://stackoverflow.com/comment/43366429
possible better answer: http://stackoverflow.com/a/27465050
has answer: http://stackoverflow.com/a/27465093
tagged with: static-methods
score: 0
answer count: 2
has title: Static Factory Method
has comment: http://stackoverflow.com/comment/43366461
has comment: http://stackoverflow.com/comment/43366647

http://stackoverflow.com/a/27442208
answers question: http://stackoverflow.com/q/27442145
score: 0
has body: Try String json = gson.toJson(testBean1, TestBean.class); or so Type myType= new TypeToken&lt;MyBean&gt;() {}.getType(); and then String json = gson.toJson(testBean1, myType);
type: Answer

http://stackoverflow.com/comment/43191719
has text: What array are you supplying as input and how are you reading that input ?
score: 0
comment on: http://stackoverflow.com/q/27369952
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27342626
has comment: http://stackoverflow.com/comment/43141471
has comment: http://stackoverflow.com/comment/43142104
has comment: http://stackoverflow.com/comment/43141949
has title: Symbol Not found using enum
has comment: http://stackoverflow.com/comment/43141495
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43141138
has comment: http://stackoverflow.com/comment/43148067
has body: I am an experienced programmer but new to Java. I have defined an enum but getting "Symbol not found" when I attempt to use it. I have looked at many answers and they all point to naming conflicts. I have renamed my enum but no luck still. After further research I found the following example on an Oracle website. (Note, I broke naming convention to ensure that "Day" did not present a naming conflict) public enum Day__ { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY } As the example suggests, I tried to use it in the following way: public class EnumTest { Day__ day; public EnumTest(Day__ day) { this.day = day; } } Yet on compile (using Intellij) I get the following: Error:(7, 5) java: cannot find symbol symbol: class Day__ location: class com.islbahamas.firstcontact.client.EnumTest Following Jon and Janos' advice (which I really appreicate), I created a whole new project (TestProject). In the path C:\Dev\TestProject\src\com\islbahamas\completelyNewPackageInNewProject I have the following two files: Day_OnlyClassDefinedWithThisName.java TestEnum.java Day_OnlyClassDefinedWithThisName.java looks like this: package com.islbahamas.completelyNewPackageInNewProject; /** * Created by Clyde on 12/7/2014. */ public enum Day_OnlyClassDefinedWithThisName { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY } and TestEnum.java looks like this: package com.islbahamas.completelyNewPackageInNewProject; /** * Created by Clyde on 12/7/2014. */ public class TestEnum { Day_OnlyClassDefinedWithThisName day; public TestEnum(Day_OnlyClassDefinedWithThisName day) { this.day = day; } } note ... same package for both Error: Error:(7, 5) java: cannot find symbol symbol: class Day_OnlyClassDefinedWithThisName location: class com.islbahamas.completelyNewPackageInNewProject.TestEnum Even with the import (albeit unnecessary) statement include (as shown below), I have the same error package com.islbahamas.completelyNewPackageInNewProject; import com.islbahamas.completel…
has answer: http://stackoverflow.com/a/27342835
tagged with: java
has comment: http://stackoverflow.com/comment/43140972
type: Question
has comment: http://stackoverflow.com/comment/43141063
tagged with: enums
has comment: http://stackoverflow.com/comment/43141068
has comment: http://stackoverflow.com/comment/43141114
score: 0
has comment: http://stackoverflow.com/comment/43141269
answer count: 1

http://stackoverflow.com/comment/43170097
comment on: http://stackoverflow.com/q/27358881
type: Comment
type: QuestionComment
has text: Looks like you're reimplementing JMS. So maybe *use* a JMS implementation instead.
score: 0

http://stackoverflow.com/q/27395929
score: 0
has comment: http://stackoverflow.com/comment/43238691
linked to: http://stackoverflow.com/q/10367698
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/43238413
has title: Corrupted files over TCP socket in Java
duplicate of: http://stackoverflow.com/q/10367698
answer count: 0
has comment: http://stackoverflow.com/comment/43238887
tagged with: tcp
has comment: http://stackoverflow.com/comment/43238484
type: Question
has comment: http://stackoverflow.com/comment/43238393
has body: I'm sending some files over multiple TCP sockets (multiple, random ports), but every file sent ends up being corrupted. We first tested this as a standalone program with just one socket, which was working fine. But now implemented in our final project all our files get corrupted. I can't open any images, mp3 files, ... Here is the file sender: public class FileSenderThread implements Runnable { // Make a serverSocket protected ServerSocket serverSocket = null; protected Socket socket = null; protected String fileName = null; protected Long fileSize = null; protected String pathName = null; protected int port = 8500; public FileSenderThread(String name, Long size, int portNumber, String path) throws IOException { // get socket connection System.out.println("Init file transfer sender"); this.port = portNumber; serverSocket = new ServerSocket(port); this.fileName = name; this.fileSize = size; this.pathName = path; } public void run() { try { socket = serverSocket.accept(); System.out.println("Accepted connection : " + socket); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } try { System.out.println("Sending " + fileName); // find the file &amp; the size File transferFile = new File(pathName + fileName); System.out.println("size:" + fileSize); DataOutputStream outsize = new DataOutputStream( socket.getOutputStream()); outsize.writeLong(transferFile.length()); // make bytearray from file byte[] bytearray = new byte[(int) transferFile.length()]; FileInputStream fin = new FileInputStream(transferFile); BufferedInputStream bin = new BufferedInputStream(fin); bin.read(bytearray, 0, bytearray.length); System.out.println(bytearray.length); // open OutputStream and write bytearray OutputStream os = socket.getOutputStream(); os.write(bytearray, 0, bytearray.length); os.flush(); fin.close(); bin.close(); socket.close(); System.out.println(fileName + " transfer complete"); } catch (IOException ex) { System.out.println(ex); } } } end here is the …
has comment: http://stackoverflow.com/comment/43239748
has comment: http://stackoverflow.com/comment/43238271
tagged with: java
has comment: http://stackoverflow.com/comment/43238749

http://stackoverflow.com/comment/130473345
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27572037
has text: Krease can we have @ClassRule inside TestResources?

http://stackoverflow.com/comment/43352816
score: 0
comment on: http://stackoverflow.com/q/27457213
has text: The problem is the same (I mean the error code) as in the case http://stackoverflow.com/questions/7302604/eclipse-error-failed-to-create-the-java-virtual-machine . And I saw a lot of memory was free. As I understand the system just hasn't 2 Gb in a one piece.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43364059
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27463951
type: QuestionComment
has text: [`Graphics#fillRect(x, y, width, height)`](https://docs.oracle.com/javase/7/docs/api/java/awt/Graphics.html#fillRect(int,%20int,%20int,%20int))...?

http://stackoverflow.com/comment/43384899
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27470291
type: AnswerComment
has text: I see what you mean, it specified to make use of collections either lists or maps however, if that's not possible in this case I'll just leave it out :/.. I tried to use a enhanced for, store the book in a string and then retry this code but that doesn't work.

http://stackoverflow.com/comment/43319088
score: 0
type: AnswerComment
type: Comment
has text: Yes I only need to query on the name property. However I'm not using JPA but JDO.
comment on: http://stackoverflow.com/a/27337001

http://stackoverflow.com/comment/43209306
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27331252
has text: http://www.beanshell.org/manual/embeddedmode.html
score: 0

http://stackoverflow.com/a/27350789
answers question: http://stackoverflow.com/q/27350638
accepted answer of: http://stackoverflow.com/q/27350638
has body: When you call charPos = FindWord.indexOf(letter, charPos + 1); you are setting charPos back to -1 in the case where the letter only occurs once, not twice. You need to get rid of this. Either use a different variable for the second position of the letter, OR write this into a loop, to allow for any number of occurrences of the letter, OR or set a boolean variable to indicate whether the letter was found; and use that to determine whether to add one to incorrect.
score: 0
type: AcceptedAnswer
type: Answer

spring
tags question: http://stackoverflow.com/q/27380905
tags question: http://stackoverflow.com/q/27417412
tags question: http://stackoverflow.com/q/27385540
tags question: http://stackoverflow.com/q/27364744
tags question: http://stackoverflow.com/q/27314243
tags question: http://stackoverflow.com/q/27467591
tags question: http://stackoverflow.com/q/27395140
tags question: http://stackoverflow.com/q/27368351
tags question: http://stackoverflow.com/q/27414645
tags question: http://stackoverflow.com/q/27318336
tags question: http://stackoverflow.com/q/27427188
tags question: http://stackoverflow.com/q/27320902
tags question: http://stackoverflow.com/q/27440369
tags question: http://stackoverflow.com/q/27381390
tags question: http://stackoverflow.com/q/27393506
tags question: http://stackoverflow.com/q/27425472
tags question: http://stackoverflow.com/q/27316011
tags question: http://stackoverflow.com/q/27368877
tags question: http://stackoverflow.com/q/27466934
tags question: http://stackoverflow.com/q/27452849
tags question: http://stackoverflow.com/q/27397911
tags question: http://stackoverflow.com/q/27390363
tags question: http://stackoverflow.com/q/27437609
tags question: http://stackoverflow.com/q/27342892
tags question: http://stackoverflow.com/q/27427890
tags question: http://stackoverflow.com/q/27329843
tags question: http://stackoverflow.com/q/27471993
tags question: http://stackoverflow.com/q/27470387
tags question: http://stackoverflow.com/q/27342424
tags question: http://stackoverflow.com/q/27325024
tags question: http://stackoverflow.com/q/27363614
tags question: http://stackoverflow.com/q/27384669
tags question: http://stackoverflow.com/q/27408211
tags question: http://stackoverflow.com/q/27468097
tags question: http://stackoverflow.com/q/27405498
tags question: http://stackoverflow.com/q/27460872
tags question: http://stackoverflow.com/q/27400125
tags question: http://stackoverflow.com/q/27350761
tags question: http://stackoverflow.com/q/27388678
tags question: http://stackoverflow.com/q/27390591
tags question: http://stackoverflow.com/q/27467585
tags question: http://stackoverflow.com/q/27325728
tags question: http://stackoverflow.com/q/27428575
tags question: http://stackoverflow.com/q/27432575
tags question: http://stackoverflow.com/q/27422560
tags question: http://stackoverflow.com/q/27413999
tags question: http://stackoverflow.com/q/27438314
tags question: http://stackoverflow.com/q/27446428
tags question: http://stackoverflow.com/q/27321766
tags question: http://stackoverflow.com/q/27406357
type: Tag
tags question: http://stackoverflow.com/q/27316105
tags question: http://stackoverflow.com/q/27431206
tags question: http://stackoverflow.com/q/27441716
tags question: http://stackoverflow.com/q/27347736
tags question: http://stackoverflow.com/q/27394310
tags question: http://stackoverflow.com/q/27382810
tags question: http://stackoverflow.com/q/27347799
tags question: http://stackoverflow.com/q/27361410
tags question: http://stackoverflow.com/q/27361651
tags question: http://stackoverflow.com/q/27332742
tags question: http://stackoverflow.com/q/27436547
tags question: http://stackoverflow.com/q/27445342
tags question: http://stackoverflow.com/q/27315177
tags question: http://stackoverflow.com/q/27370681
tags question: http://stackoverflow.com/q/27337428
tags question: http://stackoverflow.com/q/27388159
tags question: http://stackoverflow.com/q/27440169
tags question: http://stackoverflow.com/q/27328015
tags question: http://stackoverflow.com/q/27446023
tags question: http://stackoverflow.com/q/27356794
tags question: http://stackoverflow.com/q/27323104
tags question: http://stackoverflow.com/q/27324015
tags question: http://stackoverflow.com/q/27385102
tags question: http://stackoverflow.com/q/27402639
tags question: http://stackoverflow.com/q/27404813
tags question: http://stackoverflow.com/q/27316983
tags question: http://stackoverflow.com/q/27386883
tags question: http://stackoverflow.com/q/27401346
tags question: http://stackoverflow.com/q/27461971

http://stackoverflow.com/q/27405511
tagged with: outlook
tagged with: attachment
tagged with: java
type: UnansweredQuestion
has body: we use Java Mail to send E-Mails with PDF attachments via SMTP over Lotus Notes to our customers. Some time ago we got notified that serveral customers don't received an attachment. One of these customers uses Microsoft Outlook and got an attachment flag in his inbox. But when he opens the E-Mail, he doesn't see an attachment. We don't have the possibility to check the version of the E-Mail client's and to do customer side test's, because our customers are worldwide located. If our customer responds or (internal) forward the E-Mail, the attachment shown in receiver's E-Mail client. The following part is the affected Java source code: private static Multipart createMultipartMailWithAttachment(String messageText) throws MessagingException { // Message with attachments Multipart mp = new MimeMultipart(); // Attach Text MimeBodyPart mbp1 = new MimeBodyPart(); mbp1.setText(messageText, UTF8, HTML); mp.addBodyPart(mbp1); for (File f : attachments) { MimeBodyPart fileAttachment = new MimeBodyPart(); try { fileAttachment.setDisposition(MimeBodyPart.ATTACHMENT); fileAttachment.attachFile(f); if(f.getName().toLowerCase().endsWith(PDF_EXTENSION)) { fileAttachment.setHeader(CONTENT_TYPE, APPLICATION_PDF); } } catch (IOException e) { returnMessage = e.getMessage(); } mp.addBodyPart(fileAttachment); } return mp; } We already tested different webmail services like gmail.com, yahoo.com and outlook.com. In every case the attachment was shown. Also in an local installation of Mozilla Thunderbird, Microsoft Outlook or Lotus Notes was the attachment shown. After many inquiries we got many different solution processes. See setDisposition(MimeBodyPart.ATTACHMENT) and setHeader(CONTENT_TYPE, APPLICATION_PDF). None of these solutions lead us to success. Does anyone know a solution or a new solution process to solve that problem?
has answer: http://stackoverflow.com/a/27406028
tagged with: jakarta-mail
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27658192
favorite count: 0
type: Question
tagged with: http://stackoverflow.com/tag/pdf
upvote count: 2
has title: Java Mail attachment not shown in outlook
answer count: 3
has answer: http://stackoverflow.com/a/27434369

http://stackoverflow.com/comment/43137413
score: 0
type: QuestionComment
has text: There are some results here: [Should I use Java's String.format() if performance is important?](http://stackoverflow.com/questions/513600/should-i-use-javas-string-format-if-performance-is-important)
type: Comment
comment on: http://stackoverflow.com/q/27340696

http://stackoverflow.com/q/27364591
tagged with: jvm
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43181116
has title: How to deal with unknown variable names in JVM sources?
tagged with: debug-symbols
tagged with: java
has answer: http://stackoverflow.com/a/27364747
type: Question
tagged with: debugging
score: 0
answer count: 1
has body: While debugging code and when tracing inside JVM code, I often meet a situation, when variables are impossible to watch. Apparently this is because variable names were wiped out from the compiled code. What to do with it? Is there a debug version of JVM somewhere? In the following screenshot it is evident, that variable is not watched on mouse hover -- only type is displayed. Simultaneously, it is visible, that variable is identified by arg0 name in variables view in Eclipse.

http://stackoverflow.com/q/27450808
score: 4
has answer: http://stackoverflow.com/a/27452117
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has title: Modify the xml version with java
has body: What is the best way to change the version of an xml file from 1.0 to 1.1? I need to parse them using dom, but I cannot do that without setting the xml version to 1.1, because some files have some invalid characters which are not accepted using xml 1.0. I don't know how these files could be built, but anyway I got some. These Files are rather big, so I wouldn't like to load to whole file only to change the header. Can I somehow modify the InputStream of the File or replace the header of the file without loading the whole content?
tagged with: sax
upvote count: 4
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: file
tagged with: inputstream
type: Question
accepted answer: http://stackoverflow.com/a/27452117

http://stackoverflow.com/q/27340387
tagged with: jbutton
tagged with: java
type: Question
tagged with: jtextarea
has title: Accessing components of another class
tagged with: awt
has answer: http://stackoverflow.com/a/27340473
score: 0
has comment: http://stackoverflow.com/comment/43136959
answer count: 1
has comment: http://stackoverflow.com/comment/43137094
type: UnansweredQuestion
has body: Second class: @Override public void actionPerformed(ActionEvent e){ // TODO Auto-generated method stub if(e.getSource() == buy) { System.out.println("hi"); } } I want to access the JTextArea from another class and append it with "hi". so here's what will happen everytime I press the buy button the text area in the another class will append "hi" Tried solutions: Second class public void somelistener(ccp asd){ this.asd = asd; this.area = asd.getTextArea(); area.setText("hi"); } First class public JTextArea getTextArea(){ return ta; } Every time I press the button, nothing shows in the textarea.

recursion
type: Tag
tags question: http://stackoverflow.com/q/27462689
tags question: http://stackoverflow.com/q/27469201
tag name: recursion
tags question: http://stackoverflow.com/q/27454715
tags question: http://stackoverflow.com/q/27465478
tags question: http://stackoverflow.com/q/27412037
tags question: http://stackoverflow.com/q/27435575
tags question: http://stackoverflow.com/q/27322043
tags question: http://stackoverflow.com/q/27462543
tags question: http://stackoverflow.com/q/27348711
tags question: http://stackoverflow.com/q/27336026
tags question: http://stackoverflow.com/q/27324298
tags question: http://stackoverflow.com/q/27386331
tags question: http://stackoverflow.com/q/27464200
tags question: http://stackoverflow.com/q/27411089
tags question: http://stackoverflow.com/q/27332953
tags question: http://stackoverflow.com/q/27336947
tags question: http://stackoverflow.com/q/27338475

http://stackoverflow.com/comment/43233637
type: QuestionComment
comment on: http://stackoverflow.com/q/27393142
score: 0
has text: I am attempting to add the char that is at the index i, then i + n, then i + n. The letters are n away from each other in index.
type: Comment

http://stackoverflow.com/q/27344062
has comment: http://stackoverflow.com/comment/43143620
type: Question
tagged with: object
accepted answer: http://stackoverflow.com/a/27344415
has title: Create and connect locations for a game
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43143651
has comment: http://stackoverflow.com/comment/43143735
has comment: http://stackoverflow.com/comment/43143530
has answer: http://stackoverflow.com/a/27344415
has body: I want to make a text adventure game as a school project and I was wondering how it would be possible to create and connect game locations in which the story takes place. I thought of making a super class Location with variables like name and a two-dimensional array like int[][] locnow = new int[20][20]; for the location position itself (north, west, east, south point). My main questions are Is it a good way to realise something like this in this way, or is something different better? How can I load locations like "Button Click -> go east" and the location one to the east is loaded? Thank you for your help.
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43143566

http://stackoverflow.com/comment/43352555
comment on: http://stackoverflow.com/q/27457701
score: 0
type: QuestionComment
type: Comment
has text: Any non-printable/invisible characters in the String you got from the server? `String info_string = "\u0000{\"server_ip\":\"http://localhost:3000/\",\"device_id\":14}";` would demonstrate the behavior you are seeing. Otherwise it's working fine for me (until you try to cast `obj` to a `JSONArray` but that's another story).

http://stackoverflow.com/q/27399690
has body: I develop on application which contain the customize lock screen. Now my problem is there when I am on lock screen and I press home button the it take me to the my home screen because lock screen is not my home screen so I need to stop its work and my OS version is 4.2.2 so I am unable to handle the home button. Thanks in advance...
has title: Need to stop Home button in android 4.2.2
has answer: http://stackoverflow.com/a/27399776
score: -1
has comment: http://stackoverflow.com/comment/43246106
upvote count: 0
answer count: 1
tagged with: android-homebutton
tagged with: android-activity
favorite count: 0
has comment: http://stackoverflow.com/comment/43245718
type: UnansweredQuestion
tagged with: android
tagged with: android-navigation
has comment: http://stackoverflow.com/comment/43246594
tagged with: java
has comment: http://stackoverflow.com/comment/43245069
downvote count: 1
type: Question

http://stackoverflow.com/a/27463412
has comment: http://stackoverflow.com/comment/43376851
answers question: http://stackoverflow.com/q/27463048
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27463048
has body: since B is already weakly reachable at that time, shouldn't wrB already be cleared at an early time when the weak reachability of B is first detected? This happens at the same time, so there is no earlier time. When a GC starts all objects (e.g. both A and B) which are not strongly reachable at that time are eligible to be cleaned up at that time.
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43377545

http://stackoverflow.com/a/27430039
answers question: http://stackoverflow.com/q/27429992
type: Answer
has body: A local variable needs to be declared final if it's used in an inner class. For a local variable to be used in such an inner class, Java behind the scenes takes a copy of the local variable and makes it into an implicit instance variable so the inner class can access it. Because it's a copy, the copy could be wrong if the value changes. So the compiler forces you to make it final. Note that in Java 8, this would compile, because a is "effectively final" -- not declared final, but never changed once initialized. Section 8.1.3 of the JLS states: Any local variable, formal parameter, or exception parameter used but not declared in an inner class must either be declared final or be effectively final (§4.12.4), or a compile-time error occurs where the use is attempted. Section 4.12.4 of the JLS states: A local variable or a method, constructor, lambda, or exception parameter is effectively final if it is not declared final but it never occurs as the left hand operand of an assignment operator (§15.26) or as the operand of a prefix or postfix increment or decrement operator (§15.14, §15.15). In addition, a local variable whose declaration lacks an initializer is effectively final if all of the following are true: It is not declared final. Whenever it occurs as the left-hand operand of an assignment operator, it is definitely unassigned and not definitely assigned before the assignment; that is, it is definitely unassigned and not definitely assigned after the right-hand operand of the assignment (§16 (Definite Assignment)). It never occurs as the operand of a prefix or postfix increment or decrement operator.
upvote count: 4
downvote count: 0
score: 4

http://stackoverflow.com/q/27358078
answer count: 1
downvote count: 0
favorite count: 0
has body: I'm new in Hiberante and Envers. I successfully implemented Hibernate Envers in my application and made audited tables and everything works fine but I'm wondering is it possible to change values in REVTYPE column in audited tables. For now I have values 0 (ADD), 1 (MOD) and 2 (DEL). I want to know is it possible to change this values, I want to change for 0 to be for example INSERT, 1 UPDATE and 2 DELETE. Is this possible and how? Thank you!
has answer: http://stackoverflow.com/a/27399619
type: UnansweredQuestion
score: 16
upvote count: 16
has title: Can I change and how to change REVTYPE values in Hibernate Envers?
tagged with: hibernate-envers
tagged with: java
tagged with: hibernate
type: Question

http://stackoverflow.com/a/27468569
has body: It's true 'cause you're basically comparing the two thing properties.. That's equivalent to: public static void main(String[] args) { String str1 = "procedura1"; String str2 = "procedura1"; if (str1.equals(str2)) { System.out.print("Both String objects represent the same sequence of characters"); } } But if you may compare it this was: public static void main(String[] args) { Lang obj1 = new Lang(); Lang obj2 = new Lang(); if (obj1.equals(obj2)) { System.out.println("Both Lang objects are equal."); } } You won't get any message.. hope this helps ;)
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27468430

http://stackoverflow.com/comment/43199881
comment on: http://stackoverflow.com/a/27374336
type: Comment
score: 0
type: AnswerComment
has text: Thanks Jon u have also helped me on this.yup i was not iterating through the resultset properly.

http://stackoverflow.com/comment/43142520
comment on: http://stackoverflow.com/q/27343042
type: Comment
has text: possible duplicate of [What is a Null Pointer Exception, and how do I fix it?](http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it)
score: 0
type: QuestionComment

http://stackoverflow.com/a/27315379
answers question: http://stackoverflow.com/q/27315227
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43091459
downvote count: 0
has body: You have incorrect mapping on A > B: public class A{ @OneToMany(mappedBy="a", cascade = {CascadeType.ALL}, orphanRemoval = true) private List&lt;B&gt; Bs; } public class B{ @ManyToOne @JoinColumn(name = "a_id") private A a; } And as suggested in another answer, if your adding Bs to A and persisting A, then set both side of the relationship. You should encapsulate add/remove operations to enforce integrity of the model. public class A{ @OneToMany(mappedBy="a", cascade = {CascadeType.ALL}, orphanRemoval = true) private List&lt;B&gt; Bs; public List&lt;B&gt; getBs(){ return Collections.unmodificableList(Bs); } public void addB(B b){ b.setA(this); Bs.add(b); } }
type: Answer

http://stackoverflow.com/a/27341873
answers question: http://stackoverflow.com/q/27341859
type: AcceptedAnswer
downvote count: 0
upvote count: 8
type: Answer
has body: The compiler is resolving SecureRandom against the class you defined. You should change the class name to avoid the conflict with java.security.SecureRandom.
score: 8
accepted answer of: http://stackoverflow.com/q/27341859

http://stackoverflow.com/a/27432988
has body: Make sure its in desktop -> assets. Make sure the file is named correctly (no spaces or anything like that). Assuming you set up libgdx correctly, it should work since it will look in that assets folder.
answers question: http://stackoverflow.com/q/27432453
type: Answer
score: 0
has comment: http://stackoverflow.com/comment/43307112

http://stackoverflow.com/comment/43123974
comment on: http://stackoverflow.com/q/27331522
has text: Posted there too: http://programmers.stackexchange.com/questions/264743/improve-the-speed-of-a-tomcat-server-with-mysql Must I delete this question?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27430029
type: Question
has answer: http://stackoverflow.com/a/27432675
tagged with: bytebuffer
favorite count: 0
score: 0
tagged with: filechannel
has title: Reading certain number of bytes into ByteBuffer
has comment: http://stackoverflow.com/comment/43301574
answer count: 1
has body: I have a binary file of 10MB. I need to read it in chunks of different size (e.g 300, 273 bytes). For reading I use FileChannel and ByteBuffer. Right now for each iteration of reading I allocate new ByteBuffer of size, that I need to read. Is there possible to allocate only once (lets say 200 KB) for ByteBuffer and read into it (300 , 273 bytes etc. )? I will not read more than 200KB at once. The entire file must be read. UPD public void readFile (FileChannel fc, int amountOfBytesToRead) { ByteBuffer bb= ByteBuffer.allocate(amountOfBytesToRead); fc.read(bb); bb.flip(); // do something with bytes bb = null; } I can not read whole file at once due to memory constraints. That's why I performing reading in chunks. Efficiency is also very important (that is why I don't want to use my current approach with multiple allocations). Thanks
has comment: http://stackoverflow.com/comment/43301634
accepted answer: http://stackoverflow.com/a/27432675
has comment: http://stackoverflow.com/comment/43301267
upvote count: 1
has comment: http://stackoverflow.com/comment/43301595
downvote count: 1
type: AnsweredQuestion
tagged with: java
tagged with: nio
has comment: http://stackoverflow.com/comment/43301264

http://stackoverflow.com/comment/43308657
has text: Thanks for the update. Declaring the variables as class variables as you suggest works better overall. I can get the code to compile but the application shuts down when the user clicks on the desired RadioButton on the device. Errors are reported when I try to nest? the onRadioButtonClicked(View v) {....} method within the add(){...} method. Perhaps I need to experiment around with the code more!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27365714

http://stackoverflow.com/comment/76118099
type: Comment
has text: http://sourceforge.net/projects/launch4j/files/launch4j-3/3.1.0-beta2/ use this link lanuch4j download
type: AnswerComment
comment on: http://stackoverflow.com/a/44564485
score: 0

http://stackoverflow.com/a/27344065
score: 2
has body: You can use split to get substrings directly: String[] substrings = str.split(","); Is this what you want as an output: (shown below)? ["LOAN", "NEFT", "TRAN"] // Array as an output Or to just get the count of the splitting char, you can use the same line as above with this: int count = substrings.length - 1;
downvote count: 0
answers question: http://stackoverflow.com/q/27344015
upvote count: 2
type: Answer

http://stackoverflow.com/q/27369549
tagged with: java
type: Question
has title: Display link PDF in Liferay portlet
tagged with: jsp
linked to: http://stackoverflow.com/q/4321979
answer count: 1
linked to: http://stackoverflow.com/q/1776142
linked to: http://stackoverflow.com/q/4746113
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27412415
tagged with: liferay-6
has body: Objective: open PDF link outside local network within Liferay Portlet. I can display PDF within portlet using window.open. PDF is downloaded from internal DB server and displayed outside network. Passing link from one JSP (that uses serveResourse to get link from DB and display it in the portlet) to another JSP "showPDF.jsp". The code works upon until ServletOutputStream pdfout = response.getOutputStream(); where it generates errors. Why do I have these errors? &lt;%@ page import="java.util.*,java.net.*,java.io.*" %&gt; &lt;%@ page import="org.apache.commons.httpclient.*" %&gt; &lt;%@ page import="org.apache.commons.codec.binary.Base64" %&gt; &lt;%@ page import="org.apache.commons.httpclient.methods.*" %&gt; &lt;%@ page import="org.apache.commons.httpclient.params.HttpMethodParams" %&gt; &lt;%@ page import="org.apache.commons.httpclient.util.URIUtil" %&gt; &lt;%@ page import="javax.servlet.http.HttpServletResponseWrapper" %&gt; &lt;%@ page import= "com.liferay.portal.kernel.util.ParamUtil"%&gt; &lt;%@ page import="javax.portlet.PortletPreferences"%&gt; &lt;%@ taglib uri="http://java.sun.com/portlet" prefix="portlet" %&gt; &lt;script type="text/javascript"&gt; alert("showPDF"); &lt;/script&gt; &lt;% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; String queryString=ParamUtil.getString(request,"urlPDF"); String urlPDF=queryString.substring(0, queryString.indexOf("?")); String queryPDF[]=queryString.substring(queryString.indexOf("?"),queryString.length()).split("&amp;"); HttpClient m_httpClient = new HttpClient(); GetMethod getMethod = new GetMethod(urlPDF); getMethod.getParams().setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(3,false)); NameValuePair[] params=new NameValuePair[queryPDF.length]; for(int i=0;i&lt;queryPDF.length;i++) { NameValuePair param=new NameValuePair(queryPDF[i].split("=")[0],queryPDF[i].split("=")[1]); params[i]=param; …
score: 0

http://stackoverflow.com/comment/43334026
type: AnswerComment
score: 0
has text: @nhahtdh Nice, didn't know about that. I'd rather keep it for consistency, though.
type: Comment
comment on: http://stackoverflow.com/a/27443345

http://stackoverflow.com/q/27364901
has answer: http://stackoverflow.com/a/27364992
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27371602
possible better answer: http://stackoverflow.com/a/27364992
score: 0
tagged with: http://stackoverflow.com/tag/xml
accepted answer: http://stackoverflow.com/a/27371602
tagged with: xsd
type: AnsweredQuestion
has body: I am trying to validate that an xml document adheres to an xsd specification using Java. Here is my java code: SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema"); File schemaLocation = new File("XX_ASN.xsd"); Schema schema = factory.newSchema(schemaLocation); //**Error occurs here** Validator validator = schema.newValidator(); String xmlFile="file://18828324.txt"; Source source = new StreamSource(xmlFile); // 5. Check the document try { validator.validate(source); System.out.println(args[0] + " is valid."); } catch (SAXException ex) { System.out.println(args[0] + " is not valid because "); System.out.println(ex.getMessage()); } Here is the error i am getting org.xml.sax.SAXParseException; systemId: file:/C:/workspace4.3/MMSV/XX_ASN.xsd; lineNumber: 14; columnNumber: 19; s4s-elt-must-match.1: The content of 'XXLocalDeliveryAsnPost' must match (annotation?, (simpleType | complexType)?, (unique | key | keyref)*)). A problem was found starting at: complexType. And here is my xsd file: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"&gt; &lt;xs:element name="XXLocalDeliveryAsnPost"&gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;Post ASN data to XX Local Delivery&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="VendorId" type="xs:string"&gt; &lt;!-- Name of Vendor provided by XX --&gt; &lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;xs:complexType&gt; &lt;xs:sequence minOccurs="1" maxOccurs="unbounded"&gt; &lt;xs:element name="AsnData"&gt; &lt;xs:annotation&gt; &lt;xs:documentation&gt;ASN for each truck&lt;/xs:documentation&gt; &lt;/xs:annotation&gt; &lt;xs:complexType&gt; &lt;xs:element name="ShipOrigin" type="xs:string"/&gt; &lt;xs:element name="Scac" type="xs:string"&gt; &lt;!-- Will store upto 4 characters --&gt; &lt;/xs:element&g…
tagged with: java
has title: Error parsing XSD document

http://stackoverflow.com/comment/43363220
type: Comment
type: QuestionComment
score: 2
has text: Do you need to cast? Can't you just use `List<? extends Convertible>` as type of the variable storing the return value.
comment on: http://stackoverflow.com/q/27463477

http://stackoverflow.com/q/27384970
favorite count: 0
has title: Java object and random numbers
has answer: http://stackoverflow.com/a/27385031
score: -1
type: AnsweredQuestion
downvote count: 2
upvote count: 1
tagged with: methods
has body: If I call this : math a = new math (); for (x=0; ×&lt;5;x++){ a.addition (); } In main class^ import java.util.*; public class math { Scanner scan = new Scanner(System.in); Random rand = new Random(); private int num1 = rand.nextInt(100); private int num2 = rand.nextInt(100); private int correctanswers = 0; public void addition(){ System.out.println(num1 + " + " + num2 + " = "); int answer = scan.nextInt(); if (answer == (num1 + num2)){ correctanswers++; } } public int getcorrectanswers(){ return correctanswers; } } What I get is the same numbers each time it goes around the 'for' loop (5 times) what I want to know is how do I get those numbers to be different each time it goes over the 'for' loop when a.addition() gets called So for example: it will print 5+7 each time rather than doing 2 different numbers each time obviously what I want is 5+2 then 4+50 etc.
type: Question
tagged with: object
tagged with: java
accepted answer: http://stackoverflow.com/a/27385031
has answer: http://stackoverflow.com/a/27385084
tagged with: class
tagged with: random
answer count: 2
possible better answer: http://stackoverflow.com/a/27385084

http://stackoverflow.com/comment/43148838
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27346888
type: Comment
has text: @DavidWallace But when I run it, the loop only reads doctors, doesn't read any of the surgeons.

http://stackoverflow.com/q/27392600
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27392741
score: 0
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27392741
has body: String[] urls contains urls as strings. The inputstream is working fine. This problem has to do with threading. There should be the same number of threads as elements in String[] urls and each thread should deal with one element in String[] urls while all running concurrently without data race. That seems to all work here except for the each thread dealing with one String[] urls element part. However, as it's easier to explain with an example. Let's say String[] urls contains two urls. In that case, I get twice as many inputstream as I want. Something that should have "Cat Dog Fish" instead gets "Cat Cat Dog Dog Fish Fish". When String[] urls contains only one element it works fine but not when more than that. I did try removing the for loop in the run() method (as it should only be happening once per thread), and changing the URL url=new URL(urls[i]) to URL url=new URL(urls[t]) but I then get an error saying "Local variable t defined in an enclosing scope must be final or effectively final" and I do not want t to be final as it is changing depending on the index. public void readData(String[] urls) { Thread[] arrThr=new Thread[urls.length]; for (int t=0; t&lt;arrThr.length; t++) { arrThr[t]=new Thread(new Runnable() { public void run() { for (int i=0; i&lt;urls.length; i++) { String str=""; try { URL url=new URL(urls[i]); URLConnection c=url.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(c.getInputStream())); String line; while (( line = in.readLine())!=null) if (line.contains("&lt;br&gt;")) str += line; } catch (Exception e) { e.printStackTrace(); } //synchronized method calling here } } }); } for (int p=0; p&lt;arrThr.length; p++) arrThr[p].start(); for (int q=0; q&lt;arrThr.length; q++) try { arrThr[q].join(); } catch (InterruptedException e) { e.printStackTrace(); } }
answer count: 1
has title: output of threads happening more than as wanted (not data race)
tagged with: synchronization
tagged with: multithreading

http://stackoverflow.com/comment/43355992
has text: @jabal Yes that is correct. The ResponseBody annotation tells Spring to write the return value of your method in the response rather than to resolve it to a view. I recommend to take a look at this article http://www.javacodegeeks.com/2013/07/spring-mvc-requestbody-and-responsebody-demystified.html or Spring documentation for further details. There is more logic behind this. For example when you use ResponseBody the return value is converted by Spring for instance to JSON or XML using HttpMessageConverters and so on ...
type: AnswerComment
score: 4
comment on: http://stackoverflow.com/a/27453053
type: Comment

http://stackoverflow.com/a/27361457
has comment: http://stackoverflow.com/comment/43175338
has comment: http://stackoverflow.com/comment/43176545
has comment: http://stackoverflow.com/comment/43177561
has comment: http://stackoverflow.com/comment/43175647
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43177774
has comment: http://stackoverflow.com/comment/43176467
has comment: http://stackoverflow.com/comment/43177039
has comment: http://stackoverflow.com/comment/43175237
has comment: http://stackoverflow.com/comment/43177421
score: 0
has comment: http://stackoverflow.com/comment/43177145
has comment: http://stackoverflow.com/comment/43177923
has comment: http://stackoverflow.com/comment/43191188
type: Answer
has comment: http://stackoverflow.com/comment/43176423
has body: Add a setMen(int numberOfMen) method to your Regiment class. Then in your addMen() method, you can do something like this: public void addMen(){ for(Regiment r : list){ //iterate through the list of regiments r.setMen(r.getMen() + 100); //add 100 men to each regiment } } The setMen method would look like this: public void setMen(int numberOfMen){ men = numberOfMen; } There is another issue with your toString method, where the regiment's addMen2 method is called - right now you're just printing the number, not initializing the number of men. In the constructor for your Regiment class, replace the line this.men = men; with this.men = addMen2(regNumber); Then in your toString method, replace int men = regim.addMen2(regNumber); with int men = regim.getMen(); Here is what your main should look like: public static void main(String[] args) throws IOException{ ArmyDataList army = new ArmyDataList(); Scanner fileScan = new Scanner(new File("regiments.txt")); System.out.println("Report Summary:\n"); while (fileScan.hasNext()) { String line = fileScan.nextLine(); System.out.println(line); Scanner in = new Scanner(line); int regNumber = in.nextInt(); String name = in.next(); int men = 0 ; //men is set to 0 only because I havent add the men yet Regiment adder = new Regiment(regNumber, name, men ); army.AddToList(adder); } System.out.println(army.toString()); //print out the initial # of men for(int i = 0; i &lt; 20; i++) army.addMen(); System.out.println(army.toString()); //print the final # of men }
has comment: http://stackoverflow.com/comment/43177106
has comment: http://stackoverflow.com/comment/43175432
has comment: http://stackoverflow.com/comment/43175810
accepted answer of: http://stackoverflow.com/q/27361247
has comment: http://stackoverflow.com/comment/43177857
answers question: http://stackoverflow.com/q/27361247
has comment: http://stackoverflow.com/comment/43175480
has comment: http://stackoverflow.com/comment/43175354
has comment: http://stackoverflow.com/comment/43177713

http://stackoverflow.com/a/27381142
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27357702
has comment: http://stackoverflow.com/comment/43212341
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/43211366
has body: I suggest you to use a Quadtree. This way you can keep track of your occupied cells and at the same time, you can easily find unoccupied regions. Most of the operations on the quadtree are O(log n) in the size of the matrix.
answers question: http://stackoverflow.com/q/27357702
type: AcceptedAnswer

http://stackoverflow.com/q/27429484
type: UnansweredQuestion
score: 1
favorite count: 0
type: Question
has title: Spring Boot any way to define a JTA resource?
upvote count: 1
answer count: 1
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/27440611
tagged with: spring-boot
has body: Is there a simple way to expose a resource as JNDI resource so that it satisfies the JTA data source reference in persistence.xml (already there, have to reuse it for some reasons)? If not in Spring Boot, can we do it using Java EE, like using an @Resource annotation?
tagged with: jndi
tagged with: java
downvote count: 0

http://stackoverflow.com/a/27334502
score: 0
has comment: http://stackoverflow.com/comment/43126189
answers question: http://stackoverflow.com/q/27334410
type: Answer
has body: If executeUpdate() returns &lt;= 0 then nothing changed in the database, therefore there's no need to rollback the transaction. Also, if a problem occurred while inserting the entry (eg. a constraint violation, etc) then the executeUpdate() throws a SQLException. I would change you code to: try { connection.setAutoCommit(false); PreparedStatement ps1 = ... ... ps1.executeUpdate(); for (ReservationDetails resdet : resdetlist) { PreparedStatement ps2 = ... ... ps2.executeUpdate(); } connection.commit(); } catch (SQLException e) { connection.rollback(); } Also, don't forget to call close() on the PreparedStatements after you use them, and on the connection object at the end of the method.
has comment: http://stackoverflow.com/comment/43127020
has comment: http://stackoverflow.com/comment/43126154

http://stackoverflow.com/a/37168256
answers question: http://stackoverflow.com/q/27351698
score: 14
downvote count: 0
has body: Jackson processes @JsonTypeInfo before choosing which Deserializer to use, probably because the choice of Deserializer could depend generally on the type. However, you can easily disable this on a per-field basis the same way you specify custom Deserializer - by annotating the field directly: @JsonDeserialize(using = DefinitionDeserializer.class) @JsonTypeInfo(use = JsonTypeInfo.Id.NONE) private Definition definition;
type: Answer
upvote count: 14

http://stackoverflow.com/q/27452818
has title: Programming in NetBeans at school and home with different Java JDK versions
has answer: http://stackoverflow.com/a/27452876
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: netbeans
has body: So basically, at school our machines have an older version of the Java JDK installed, and I want to work on a netbeans project on home. I have it set up through the github and wanted to know if switching between JDK versions will mess up my project at all, if the older version will allow me to even open the newer version. And, if I can't, was curious on how to open a project in an older version of the JDK. Thanks!
tagged with: java
type: Question
tagged with: versions

http://stackoverflow.com/a/27458241
score: 2
answers question: http://stackoverflow.com/q/27419022
type: AcceptedAnswer
downvote count: 0
has body: You try to load the main class with your JarInJarClassLoaderwhich is an UrlClassloader but your classpath is not inside the array of URLs which you pass to your loader. That is the reason that all jars could be loaded, but not your main class,if the main class is not inside the jar . Your Init class could be loaded, because it is loaded by the current threads class loader or its parents. So you have two choices Add your classfolder to the URL array URL[] urls = new URL[jarFiles.size() + 1]; int idx = 0; for(String jarFile : jarFiles) { urls[idx++] = new URL(JarInJarConstants.INTERNAL_URL_PROTOCOL_WITH_COLON + jarDirectoryName + JarInJarConstants.PATH_SEPARATOR + jarFile); } urls[urls.length-1] = new URL("file:///C:/Users/TapasB/&lt;INSERT CORRECT PATH&gt;/com/"); Or use another classloader for loading the main class e.g the one used to load the Init class Class&lt;?&gt; clazz = Class.forName(launcherClassName, true, Init.class.getClassLoader());
has comment: http://stackoverflow.com/comment/43369400
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27419022
type: Answer

http://stackoverflow.com/a/27363433
has body: You have the following variables: SortedSetADTx&lt;Automobilis&gt; autoSet; BstSetKTUx&lt;Automobilis&gt; autoSetBst; Note that autoSet is of type SortedSetADTx but not BstSetKTUx. However, autoSetBst is of type BstSetKTUx, and also of type SortedSetADTx, since BstSetKTUx implements SortedSetADTx. Therefore, you can't assign autoSet to autoSetBst, but you can do it the other way round: autoSetBst = new BstSetKTUx(new Automobilis()); autoSet = autoSetBst;
type: Answer
answers question: http://stackoverflow.com/q/27363255
score: 0

http://stackoverflow.com/comment/43277226
type: Comment
has text: My requirement is to create a proxy socket server which route client requests for available threads and send response back to the client.this was the approch i took to test if the proxy server recieved multiple hits from the client .what do you think
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27415197

http://stackoverflow.com/q/27334683
score: 0
has comment: http://stackoverflow.com/comment/43126467
has body: I'm trying to compile my HelloApp2 file using TextPad, but it references another class in a different file in the greeter class. I keep getting errors that say that Greeter is not recognized. DOes anybody know how to do this in TextPad? HelloApp2.java: public class HelloApp2 { public static void main(String[] args) { Greeter myGreeterObject = new Greeter(); myGreeterObject.sayHello(); } } Greeter.java: public class Greeter { public void sayHello() { System.out.println("Hello, World!"); } }
has comment: http://stackoverflow.com/comment/43126511
accepted answer: http://stackoverflow.com/a/27334835
has title: Compiling multiple files in Java using TextPad
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27334760
has answer: http://stackoverflow.com/a/27334760
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27334835
has comment: http://stackoverflow.com/comment/43126488
tagged with: compilation

http://stackoverflow.com/a/27424915
answers question: http://stackoverflow.com/q/27424855
type: Answer
downvote count: 0
score: 1
has body: A class is not checked, you are talking about exceptions here. An exception is whether compile-time checked or unchecked. A checked exception must be caught or declared in the signature of the method where it may be thrown. An unchecked exception does not require any particular treatment.
upvote count: 1

http://stackoverflow.com/q/27385781
tagged with: java
tagged with: selenium
type: Question
has answer: http://stackoverflow.com/a/27655397
has title: How to upload a file using selinium web driver?
tagged with: firefox
possible better answer: http://stackoverflow.com/a/27385850
score: 0
answer count: 3
has body: I'm trying to upload a file using selenium web driver. Browsing file working fine. But when upload a file to that localhost site I'got confuse. There is a upload button. Code is following way. &lt;input type="submit" value="Upload" &gt; &lt;/input&gt; I tried to use following both code. driver.findElement(By.name("UNSET FILE NAME")).sendKeys("C:\\Users\\user\\Desktop\\Ontology.owl"); driver.findElement(By.name("Upload")).click(); driver.findElement(By.id("Upload")).click(); Both are not worked for me. Error message given as mentioning not that name or id. What should I have to change above code?
has answer: http://stackoverflow.com/a/27385850
has answer: http://stackoverflow.com/a/27386279
accepted answer: http://stackoverflow.com/a/27386279
tagged with: selenium-webdriver
type: AnsweredQuestion

http://stackoverflow.com/comment/43212769
score: 0
comment on: http://stackoverflow.com/q/27379482
type: Comment
type: QuestionComment
has text: Maybe: JPQLQuery query = new JPAQuery(getEntityManager()).from(); query = addWhereClause ? query.where(address.company.isNotNull()) : query;

http://stackoverflow.com/q/27440875
downvote count: 0
favorite count: 0
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/38469376
tagged with: amazon-cognito
upvote count: 2
tagged with: java
has title: Amazon Cognito log users in with username and password
accepted answer: http://stackoverflow.com/a/38469376
tagged with: ios
has body: Is this possible with AWS Cognito? Also i would like to add a "relationship" between users and entities in DynamoDB. Anyone been in this scenario - or am i using the wrong services from AWS?
tagged with: amazon-web-services
possible better answer: http://stackoverflow.com/a/43623429
has answer: http://stackoverflow.com/a/43623429
type: AnsweredQuestion
score: 2

http://stackoverflow.com/comment/43334561
comment on: http://stackoverflow.com/q/27447668
score: 0
type: Comment
has text: possible duplicate of [Android file uploader with server-side php](http://stackoverflow.com/questions/3204476/android-file-uploader-with-server-side-php)
type: QuestionComment

http://stackoverflow.com/comment/43299930
has text: @YoungDeezie I have edited the answer to include further details.
comment on: http://stackoverflow.com/a/27429187
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43236989
has text: swt, swing, awt? What graphical library are you using?
score: 0
comment on: http://stackoverflow.com/q/27395119
type: Comment
type: QuestionComment

nullpointerexception
tags question: http://stackoverflow.com/q/27411313
tags question: http://stackoverflow.com/q/27465014
tags question: http://stackoverflow.com/q/27347695
tags question: http://stackoverflow.com/q/27338487
tags question: http://stackoverflow.com/q/27346126
tags question: http://stackoverflow.com/q/27441459
tags question: http://stackoverflow.com/q/27328754
tags question: http://stackoverflow.com/q/27391390
tags question: http://stackoverflow.com/q/27388686
tags question: http://stackoverflow.com/q/27339234
tags question: http://stackoverflow.com/q/27474480
tags question: http://stackoverflow.com/q/27424081
tags question: http://stackoverflow.com/q/27474634
tags question: http://stackoverflow.com/q/27376750
tags question: http://stackoverflow.com/q/27405543
tags question: http://stackoverflow.com/q/27351797
type: Tag
tag name: nullpointerexception
tags question: http://stackoverflow.com/q/27361526
tags question: http://stackoverflow.com/q/27420945
tags question: http://stackoverflow.com/q/27408974
tags question: http://stackoverflow.com/q/27392982
tags question: http://stackoverflow.com/q/27434229
tags question: http://stackoverflow.com/q/27345705
tags question: http://stackoverflow.com/q/27465957
tags question: http://stackoverflow.com/q/27433177
tags question: http://stackoverflow.com/q/27452817
tags question: http://stackoverflow.com/q/27339096
tags question: http://stackoverflow.com/q/27467251
tags question: http://stackoverflow.com/q/27357910
tags question: http://stackoverflow.com/q/27385916
tags question: http://stackoverflow.com/q/27331289
tags question: http://stackoverflow.com/q/27360272
tags question: http://stackoverflow.com/q/27319366
tags question: http://stackoverflow.com/q/27392832
tags question: http://stackoverflow.com/q/27415434
tags question: http://stackoverflow.com/q/27418899
tags question: http://stackoverflow.com/q/27447520
tags question: http://stackoverflow.com/q/27331979
tags question: http://stackoverflow.com/q/27413029
tags question: http://stackoverflow.com/q/27472822
tags question: http://stackoverflow.com/q/27367989
tags question: http://stackoverflow.com/q/27320961
tags question: http://stackoverflow.com/q/27461783
tags question: http://stackoverflow.com/q/27461923
tags question: http://stackoverflow.com/q/27451595
tags question: http://stackoverflow.com/q/27456775
tags question: http://stackoverflow.com/q/27379892

http://stackoverflow.com/q/27464835
answer count: 2
has answer: http://stackoverflow.com/a/27464985
has comment: http://stackoverflow.com/comment/43371350
has answer: http://stackoverflow.com/a/27468052
favorite count: 0
has comment: http://stackoverflow.com/comment/43366138
possible better answer: http://stackoverflow.com/a/27464985
accepted answer: http://stackoverflow.com/a/27468052
tagged with: c++
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/43367885
tagged with: android-ndk
type: Question
tagged with: logcat
has title: Android ndk log unicode (wide characters)
downvote count: 0
has body: I am trying to write to logcat unicode characters (UTF16; wide characters like Japanese, Korean or Chinese). The only success is a work around which is to send it to Java as a string (for example the code below): unsigned short* text = new unsigned short[100]; // or jchar* .... // all some unicode to the array jstring jtext = jniEnv-&gt;NewString(text, (jsize)length); jniEnv-&gt;CallVoidMethod( JavaClass, JavaPrintUnicode, jtext ); ... // Clean up // Then java prints it out However if the bytes are in a char array, __android_log_print will print garbled text. Is there a method to print out the text within the NDK (C++) side?
tagged with: unicode

http://stackoverflow.com/comment/43357262
has text: Please add more information. Make a small yet complete example of your `Rectangle` class (if you have one), and how you are randomly generating rectangles. Also, specify what you have tried.
type: Comment
comment on: http://stackoverflow.com/q/27460411
score: 0
type: QuestionComment

http://stackoverflow.com/q/27332979
score: 0
has answer: http://stackoverflow.com/a/27410662
possible better answer: http://stackoverflow.com/a/42933299
has answer: http://stackoverflow.com/a/42933299
has body: I like to run the equvilant of mongodb shell script from java Mongo shell script is : db.users.insert( { _id: getNextSequence("userid"), name: "Sarah C." } ) I've tried something like this in java, which did not work . BasicDBObject krUserRecord = new BasicDBObject("_id", getNextSequence("userid")) .append("name", "Sarah C"); Can anyone help ?
type: AnsweredQuestion
tagged with: call
accepted answer: http://stackoverflow.com/a/27410662
tagged with: java
has title: Calling server js function on mongodb from java
type: Question
tagged with: mongodb
answer count: 2
has comment: http://stackoverflow.com/comment/43124000
tagged with: function

http://stackoverflow.com/comment/43143950
has text: @SteveWaldman I've update my question, I pasted the wrong config sorry about that
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27338670
score: 0

jsp
tags question: http://stackoverflow.com/q/27339620
tags question: http://stackoverflow.com/q/27322818
tags question: http://stackoverflow.com/q/27349716
tags question: http://stackoverflow.com/q/27324092
tags question: http://stackoverflow.com/q/27472292
tags question: http://stackoverflow.com/q/27344766
tags question: http://stackoverflow.com/q/27356505
tags question: http://stackoverflow.com/q/27388045
tags question: http://stackoverflow.com/q/27466194
tags question: http://stackoverflow.com/q/27344005
tags question: http://stackoverflow.com/q/27392174
tags question: http://stackoverflow.com/q/27349530
tags question: http://stackoverflow.com/q/27399612
tags question: http://stackoverflow.com/q/27369840
tags question: http://stackoverflow.com/q/27445101
tags question: http://stackoverflow.com/q/27410847
tags question: http://stackoverflow.com/q/27334637
tags question: http://stackoverflow.com/q/27340938
tags question: http://stackoverflow.com/q/27318070
tags question: http://stackoverflow.com/q/27416699
tags question: http://stackoverflow.com/q/27456479
tags question: http://stackoverflow.com/q/27366445
tags question: http://stackoverflow.com/q/27376342
tags question: http://stackoverflow.com/q/27379404
tags question: http://stackoverflow.com/q/27397326
tags question: http://stackoverflow.com/q/27365960
tags question: http://stackoverflow.com/q/27390089
tags question: http://stackoverflow.com/q/27339078
tags question: http://stackoverflow.com/q/27408906
tags question: http://stackoverflow.com/q/27452012
tags question: http://stackoverflow.com/q/27395598
tags question: http://stackoverflow.com/q/27369146
tags question: http://stackoverflow.com/q/27460556
tags question: http://stackoverflow.com/q/27472833
tags question: http://stackoverflow.com/q/27471665
tags question: http://stackoverflow.com/q/27344863
tags question: http://stackoverflow.com/q/27398849
tags question: http://stackoverflow.com/q/27339933
tags question: http://stackoverflow.com/q/27376681
tags question: http://stackoverflow.com/q/27432344
tags question: http://stackoverflow.com/q/27413794
tags question: http://stackoverflow.com/q/27426315
tags question: http://stackoverflow.com/q/27457810
tags question: http://stackoverflow.com/q/27430447
type: Tag
tags question: http://stackoverflow.com/q/27319357
tags question: http://stackoverflow.com/q/27439463
tags question: http://stackoverflow.com/q/27433844
tags question: http://stackoverflow.com/q/27457663
tags question: http://stackoverflow.com/q/27427981
tags question: http://stackoverflow.com/q/27463092
tags question: http://stackoverflow.com/q/27353001
tags question: http://stackoverflow.com/q/27356508
tags question: http://stackoverflow.com/q/27473673
tags question: http://stackoverflow.com/q/27335512
tags question: http://stackoverflow.com/q/27405463
tags question: http://stackoverflow.com/q/27344868
tags question: http://stackoverflow.com/q/27369549
tags question: http://stackoverflow.com/q/27452344
tags question: http://stackoverflow.com/q/27408125
tags question: http://stackoverflow.com/q/27318367
tags question: http://stackoverflow.com/q/27344504
tag name: jsp
tags question: http://stackoverflow.com/q/27377412
tags question: http://stackoverflow.com/q/27471118
tags question: http://stackoverflow.com/q/27379691
tags question: http://stackoverflow.com/q/27334574
tags question: http://stackoverflow.com/q/27395493
tags question: http://stackoverflow.com/q/27447430
tags question: http://stackoverflow.com/q/27314243
tags question: http://stackoverflow.com/q/27467591
tags question: http://stackoverflow.com/q/27326681
tags question: http://stackoverflow.com/q/27385479
tags question: http://stackoverflow.com/q/27358287
tags question: http://stackoverflow.com/q/27318336
tags question: http://stackoverflow.com/q/27320902
tags question: http://stackoverflow.com/q/27398768
tags question: http://stackoverflow.com/q/27471900
tags question: http://stackoverflow.com/q/27436013
tags question: http://stackoverflow.com/q/27438291

http://stackoverflow.com/q/27323481
favorite count: 0
has answer: http://stackoverflow.com/a/27323881
accepted answer: http://stackoverflow.com/a/27323881
has comment: http://stackoverflow.com/comment/43106854
tagged with: google-chrome
has body: Just a quick question. Part of a program I'm building with Java opens up Chrome. I was wondering if after the program opened Chrome, there would be a way to search a specific URL or just regular keywords (example: recipes, images, or to just Google a question.)
type: Question
type: AnsweredQuestion
tagged with: java
downvote count: 4
linked to: http://stackoverflow.com/q/5226212
upvote count: 0
answer count: 1
has title: URL search through java program
score: -4

http://stackoverflow.com/q/27448990
has comment: http://stackoverflow.com/comment/43336744
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27449893
has comment: http://stackoverflow.com/comment/43338835
has comment: http://stackoverflow.com/comment/43336761
has comment: http://stackoverflow.com/comment/43336733
tagged with: java
has comment: http://stackoverflow.com/comment/43338109
has comment: http://stackoverflow.com/comment/43338025
tagged with: eclipse
downvote count: 1
has comment: http://stackoverflow.com/comment/43336814
type: Question
score: 5
answer count: 1
has title: Strange quote characters around static java String (on android?)
accepted answer: http://stackoverflow.com/a/27449893
has body: I have a String constant defined in a class: public static final String ABC = "abc"; And I want to compare, if another String is equal: String test = "abc"; if (test.equals(OtherClass.ABC)) { doSomething(); } This test strangely fails and when I inspect the variables with eclipse, I see that ABC is 2 characters longer than test, and that it looks like this: ABC: "abc" test: abc Where do those quotes come from and how do I get rid of them?
tagged with: android
has comment: http://stackoverflow.com/comment/43338414
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/43336816
has comment: http://stackoverflow.com/comment/43337902
upvote count: 6

http://stackoverflow.com/a/32559152
has body: For CQ5.5 there is no log4j.xml. All the CRX logger needs to configured using sling config. We can use Apache Sling Logging Logger Configuration (https://docs.adobe.com/docs/en/aem/6-0/deploy/configuring/monitoring-and-maintaining.html#Create%20a%20Custom%20Log%20File) or LogBack (http://sling.apache.org/documentation/development/logging.html#logback-integration)
upvote count: 1
answers question: http://stackoverflow.com/q/27446236
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/a/27379634
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27378527
upvote count: 2
has body: Let's ask the documentation: You might wonder what happens when a static synchronized method is invoked, since a static method is associated with a class, not an object. In this case, the thread acquires the intrinsic lock for the Class object associated with the class. Thus access to class's static fields is controlled by a lock that's distinct from the lock for any instance of the class. So: public static YourObject getInstance() { synchronized (YourObject.class) { /* body */ } } is equivalent to you code

http://stackoverflow.com/q/27456249
has comment: http://stackoverflow.com/comment/43371204
has comment: http://stackoverflow.com/comment/43350779
tagged with: data-structures
score: 0
answer count: 2
has title: How to improve the complexity of HashMap iteration?
has body: I implemented a custom HashMap class (in C++, but shouldn't matter). The implementation is simple - A large array holds pointers to Items. Each item contains the key - value pair, and a pointer to an Item (to form a linked list in case of key collision). I also implemented an iterator for it. My implementation of incrementing/decrementing the iterator is not very efficient. From the present position, the iterator scans the array of hashes for the next non-null entry. This is very inefficient, when the map is sparsely populated (which it would be for my use case). Can anyone suggest a faster implementation, without affecting the complexity of other operations like insert and find? My primary use case is find, secondary is insert. Iteration is not even needed, I just want to know this for the sake of learning. PS: Why I implemented a custom class? Because I need to find strings with some error tolerance, while ready made hash maps that I have seen provide only exact match. EDIT: To clarify, I am talking about incrementing/decrementing an already obtained iterator. Yes, this is mostly done in order to traverse the whole map. The errors in strings (keys) in my case occur from OCR errors. So I can not use the error handling techniques used to detect typing errors. The chance of fist character being wrong is almost the same as that of the last one. Also, my keys are always string, one word to be exact. Number of entries will be less than 5000. So hash table size of 2^16 is enough for me. Even though it will still be sparsely populated, but that's ok. My hash function: hash code size is 16 bits. First 5 bits for the word length. ==> Max possible key length = 32. Reasonable, given that key is a single word. Last 11 bits for sum of the char codes. I only store the English alphabet characters, and do not need case sensitivity. So 26 codes are enough, 0 to 25. So a key with 32 'z' = 25 * 32 = 800. Which is well within 2^11. I even have scope to add case sensitivity, if needed …
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43350240
tagged with: c++
has answer: http://stackoverflow.com/a/27456338
tagged with: java
has answer: http://stackoverflow.com/a/27456726
has comment: http://stackoverflow.com/comment/43371190
has comment: http://stackoverflow.com/comment/43350037
type: Question
tagged with: iterator
tagged with: hashmap

http://stackoverflow.com/comment/43131078
has text: What do you think `studentID !String.equals("end")` should do and why?
score: 4
type: Comment
comment on: http://stackoverflow.com/q/27337212
type: QuestionComment

http://stackoverflow.com/q/27343253
tagged with: eclipse-luna
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43142044
has comment: http://stackoverflow.com/comment/43142054
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43141953
has body: I have multiple breakpoints in a Java project. I want to skip them all (except one) for the current session only and stop at that one particular breakpoint while debugging. How can that be achieved in the quickest way?
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/33162526
favorite count: 0
has title: In Eclipse Luna how to skip all breakpoints except one?
accepted answer: http://stackoverflow.com/a/33162526
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43142032

http://stackoverflow.com/q/27396819
has comment: http://stackoverflow.com/comment/43240317
possible better answer: http://stackoverflow.com/a/27397033
favorite count: 0
has answer: http://stackoverflow.com/a/27397055
has answer: http://stackoverflow.com/a/27397033
has title: Removing spaces at a certain position in a string
has answer: http://stackoverflow.com/a/27397117
has comment: http://stackoverflow.com/comment/43240338
answer count: 4
score: -3
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43241616
has comment: http://stackoverflow.com/comment/43239900
tagged with: java
accepted answer: http://stackoverflow.com/a/27397117
has comment: http://stackoverflow.com/comment/43240115
has comment: http://stackoverflow.com/comment/43240081
has answer: http://stackoverflow.com/a/27397181
type: Question
has body: My input string has a value of 4BI C 06W 045 PNL 02 E and I would like the output to be 4BI C 06W 045 PNL02E Input : 4BI C 06W 045 PNL 02 E output : 4BI C 06W 045 PNL02E (removing spaces in between PNL ,02 and E). Thanks Pavan
has comment: http://stackoverflow.com/comment/43240067
downvote count: 4
has comment: http://stackoverflow.com/comment/43239841

http://stackoverflow.com/comment/43241500
type: AnswerComment
has text: Thanks for your kind answer. I'll try. However, as you said, something lacks. I guess there's a way to use model directly in vm.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27393551

http://stackoverflow.com/q/27426034
tagged with: java
tagged with: hibernate
type: Question
tagged with: hibernate-search
has answer: http://stackoverflow.com/a/27431485
score: 0
has title: indexing PDF's in Hibernate Search 3.3.0 Final does not work
tagged with: http://stackoverflow.com/tag/pdf
tagged with: jpa
answer count: 1
type: UnansweredQuestion
has body: I have a Problem with indexing PDF's and therefore Problems with the Full text -Search capabilities of Hibernate Search. I am trying to index around 3750 Objects. Each Object has several Fields including 2 Strings I want to index : @Field(index = Index.TOKENIZED, store = Store.YES) @Column(name = "ANZEIGENAME") private String anzeigeName; // VARCHAR2(250), @Field(index = Index.TOKENIZED, store = Store.YES) @Column(name = "BESCHREIBUNG") private String beschreibung; // VARCHAR2(512), And also a byte[ ] field i want to index for Fulltext-Search on those PDF's @Field(index = Index.TOKENIZED, store = Store.YES) @FieldBridge(impl = FieldBridgeConverter.class) @Lob @Column(name = "PDFDATA") private byte[] pdfData; // BLOB; This is what my FieldBridge for the PDF's looks like public class FieldBridgeConverter implements StringBridge { public String objectToString(final Object object) { byte[] file = (byte[]) object; return file.toString(); } } The Problem now is that those 3750 Objects have a combined Size of 3.5 Gb. So after persisting one after another my index Folder has a combined size of 1.5 mb for 3750 Objects. Seems a bit odd because according to http://lucene.apache.org/core/ Index-Files are ~20-30% of the size of the Text. So it should be at least around 500 mb. This is my persistence.xml : <?xml version="1.0" encoding="UTF-8" ?> org.hibernate.ejb.HibernatePersistence java:/DlcDS servicepackage.ClickBO servicepackage.DlcBO <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect" /> <property name="hibernate.show_sql" value="false" /> <property name="hibernate.format_sql" value="false" /> <property name="hibernate.use_sql_comments" value="false" /> <property name="hibernate.generate_statistics" value="false" /> <property name="hibernate.connection.characterEncoding" value="UTF-8" /> <property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider" /> <property name="jboss.as.jpa.providerModule" value="org.hi…

http://stackoverflow.com/a/27467455
type: Answer
accepted answer of: http://stackoverflow.com/q/27467251
answers question: http://stackoverflow.com/q/27467251
has body: Your error is here: this.child = new TrieNode[len]; You will firstly set each TriNode in this array, in other words, if you try this code: public TrieNode getChild(int x){ System.out.println("Child["+x+"] "+this.child[x]); return this.child[x]; } You will find that all the childs are null !!!!
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43371601

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

graphics
tag name: graphics
tags question: http://stackoverflow.com/q/27462451
tags question: http://stackoverflow.com/q/27459190
tags question: http://stackoverflow.com/q/27411131
tags question: http://stackoverflow.com/q/27420362
type: Tag
tags question: http://stackoverflow.com/q/27325720
tags question: http://stackoverflow.com/q/27414017
tags question: http://stackoverflow.com/q/27319041
tags question: http://stackoverflow.com/q/27328866
tags question: http://stackoverflow.com/q/27397971
tags question: http://stackoverflow.com/q/27344550
tags question: http://stackoverflow.com/q/27379987
tags question: http://stackoverflow.com/q/27337234

http://stackoverflow.com/comment/43242245
type: AnswerComment
has text: @soldiershin What is "back node connected functionality"?
type: Comment
comment on: http://stackoverflow.com/a/27397686
score: 0

http://stackoverflow.com/q/27473351
score: -1
has title: Threads in java - how to send information from one thread that the next one should start
favorite count: 0
has comment: http://stackoverflow.com/comment/43381288
type: UnansweredQuestion
tagged with: multithreading
downvote count: 1
has comment: http://stackoverflow.com/comment/43381447
tagged with: java
has answer: http://stackoverflow.com/a/27473623
has answer: http://stackoverflow.com/a/27473460
type: Question
answer count: 2
upvote count: 0
has comment: http://stackoverflow.com/comment/43381260
has body: I've got a problem. When my program starts one thread starts, then inside this thread I'm waiting for something to happen(actually it's a server thread and it waits till someone connects to it and then the other thread should start) and then the other thread should start. In other words, from one thread I have to send somehow the message that the other thread should start(the first one is still running of course). I'm very new to multithread programming so I would be really grateful for your help!

http://stackoverflow.com/comment/43126439
type: AnswerComment
comment on: http://stackoverflow.com/a/27334615
type: Comment
score: 1
has text: This is much neat solution than what I have posted below. +1

http://stackoverflow.com/comment/43112592
comment on: http://stackoverflow.com/a/27326616
score: 0
type: AnswerComment
type: Comment
has text: I think if you want to do semantic analysis like that, then you would have to use a dictionary, like the others mentioned above. There's no way to determine if a word is a real proper noun with just textual analysis. I had just assumed you were going for a "good enough" type algorithm.

http://stackoverflow.com/q/27374152
has body: We are working on stuff that deal with PST, so we are trying to create using java-libpst sample code. It work fine for me, but we need to show the details of PST, like PST name, configured email account on given PST. I want to show email address and the name of given address of given PST. public Test(String filename) { try { PSTFile pstFile = new PSTFile(filename); PSTFolder pstFolder=pstFile.getRootFolder(); System.out.println(pstFile.getMessageStore().getDisplayName()); processFolder(pstFile.getRootFolder()); } catch (Exception err) { err.printStackTrace(); } } pstFile.getMessageStore().getDisplayName() show imap.gmail.com and we want two more thing like my email address configured is : mymail@gmail.com and name is : My Name. How can I get this two properties using java-libpst?
score: 3
downvote count: 0
favorite count: 0
type: Question
tagged with: pst
upvote count: 3
tagged with: java
has title: How can I get PST email address and name?
answer count: 1
has answer: http://stackoverflow.com/a/64382549
type: UnansweredQuestion

http://stackoverflow.com/a/27395883
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27393763
type: Answer
accepted answer of: http://stackoverflow.com/q/27393763
score: 1
has body: By "implicit collection" XStream means collection of elements without enclosing ("root") element (see configuration manual). In your XML charge elements are enclosed by the charges element. Therefore charges is NOT implicit collection and addImplicitCollection configuration is wrong. So you can either leave XML as is and remove 'addImplicitCollection' invocation or remove charges element, like this: <allocQty /> <allocPrice /> A B C D (in the later case you also must fix typo: third parameter of addImplicitCollection must be "charge", not "charges").
has comment: http://stackoverflow.com/comment/43313235
upvote count: 1

http://stackoverflow.com/a/27341050
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27341003
has body: This is sort of implementation of a SINGLETON pattern, in Java. Look here to understand the concepts behind this pattern click here. Shortly, you want to use this pattern if you want to have an instance of the class Instance trough all application's life cycle. To understand it, the key in your code is in the part "if(instance == null)" {instance should be written with lower key, as it should be a class variable}. If you go simply with the "new ..." any nuber of instances of this variables could be created. If instead you use the boot method, you are sure that the instance is always the same. Anyway in the implementation you have written something is missing. You should refer to this link, where there is also a complete implementation in Java programming language.
downvote count: 0

http://stackoverflow.com/a/27341173
answers question: http://stackoverflow.com/q/27341158
has comment: http://stackoverflow.com/comment/43138445
type: Answer
has comment: http://stackoverflow.com/comment/43138425
has comment: http://stackoverflow.com/comment/43138281
score: 3
has comment: http://stackoverflow.com/comment/43138387
downvote count: 0
has body: In general, you should multiply by 100 to get the percentage of some fraction : return ( count * 100 ) / temp.length; However, if you are already using percent.format to display the fraction as percentage, you should simply return the fraction : return (double) count / temp.length; Note that in this case percent90OrMore must return a float or a double. Otherwise you'll always get either 0 or 1. public static double percent90OrMore (int[] temp) { int count = 0; for ( int i = 0; i &lt; temp.length; i++ ) { if ( temp[i] &gt;= 90 ) { count++; } } return (double)count/temp.length; }
has comment: http://stackoverflow.com/comment/43138310
has comment: http://stackoverflow.com/comment/43138469
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27341158
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43138254

http://stackoverflow.com/q/27417363
favorite count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/43280283
type: UnansweredQuestion
has title: SOAP web service giving 500 server error using Proxy Servlet
upvote count: 1
tagged with: web-services
has comment: http://stackoverflow.com/comment/43278337
tagged with: java
has comment: http://stackoverflow.com/comment/43280470
tagged with: servlets
type: Question
downvote count: 0
tagged with: proxy
tagged with: soap
has body: Hi I am trying to send a XML payload using ajax call through a proxy servlet. The url is a SOAP Web Service. The client side javascript code looks like this. var sURL = "https://username:password@my11111.crm.example.com/sap/bc/srt/scs/sap/managecustomerin1?sap-vhost=my11111.crm.example.com" $.ajax({ url : sURL, beforeSend: function(xhrObj){ xhrObj.setRequestHeader("Content-Type","text/xml; charset=UTF-8"); }, type : "POST", dataType : "xml", data : sEnv, processData: false, contentType: "text/xml; charset=UTF-8", success : handleSuccessCallback, error : handleErrorCallback }); function handleSuccessCallback(data, resp){ alert("Success: "+data); } function handleErrorCallback(msg){ alert("Error: "+msg); } Variable sEnv is holding payload xml data for eg: <?xml version='1.0' encoding='utf-8'?> <soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:glob='http://sap.com/xi/SAPGlobal20/Global' xmlns:a00='http://sap.com/xi/AP/CustomerExtension/BYD/A0014' xmlns:glob1='http://sap.com/xi/AP/Globalization'> <soapenv:Header/> <soapenv:Body> <glob:CustomerBundleMaintainRequest_sync_V1> 2 true 2 SAP Madrid A <ObjectNodeSenderTechnicalID>002</ObjectNodeSenderTechnicalID> <PreferredCommunicationMediumTypeCode>LET</PreferredCommunicationMediumTypeCode> info@sap.com <FacsimileFormattedNumberDescription>9111111111</FacsimileFormattedNumberDescription> www.sap.com <ObjectNodeSenderTechnicalID>004</ObjectNodeSenderTechnicalID> <FormattedNumberDescription>9111111111</FormattedNumberDescription> ES Madrid 28043 Torrelaguna 2 <POBoxDeviatingRegionCode>28</POBoxDeviatingRegionCode> 142 E1019 </glob:CustomerBundleMaintainRequest_sync_V1> </soapenv:Body> When I call the service using chrome flag "--disable-web-security" and without any proxy servlet(refer sUrl variable above), the code above works and I am able to send the payload successfully to the web service and I can see the new data added in the backend. But I don't want the chrome security flag. So I tried u…
score: 1

http://stackoverflow.com/q/27404342
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27404608
accepted answer: http://stackoverflow.com/a/27404608
tagged with: java
type: Question
score: 0
answer count: 1
has body: Fairly new to Java, and running into a z order problem. I have a legacy Java application that has a main window A, which pops up a modal JDialog B. Upon clicking a button on B, a modal dialog C pops up. For the transition from B to C: B.setVisible(false); B.setModalityType(Dialog.ModalityType.MODELESS); B.toFront(); B.repaint(); B.setVisible(true); .... C.pack(); C.setResizable(false); C.setModal(true); C.setVisible(true); When C goes away, the opposite is done and B is set as modal again. This works, except that as soon as C is shown, B is pushed to the back behind A. I want to keep B in front of A while C is displayed. What am I misunderstanding/doing wrong? Running on Windows 7 64 bit, Java 1.8.0_20-b26.
has title: Modal JDialog gets pushed to back when opening another JDialog

http://stackoverflow.com/comment/43236273
comment on: http://stackoverflow.com/a/27393921
has text: See here http://pastebin.com/BgPBTsG1 run inside a class extends jpanel or add your jpanel name to setBorder, setLayout, add (for screen shot run it hehe)
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27413746
has comment: http://stackoverflow.com/comment/43271678
has comment: http://stackoverflow.com/comment/43271716
upvote count: 2
has comment: http://stackoverflow.com/comment/43271731
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43271708
has comment: http://stackoverflow.com/comment/43349929
accepted answer of: http://stackoverflow.com/q/27413678
type: Answer
has comment: http://stackoverflow.com/comment/43350566
answers question: http://stackoverflow.com/q/27413678
score: 2
downvote count: 0
has body: Why are you creating an ArrayList of Airport in class Airport and creating an ArrayList of Flight in class Flight? If you want Airport to be able to see a full list of Flights, you can add an ArrayList of Flight into class Airport. class Airport { //other variables ArrayList&lt;Flight&gt; flightList; } You can either add the list of Flights into an Airport object via: The Airport constructor OR The Airport setter (setFlights(ArrayList flightList)) OR A method in Airport which adds new flights To be able to retrieve the list of flights from your Airport object, you need a getter in your Class Airport: public ArrayList&lt;Flight&gt; getFlights() { return flightList; } A complete example: Adding through 1. The Airport constructor public static void main(String[] args) { ArrayList&lt;Flight&gt; flightList = new ArrayList&lt;Flight&gt;(); flightList.add(new Flight(...)); //The ... within the braces depends on your Flight constructor flightList.add(new Flight(...)); //The ... within the braces depends on your Flight constructor flightList.add(new Flight(...)); //The ... within the braces depends on your Flight constructor Airport airport = new Airport(flightList); //Now airport has a list of flights } Adding through 2. The Airport setter methods (Mutators) //Within your Airport class public void setFlight(ArrayList&lt;Flight&gt; flightList) { this.flightList = flightList; } Adding through 3. A method in Airport which adds new flights If you do not want to get flights through the constructor, and there is a chance that you may want to add new flights one by one, you can create another addFlight(Flight newFlight) method: public void addFlight(Flight newFlight) { flightList.add(newFlight); } In case you are wondering the use of getter and setter. We are using it because your flightList will be private. In order to access a private member, we need "help" from a public method. These methods which give us access to private members are known as getter/setter, or better knows as …

string
tags question: http://stackoverflow.com/q/27455662
tags question: http://stackoverflow.com/q/27410952
tags question: http://stackoverflow.com/q/27468627
tags question: http://stackoverflow.com/q/27451420
tags question: http://stackoverflow.com/q/27463116
tags question: http://stackoverflow.com/q/27466476
tags question: http://stackoverflow.com/q/27400901
tags question: http://stackoverflow.com/q/27346818
tags question: http://stackoverflow.com/q/27405726
tags question: http://stackoverflow.com/q/27333998
tags question: http://stackoverflow.com/q/27469797
tags question: http://stackoverflow.com/q/27348213
tags question: http://stackoverflow.com/q/27341033
tags question: http://stackoverflow.com/q/27465934
tags question: http://stackoverflow.com/q/27348319
tags question: http://stackoverflow.com/q/27373324
tags question: http://stackoverflow.com/q/27319863
tags question: http://stackoverflow.com/q/27344015
tags question: http://stackoverflow.com/q/27343244
tags question: http://stackoverflow.com/q/27380199
tags question: http://stackoverflow.com/q/27332239
tags question: http://stackoverflow.com/q/27466389
tags question: http://stackoverflow.com/q/27361133
tags question: http://stackoverflow.com/q/27429281
tags question: http://stackoverflow.com/q/27370537
tags question: http://stackoverflow.com/q/27348300
tags question: http://stackoverflow.com/q/27465731
tags question: http://stackoverflow.com/q/27409078
tags question: http://stackoverflow.com/q/27360633
tags question: http://stackoverflow.com/q/27464307
tags question: http://stackoverflow.com/q/27337820
tags question: http://stackoverflow.com/q/27388655
tags question: http://stackoverflow.com/q/27464298
tags question: http://stackoverflow.com/q/27327838
tags question: http://stackoverflow.com/q/27449466
tags question: http://stackoverflow.com/q/27469858
tags question: http://stackoverflow.com/q/27432827
tags question: http://stackoverflow.com/q/27363365
tags question: http://stackoverflow.com/q/27326387
tags question: http://stackoverflow.com/q/27437834
tag name: string
tags question: http://stackoverflow.com/q/27357035
tags question: http://stackoverflow.com/q/27394475
tags question: http://stackoverflow.com/q/27339578
tags question: http://stackoverflow.com/q/27343042
tags question: http://stackoverflow.com/q/27430305
tags question: http://stackoverflow.com/q/27318471
tags question: http://stackoverflow.com/q/27460838
tags question: http://stackoverflow.com/q/27314113
tags question: http://stackoverflow.com/q/27383506
tags question: http://stackoverflow.com/q/27446500
tags question: http://stackoverflow.com/q/27372530
tags question: http://stackoverflow.com/q/27435779
tags question: http://stackoverflow.com/q/27468131
tags question: http://stackoverflow.com/q/27325154
tags question: http://stackoverflow.com/q/27402992
tags question: http://stackoverflow.com/q/27322707
tags question: http://stackoverflow.com/q/27334176
tags question: http://stackoverflow.com/q/27413990
tags question: http://stackoverflow.com/q/27435380
tags question: http://stackoverflow.com/q/27385328
tags question: http://stackoverflow.com/q/27327234
tags question: http://stackoverflow.com/q/27329910
tags question: http://stackoverflow.com/q/27462931
tags question: http://stackoverflow.com/q/27314682
tags question: http://stackoverflow.com/q/27468114
type: Tag
tags question: http://stackoverflow.com/q/27390854
tags question: http://stackoverflow.com/q/27346080
tags question: http://stackoverflow.com/q/27363717
tags question: http://stackoverflow.com/q/27396495
tags question: http://stackoverflow.com/q/27320144
tags question: http://stackoverflow.com/q/27448990
tags question: http://stackoverflow.com/q/27345226
tags question: http://stackoverflow.com/q/27341802
tags question: http://stackoverflow.com/q/27470694
tags question: http://stackoverflow.com/q/27376524
tags question: http://stackoverflow.com/q/27447101
tags question: http://stackoverflow.com/q/27363343
tags question: http://stackoverflow.com/q/27345834

http://stackoverflow.com/q/27359782
has comment: http://stackoverflow.com/comment/43172496
has title: Android apps cant even run.Logcat show "android.widget.text view cannot be cast to android.widget.Button."
possible better answer: http://stackoverflow.com/a/27360070
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/27360070
has comment: http://stackoverflow.com/comment/43171688
upvote count: 2
linked to: http://stackoverflow.com/q/12465551
has comment: http://stackoverflow.com/comment/43172107
has comment: http://stackoverflow.com/comment/43171887
has comment: http://stackoverflow.com/comment/43171663
downvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27360046
type: Question
has comment: http://stackoverflow.com/comment/43172676
has comment: http://stackoverflow.com/comment/43171750
has body: I am new in android application here..And my apps cant event run,and i just dont know why..The logcat there keep showing this android.widget.text view cannot be cast to android.widget.Button here is my code in mainactivity.java package com.loginandregister; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; public class MainActivity extends Activity { @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); // setting default screen to login.xml setContentView(R.layout.main); Button registerScreen = (Button) findViewById(R.id.link_to_register); // Listening to register new account link registerScreen.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Switching to Register screen Intent i = new Intent(getApplicationContext(), RegisterActivity.class); startActivity(i); } }); Button loginScreen = (Button) findViewById (R.id.link_to_login); // Listening to register new account link loginScreen.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Switching to Register screen Intent i = new Intent(getApplicationContext(), LoginActivity.class); startActivity(i); } }); } } login.xml <?xml version="1.0" encoding="utf-8"?> <ImageView android:src="@drawable/logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dip"/> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#372c24" android:text="Email"/> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#372c24" android:text="Password"/> <TextView android:id="@+id/link_to_register" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="40dip" android:layout_marginTop="40dip" android:gravity="center" android:text="New to Plot Out?Register here" android:textColor="#0b84aa" …
answer count: 2
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/27360046

object
tags question: http://stackoverflow.com/q/27459279
tags question: http://stackoverflow.com/q/27458597
tag name: object
tags question: http://stackoverflow.com/q/27466141
tags question: http://stackoverflow.com/q/27410620
tags question: http://stackoverflow.com/q/27387404
tags question: http://stackoverflow.com/q/27314977
tags question: http://stackoverflow.com/q/27409527
tags question: http://stackoverflow.com/q/27336681
tags question: http://stackoverflow.com/q/27414214
tags question: http://stackoverflow.com/q/27334917
tags question: http://stackoverflow.com/q/27436491
tags question: http://stackoverflow.com/q/27439055
tags question: http://stackoverflow.com/q/27355033
tags question: http://stackoverflow.com/q/27343837
tags question: http://stackoverflow.com/q/27417376
tags question: http://stackoverflow.com/q/27318259
tags question: http://stackoverflow.com/q/27407806
tags question: http://stackoverflow.com/q/27374578
tags question: http://stackoverflow.com/q/27402861
tags question: http://stackoverflow.com/q/27413678
tags question: http://stackoverflow.com/q/27380515
tags question: http://stackoverflow.com/q/27409718
tags question: http://stackoverflow.com/q/27347299
tags question: http://stackoverflow.com/q/27369052
tags question: http://stackoverflow.com/q/27447282
tags question: http://stackoverflow.com/q/27437454
tags question: http://stackoverflow.com/q/27399712
tags question: http://stackoverflow.com/q/27459199
tags question: http://stackoverflow.com/q/27424571
tags question: http://stackoverflow.com/q/27338111
tags question: http://stackoverflow.com/q/27417037
tags question: http://stackoverflow.com/q/27394456
tags question: http://stackoverflow.com/q/27344062
type: Tag
tags question: http://stackoverflow.com/q/27353878
tags question: http://stackoverflow.com/q/27451266
tags question: http://stackoverflow.com/q/27384970
tags question: http://stackoverflow.com/q/27398861

http://stackoverflow.com/q/27399712
favorite count: 0
accepted answer: http://stackoverflow.com/a/27399735
has body: Is it possible to properly compare objects using the operators &gt;, &lt; and == in Java? I have implemented the Comparable interface in one of my objects. It would save some time and be nice to write if (obj1 &lt; obj2) do sth instead of if (obj1.compareTo(obj2) &lt; 0) do sth Is that possible if I implement something else or does it generally not work like this?
has title: Java: Compare objects using >, < and ==
answer count: 4
has answer: http://stackoverflow.com/a/27399803
score: 2
upvote count: 2
tagged with: java
type: Question
type: AnsweredQuestion
tagged with: object
has answer: http://stackoverflow.com/a/27399732
has answer: http://stackoverflow.com/a/27399736
tagged with: comparable
possible better answer: http://stackoverflow.com/a/27399732
downvote count: 0
has answer: http://stackoverflow.com/a/27399735
has comment: http://stackoverflow.com/comment/43244697

http://stackoverflow.com/a/27334809
score: 0
answers question: http://stackoverflow.com/q/27333820
type: Answer
has comment: http://stackoverflow.com/comment/43193194
has body: As you are creating the linkedlist object stdQue inside the action performed event of button, the object is getting created and reinitialized every time the button is clicked. To make the data persistent, please take the object creation outside the button click event. Assuming the class name as StudentManager, you can create the object inside the constructor: class StudentManager { Queue stdQue; public StudentManager() { stdQue = new LinkedList(); &lt;-- Create the queue } private void addStd1ActionPerformed(java.awt.event.ActionEvent evt) { . . stdQue.add(sId); stdQue.add(stdQuality); stdQue.add(stName); . . } }
has comment: http://stackoverflow.com/comment/43158388
has comment: http://stackoverflow.com/comment/43134776
has comment: http://stackoverflow.com/comment/43136024

http://stackoverflow.com/comment/48516861
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/28617619
type: Comment
has text: @Nonos - You should call scrollToPosition() whenever you want the recycler view to scroll to a specific item (that is not currently showing) by its position. Further, there is no point in calling scrollToPosition() to scroll to an item being clicked because the fact that the user clicked on it indicates that it's visible and scrolling to its position will therefore have no effect.

http://stackoverflow.com/comment/43266308
has text: It compiled correctly, but it goes straight to the game, and does not show the menu with the JButton "play".
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27387640

http://stackoverflow.com/a/27391830
has comment: http://stackoverflow.com/comment/43231390
accepted answer of: http://stackoverflow.com/q/27391767
has comment: http://stackoverflow.com/comment/43231397
answers question: http://stackoverflow.com/q/27391767
has comment: http://stackoverflow.com/comment/43231298
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43232602
has comment: http://stackoverflow.com/comment/43279838
downvote count: 0
has body: You've shadowed the variable; from the linked Wikipedia article variable shadowing occurs when a variable declared within a certain scope (decision block, method, or inner class) has the same name as a variable declared in an outer scope. Comment out the type in the try block. /* PrintWriter */ outFile = new PrintWriter("/Users/Test/Desktop/Java/Notifacation.txt"); Edit Another way to create your file path is to use the System.getProperty(String) to get the "user.home" like outFile = new PrintWriter(System.getProperty("user.home") + "/Desktop/Java/Notifacation.txt"); That way you'll get the currently logged in user's home folder on Windows, Mac and/or Linux.
has comment: http://stackoverflow.com/comment/43231362
type: Answer
has comment: http://stackoverflow.com/comment/43231388
has comment: http://stackoverflow.com/comment/43231261
score: 3
upvote count: 3

http://stackoverflow.com/q/27316886
has body: First of all, I took a look into other AccessViolationException problems here on SO, but mostly I didn't understand much because of terms like "marshalling" and unsafe code, etc. Context: I try to port some of the Java Netty code to C#. Maybe I mixed up the two languages and don't see it anymore. I just have two methods, one forwarding parameters to the other. public override ByteBuf WriteBytes(sbyte[] src) { WriteBytes(src, 0, src.Length); return this; } public override ByteBuf WriteBytes(sbyte[] src, int srcIndex, int length) { SetBytes(WriterIndex, src, srcIndex, length); // AccessViolationException throws here return this; } Now, I'm testing the first method in my unit test, like this: var byteArray = new sbyte[256]; for (int i = 0, b = sbyte.MinValue; b &lt;= sbyte.MaxValue; i++, b++) // -128 ... 127 { byteArray[i] = (sbyte) b; } buffer.WriteBytes(byteArray); // this is the invokation What I found so far is, that the problem seems to arise from the "length" parameter. I don't know, but maybe I'm not allowed to use "src.Length" in the first method to pass it to the second. Also, please note that I am using sbyte, not byte. (I hope this doesn't matter.) Does this have to do with pass-by-reference or pass-by-value of arrays? Edit: I found that the exception must be thrown anywhere in the depths of SetBytes. However, I believed that SetBytes never was called because I set a breakpoint on the method's entry. But the debugger never stopped there. I believe that the debugger doesn't work properly as it sometimes doesn't stop at the breakpoints I set. After I have managed to debug the whole depths of SetBytes, the AccessViolationException was never thrown. I then RUN the test 10x and the exception didn't appear. Then I DEBUGged the whole thing again and the exception appeared again. Why is that??
has comment: http://stackoverflow.com/comment/43094688
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43094188
answer count: 0
tagged with: java
tagged with: access-violation
has title: AccessViolationException on SByte[].Length
type: Question
tagged with: c#
tagged with: arrays
has comment: http://stackoverflow.com/comment/43094612
score: 0
has comment: http://stackoverflow.com/comment/43093937

http://stackoverflow.com/comment/43230564
has text: @ElyasHadizadeh yep. Consider this: `"str" + "ing" + "test"`. Without the string builder, it must first create a new string, and copy all the information over, resulting in `"string" + "test"`. Then, copy all the new information over as well as the previous longer string, to form `"stringtest"`. `StringBuilder` avoids having to copy all the previous information every concatenation.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27340716
type: AnswerComment

http://stackoverflow.com/q/27441249
has answer: http://stackoverflow.com/a/28524232
has comment: http://stackoverflow.com/comment/43322285
score: 0
answer count: 3
has title: GSON is deprecated. Which one we can use to serialize and deserialize Java objects to and from JSON?
has comment: http://stackoverflow.com/comment/43322090
tagged with: android
has body: Hi I want to store the Java Objects. I have searched and found that the GSON library is doing the conversion of Java Object to Json String and vice versa. Then I can store the converted JSON String into the Shared Preferences. But That GSON library is deprecated and there is no update after May 2013. Kindly provide me an alternate way to implement the same. Thanks in advance.
favorite count: 0
has comment: http://stackoverflow.com/comment/43322162
has answer: http://stackoverflow.com/a/76539659
has comment: http://stackoverflow.com/comment/43322258
possible better answer: http://stackoverflow.com/a/28524232
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: sharedpreferences
tagged with: gson
type: Question
upvote count: 2
downvote count: 2
has answer: http://stackoverflow.com/a/27441449
accepted answer: http://stackoverflow.com/a/27441449

http://stackoverflow.com/comment/43356240
has text: Hey, thanks for your concern but it's far from a serious project. It's a school task, for introduction Java, so they wanted us to dip our toes in the water and make a browser that only supports HTML
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27459738

http://stackoverflow.com/comment/43312124
comment on: http://stackoverflow.com/q/27435575
has text: Not sure cause I don't feel like calculating it, but I'm pretty sure you're running into an overflow condition. Basically, long doesn't have enough capacity to hold the extremely large number that is 21 factorial and possibly 13 factorial. For large numbers like these, use BigInteger class.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27378010
answers question: http://stackoverflow.com/q/27374594
has body: Actually there is a bug in material-ripple library , already reported there,https://github.com/balysv/material-ripple/issues/15 i have solved my issue, boolean isLongClick = false; holder.riple.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { Toast.makeText(getActivity(), "item riple clicked "+position, 0).show(); Intent intent = new Intent(getActivity(), PlayerActivity.class); intent.putExtra("songs", list_path.get(position).toString()); intent.putExtra("name", ""+parts[0]); intent.putExtra("dur", ""+convertMillis(parts[2])); intent.putExtra("time", getDate(parts[1].toString())); if(isLongClick== false) { startActivity(intent); } // for click agin on item isLongClick = false; } }); holder.riple.setOnLongClickListener(new OnLongClickListener() { @Override public boolean onLongClick(View v) { isLongClick = true; list.showContextMenu(); //Toast.makeText(getActivity(), "LongClick", 0).show(); //v.setClickable(false);//v.isClickable(); return true; } });
type: Answer
score: 0

http://stackoverflow.com/comment/43129619
type: Comment
has text: @Zouzou Oh Yes. Sorry haven't read the question properly.. Need to remove my answer then
comment on: http://stackoverflow.com/a/27336386
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43267756
has text: See https://stackoverflow.com/questions/11796464/my-copy-of-eclipse-doesnt-know-what-an-object-or-a-string-is
comment on: http://stackoverflow.com/q/27409223
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43232627
type: Comment
type: AnswerComment
has text: @RyanJ Okay thanks so much, I feel like an idiot now because it was such an easy answer. On an unrelated note, do you know how to make a jframe file in netbeans be the main so that it opens automatically when you click run instead of having to right click and run that file? I know there's two ways, typing something in the main file, or making it the main file, but I'm not sure how to do either one.
score: 0
comment on: http://stackoverflow.com/a/27392538

http://stackoverflow.com/comment/43240622
type: Comment
type: QuestionComment
has text: A blob would need less storage space, but with sufficiently large files, this does not matter. In any case, large strings and blobs behave identically.
comment on: http://stackoverflow.com/q/27396440
score: 0

http://stackoverflow.com/a/27406311
has body: Use new String(btye[]) instead of toString() to get string from byte array.
type: Answer
has comment: http://stackoverflow.com/comment/43261977
has comment: http://stackoverflow.com/comment/43257587
has comment: http://stackoverflow.com/comment/43257505
has comment: http://stackoverflow.com/comment/43258070
has comment: http://stackoverflow.com/comment/43258931
has comment: http://stackoverflow.com/comment/43258888
score: 0
has comment: http://stackoverflow.com/comment/43259868
has comment: http://stackoverflow.com/comment/43259472
answers question: http://stackoverflow.com/q/27406235

http://stackoverflow.com/comment/99746194
has text: Also make sure the format is correct. This fix didn't work for me until because I set the format to `yyyy-mm-dd` when it should have been `yyyy-MM-dd`.
comment on: http://stackoverflow.com/a/49232011
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27327030
has comment: http://stackoverflow.com/comment/82990842
tagged with: spring
has answer: http://stackoverflow.com/a/59906725
tagged with: spring-boot
downvote count: 0
has comment: http://stackoverflow.com/comment/43117567
score: 1
tagged with: java
has body: I guess this is pretty basic stuff, but couldn't find anything interesting. Let's say that I have a large CRM/ERP Spring Boot app. I will call it "app A". It's used only internally on a company's intranet. For security reasons, it would be best if it would not be exposed to publicly. Now, I want to build another, much smaller app, like blog or ads wall, call it "app B". The only purpose of this app is to expose a small part of data managed by A to the public, in the form of a blog or ads wall. Of course A uses some sort of database engine, covered with Hibernate, and has some services and so on. The tricky part is that I'd like to not use Hibernate in app B and get data only from app A, getting them remotely (they both could be deployed on the same machine with different domains), using services that A has. In general my question is; is this is a good idea, and also, even more important, how to do that? I know about existence of Facade Pattern, I know that you could make a REST API and use json. But is there a better way? I'm not that deep into Java as I would like to be. Any suggestions will be appreciated.
type: Question
has title: Spring Boot - talking between two applications
answer count: 2
tagged with: api
upvote count: 1
has comment: http://stackoverflow.com/comment/43113105
has answer: http://stackoverflow.com/a/59906764
favorite count: 0
has comment: http://stackoverflow.com/comment/43130453
type: UnansweredQuestion

http://stackoverflow.com/comment/43137230
type: Comment
comment on: http://stackoverflow.com/a/27340198
has text: @Arash-Thanx a lot,it worked,is their any other way i can get in touch with u to learn more from you.?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43205315
has text: So, you will have to provide implementation for space(). Compiler can't just substitute it for you.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27377299

http://stackoverflow.com/comment/43376305
type: AnswerComment
comment on: http://stackoverflow.com/a/27470088
score: 0
type: Comment
has text: I have used this: `int heightToAdd = (int)(fm.getStringBounds("Sample Text", g).getHeight() - g.getFont().getSize()) / 2;` and added the font size to it. But I still have a feeling that is not the right way...

http://stackoverflow.com/a/27404665
has body: public static &lt;T extends Enum&lt;T&gt; &amp; HasVal&gt; getEnumFromVal(Class&lt;T&gt; enumClass, String val) { for (T e : enumClass.getEnumConstants()) { if (e.getVal().equals(val)) { return e; } } return null; } where HasVal is the common interface defining the getVal() method
downvote count: 0
score: 2
accepted answer of: http://stackoverflow.com/q/27404513
upvote count: 2
answers question: http://stackoverflow.com/q/27404513
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/a/27357767
has comment: http://stackoverflow.com/comment/43169461
has comment: http://stackoverflow.com/comment/43168862
has comment: http://stackoverflow.com/comment/43168690
has comment: http://stackoverflow.com/comment/43168984
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43169498
has comment: http://stackoverflow.com/comment/43204784
has body: Before you create a database, you must create a user who can be connected to that database, to do that : connect system/password; the password that you entered during the installation. create user : create user user1 identified by 'password'; and also to give this user some privileges for creating tables,views and so on . . grant dba,resource, connect to user; after that you must connect to that user by typing this : connect user1/password; Now you can create tables, like this : create table exemple( id int primary key, name varchar2(255) );
has comment: http://stackoverflow.com/comment/43168552
has comment: http://stackoverflow.com/comment/43168615
has comment: http://stackoverflow.com/comment/43168530
type: Answer
has comment: http://stackoverflow.com/comment/43205238
has comment: http://stackoverflow.com/comment/43201384
has comment: http://stackoverflow.com/comment/43168082
has comment: http://stackoverflow.com/comment/43169650
upvote count: 19
has comment: http://stackoverflow.com/comment/43168028
has comment: http://stackoverflow.com/comment/43169256
score: 19
has comment: http://stackoverflow.com/comment/43169557
has comment: http://stackoverflow.com/comment/43168308
has comment: http://stackoverflow.com/comment/43168730
has comment: http://stackoverflow.com/comment/74747895
accepted answer of: http://stackoverflow.com/q/27357493
answers question: http://stackoverflow.com/q/27357493

http://stackoverflow.com/q/27353558
tagged with: error-handling
possible better answer: http://stackoverflow.com/a/27405572
type: Question
tagged with: runtime-error
has title: printStackTrace() in a finished product. When and why?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27353758
accepted answer: http://stackoverflow.com/a/27353758
tagged with: runnable
linked to: http://stackoverflow.com/q/7469316
has answer: http://stackoverflow.com/a/27405572
tagged with: classloader
type: AnsweredQuestion
has body: I've come to the conclusion after reading from many sources that using printStackTrace for error handling is bad practice. Here's one. Now I'm struck curious: in what cases is printing the stacktrace a valid solution? For the sake of the argument, let's assume we aren't working on a system such as a microwave or a banana, but a basic out-of-the-shelf PC. The reason I'm asking this could be seen as a question in itself, but I'll tell you about it anyhoo: I'm developing a snake-like game that can be played with AIs, and is intended for that purpose. All such AIs should extend an abstract class called SnakeLogic. All such AIs should also reside in their standalone .jar archives in a specific folder, from where the main program can find them and list them using classloaders. The user can then choose one of his/her AIs from a list, should all stars fall in line, and play a game with this AI. Now, I have a method in my main program that gets the next move from the AI like so: public void startGame(int speed) { gameInterface.showWindow(); Runnable moveCmd = () -&gt; { try { for (Player player : snakeGame.getPlayers()) { if (player.isDead()) { continue; } String move = player.getLogicHandler().getMove(); Direction direction = Direction.directionFromString(move); snakeGame.makeMove(player, direction); } gameInterface.getFrame().repaint(); snakeGame.wait(speed); if (snakeGame.gameOver()) { stopGame(); } } catch (Exception ex) { ex.printStackTrace(); stopGame(); } }; /* moveSchedule is an instance of ScheduledExecutorService */ moveSchedule.scheduleAtFixedRate(moveCmd, 1000, speed, TimeUnit.MILLISECONDS); } I'm not going to get too involved with the code above. I'd like to draw your attention to the try-catch statement, however. As you can see I print the stacktrace and end the game, should an exception occur somewhere during the execution of the moveCmd runnable. This is the source of my curiosity: If I don't print the stacktrace like this, or if I remove the try-catch entire…
tagged with: java

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

http://stackoverflow.com/a/27361762
has comment: http://stackoverflow.com/comment/43175911
upvote count: 1
has comment: http://stackoverflow.com/comment/43175711
downvote count: 1
score: 0
has comment: http://stackoverflow.com/comment/43175843
has comment: http://stackoverflow.com/comment/43175977
has comment: http://stackoverflow.com/comment/43175779
has body: Use iterator in your loops, in which you modify the collection you currently iterate over for(Iterator iter = active.iterator(); iter.hasNext();) { Player p = (Player)iter.next(); if(p.cur==1) { iter.remove(); System.out.println("Player "+p.name+" eliminated "); } }
has comment: http://stackoverflow.com/comment/43176104
type: Answer
answers question: http://stackoverflow.com/q/27361711

http://stackoverflow.com/q/27390114
has body: I am new at Maven and I recently created this program that requires multivaluedmap. Since I did not have jsr311-api.jar, I downloaded it from online, but I have no clue where to place them. I decided to upload it onto the apache-maven/lib folder and tried to run the program, but it did not work. This is the error that I get. Exception in thread "main" java.lang.NoClassDefFoundError: javax/ws/rs/core/Mul ivaluedMap at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Unknown Source) at java.lang.Class.privateGetMethodRecursive(Unknown Source) at java.lang.Class.getMethod0(Unknown Source) at java.lang.Class.getMethod(Unknown Source) at sun.launcher.LauncherHelper.validateMainClass(Unknown Source) at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source) Caused by: java.lang.ClassNotFoundException: javax.ws.rs.core.MultivaluedMap at java.net.URLClassLoader$1.run(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 7 more I assumed that I'm getting errors from misplacing the .jar file. Thank you in advance for your help. This is my pom file that I currently have: http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 com.test.api testing jar 0.1.0 testPlatform <source.version>1.7</source.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> org.apache.maven.plugins maven-compiler-plugin 3.1 1.7 1.7 junit junit 3.8.1 test org.glassfish.jersey.core jersey-client 2.9.1 javax.ws.rs jsr311-api 0.11 joda-time joda-time 2.3 com.google.code.gson gson 2.2.4
has answer: http://stackoverflow.com/a/27390406
tagged with: maven
type: Question
has comment: http://stackoverflow.com/comment/43233476
type: AnsweredQuestion
tagged with: java
tagged with: noclassdeffounderror
answer count: 2
accepted answer: http://stackoverflow.com/a/27390406
has comment: http://stackoverflow.com/comment/43228450
has comment: http://stackoverflow.com/comment/43228611
has comment: http://stackoverflow.com/comment/43228471
score: 0
possible better answer: http://stackoverflow.com/a/27393085
has title: java.lang.noclassdeffounderror for Maven
has answer: http://stackoverflow.com/a/27393085
has comment: http://stackoverflow.com/comment/43228185

maven
tags question: http://stackoverflow.com/q/27322376
tags question: http://stackoverflow.com/q/27314352
tags question: http://stackoverflow.com/q/27444683
tags question: http://stackoverflow.com/q/27473990
tags question: http://stackoverflow.com/q/27466940
tags question: http://stackoverflow.com/q/27385808
tags question: http://stackoverflow.com/q/27334839
type: Tag
tags question: http://stackoverflow.com/q/27362221
tags question: http://stackoverflow.com/q/27418523
tags question: http://stackoverflow.com/q/27317615
tags question: http://stackoverflow.com/q/27394176
tags question: http://stackoverflow.com/q/27361101
tags question: http://stackoverflow.com/q/27445269
tags question: http://stackoverflow.com/q/27336701
tags question: http://stackoverflow.com/q/27407414
tags question: http://stackoverflow.com/q/27388459
tags question: http://stackoverflow.com/q/27397367
tags question: http://stackoverflow.com/q/27467470
tags question: http://stackoverflow.com/q/27376939
tags question: http://stackoverflow.com/q/27415722
tags question: http://stackoverflow.com/q/27419360
tags question: http://stackoverflow.com/q/27391007
tags question: http://stackoverflow.com/q/27418451
tags question: http://stackoverflow.com/q/27458951
tags question: http://stackoverflow.com/q/27423657
tags question: http://stackoverflow.com/q/27337268
tags question: http://stackoverflow.com/q/27314197
tags question: http://stackoverflow.com/q/27377711
tags question: http://stackoverflow.com/q/27416218
tags question: http://stackoverflow.com/q/27382259
tags question: http://stackoverflow.com/q/27345679
tags question: http://stackoverflow.com/q/27352872
tags question: http://stackoverflow.com/q/27406044
tags question: http://stackoverflow.com/q/27387365
tags question: http://stackoverflow.com/q/27388111
tags question: http://stackoverflow.com/q/27316011
tags question: http://stackoverflow.com/q/27440926
tags question: http://stackoverflow.com/q/27427890
tags question: http://stackoverflow.com/q/27419257
tags question: http://stackoverflow.com/q/27377087
tags question: http://stackoverflow.com/q/27433642
tags question: http://stackoverflow.com/q/27457639
tags question: http://stackoverflow.com/q/27322053
tags question: http://stackoverflow.com/q/27430577
tags question: http://stackoverflow.com/q/27421838
tags question: http://stackoverflow.com/q/27426596
tags question: http://stackoverflow.com/q/27411136
tags question: http://stackoverflow.com/q/27323450
tags question: http://stackoverflow.com/q/27458177
tags question: http://stackoverflow.com/q/27394876
tags question: http://stackoverflow.com/q/27438236
tags question: http://stackoverflow.com/q/27367324
tags question: http://stackoverflow.com/q/27398053
tags question: http://stackoverflow.com/q/27466538
tags question: http://stackoverflow.com/q/27463057
tags question: http://stackoverflow.com/q/27331148
tags question: http://stackoverflow.com/q/27446428
tags question: http://stackoverflow.com/q/27439103
tags question: http://stackoverflow.com/q/27340830
tags question: http://stackoverflow.com/q/27454741
tags question: http://stackoverflow.com/q/27319495
tags question: http://stackoverflow.com/q/27361410
tags question: http://stackoverflow.com/q/27419037
tags question: http://stackoverflow.com/q/27413296
tags question: http://stackoverflow.com/q/27390704
tags question: http://stackoverflow.com/q/27342377
tags question: http://stackoverflow.com/q/27368199
tags question: http://stackoverflow.com/q/27470459
tags question: http://stackoverflow.com/q/27349189
tags question: http://stackoverflow.com/q/27418358
tags question: http://stackoverflow.com/q/27419175
tags question: http://stackoverflow.com/q/27460432
tags question: http://stackoverflow.com/q/27342154
tags question: http://stackoverflow.com/q/27409768
tags question: http://stackoverflow.com/q/27471190
tags question: http://stackoverflow.com/q/27345241
tags question: http://stackoverflow.com/q/27420956
tags question: http://stackoverflow.com/q/27351090
tags question: http://stackoverflow.com/q/27384033

http://stackoverflow.com/comment/43142637
has text: Sir, Joe, use hasmap.. okay.. let me know if you need codes
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27343246
type: QuestionComment

http://stackoverflow.com/q/27320251
accepted answer: http://stackoverflow.com/a/27320292
tagged with: swing
type: Question
has title: Re-colour JTable after sorting
has body: I have a JTable, each row is coloured based on a value in the last column. However, when i click the headers to sort the rows, the colours do not follow the rows. I have tried calling my "colourTable" method on the JTable Mouse Exit event (Hacky i know) - with no luck. Would someone be able to point me in the right direction? This is my JTable Where i tried calling the reColour method // If table headers are clicked for sorting, reset colours table.getTableHeader().addMouseListener(new java.awt.event.MouseAdapter() { @Override public void mouseExited(java.awt.event.MouseEvent evt) { Functions.colourTable(model, table); } }); Colour Method static void colourTable(TableModel model, JTable table) { table.setDefaultRenderer(Object.class, new StatusColumnCellRenderer()); } Column cell renderer class public class StatusColumnCellRenderer extends DefaultTableCellRenderer { @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) { Component comp = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col); // Get the mark value from the table (col 4) int mark = Integer.parseInt(table.getModel().getValueAt(row, 3).toString()); Color red = new Color(200, 44, 44); Color purple = new Color(163, 108, 223); Color green = new Color(36, 135, 44); // Fail if (mark &lt; 40) { comp.setBackground(red.brighter()); // Pass } else if (mark &gt;= 40) { // Distinction if (mark &gt;= 75) { comp.setBackground(purple.brighter()); } else { comp.setBackground(green.brighter()); } } else { comp.setBackground(null); } // Return the component return (comp); } }
tagged with: java
score: 0
has answer: http://stackoverflow.com/a/27320292
answer count: 1
tagged with: repaint
type: AnsweredQuestion

http://stackoverflow.com/q/27453701
tagged with: gwtquery
downvote count: 0
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27721281
tagged with: mgwt
type: AnsweredQuestion
score: 1
tagged with: java
has body: To bind events like click with GQuery you can do something like: @UiField Element myButton; ... $(myButton).on("click", new Function() { @Override public void f() { // event is triggered } } What I need is support for touch events like Tap as it was implemented in MGWT. In MGWT you can use a TouchPanel to get a tap event like this: @UiField TouchPanel panel; ... panel.addTapHandler(...); Edit: I need something like the following: @UiField Element myButton; ... $(myButton).on("tap", new Function() { @Override public void f() { // event is triggered } } Is there a way to bind a tap event with GQuery as it is done for the TouchPanel?
has title: How to bind Touch Events with GWTQuery?
upvote count: 1
type: Question
tagged with: gwt
tagged with: javascript
has answer: http://stackoverflow.com/a/27721281

http://stackoverflow.com/q/27451051
answer count: 1
tagged with: applet
has title: Applet access JDialog information
has body: I'm trying to obtain information in a JDialog that is opened by an applet. This applet is not developed by me and I don't have the source code. I can access this applet by JavaScript using the following: var aApp = document.applets[0]; var acApplet = aApp.getAccessibleContext(); I can access all controls inside the main applet, but when the applet trigger a dialog, I can't access the objects inside this dialog. I tried to find Components inside the applet and inside the JFrame that is the parent of this applet.
type: UnansweredQuestion
tagged with: swing
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27453827
tagged with: javascript
tagged with: awt
score: 0

http://stackoverflow.com/q/27453664
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/43346591
type: Question
has answer: http://stackoverflow.com/a/27453737
has comment: http://stackoverflow.com/comment/43346613
has comment: http://stackoverflow.com/comment/43346561
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43346332
has comment: http://stackoverflow.com/comment/43346379
has comment: http://stackoverflow.com/comment/43346647
favorite count: 0
has comment: http://stackoverflow.com/comment/43346610
has body: I am making a macro program. While CTRL mode is on, the program registers the mouse coordinates when the user clicks. CTRL mode is activated when "CTRL" is pressed and deactivated when it's pressed again. If deactivated, the program asks "Perform actions?" If the response is yes, the program click on the registered coordinates. I am now trying to make the program write if the user wrote something on CTRL mode. Is this possible? If so, how? Edit: My explanation was poor so i decided to add an example. EXAMPLE I active CTRL mode. Then click on notepad and write "hello". Then I deactivate CTRL and run the actions. The program would click on notepad and write "hello". I don't think you need this but here is the code: public class Gui extends JFrame { private JPanel mousePanel; private JLabel statusBar; private JLabel keyBar; public boolean ctrl; List&lt;Integer&gt; xList = new ArrayList&lt;Integer&gt;(); List&lt;Integer&gt; yList = new ArrayList&lt;Integer&gt;(); List&lt;KeyEvent&gt; charTyped = new ArrayList&lt;KeyEvent&gt;(); public int[] x; public int[] y; public Gui() { super("Program"); mousePanel = new JPanel(); mousePanel.setBackground(Color.WHITE); add(mousePanel, BorderLayout.CENTER); statusBar = new JLabel("No events"); keyBar = new JLabel("No key events"); add(keyBar, BorderLayout.NORTH);; add(statusBar, BorderLayout.SOUTH); HandlerClass handler = new HandlerClass(); mousePanel.addMouseListener(handler); mousePanel.addMouseMotionListener(handler); this.addKeyListener(handler); } public void Click(int x, int y) throws AWTException { Robot bot = new Robot(); bot.mouseMove(x, y); bot.mousePress(InputEvent.BUTTON1_MASK); bot.mouseRelease(InputEvent.BUTTON1_MASK); } private class HandlerClass implements MouseListener, MouseMotionListener, KeyListener { //Mouse Listener public void mouseClicked(MouseEvent event) { statusBar.setText(String.format("Clicked at %d, %d", event.getX(), event.getY())); if(ctrl) { xList.add(MouseInfo.getPointerInfo().getLocation().x); yLis…
accepted answer: http://stackoverflow.com/a/27453737
has title: How can i make my program write in another program?
has comment: http://stackoverflow.com/comment/43346636
has comment: http://stackoverflow.com/comment/43346578
linked to: http://stackoverflow.com/q/12177416
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43345635
score: 1
tagged with: java

http://stackoverflow.com/comment/43143630
type: Comment
has text: Can we see the code, that does the reading?
comment on: http://stackoverflow.com/q/27344004
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43207833
has text: @MarkoTopolnik please give me url about discouraging wait/notify. All I found about discouraging them was Thread.join javadoc, but its about discouraging them on Thread instances, not discouraging them in general.
comment on: http://stackoverflow.com/a/27378964
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43280283
comment on: http://stackoverflow.com/q/27417363
score: 0
type: Comment
has text: Actually I got the web service url from an excel-VB application and using it in a web application to check the feasibilty if I am able to send xml payload using ajax call. By disabling web security of chrome and without using any proxy, I am able to successfully send data to the server side. Right now I don't have any more details on the web service and error logs. The only thing I see is the data getting added through an web-UI whenever it is successful. No server log access shown in the web UI. :(
type: QuestionComment

http://stackoverflow.com/a/27378009
score: 6
upvote count: 6
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27377711
has body: Based on your comments, I would strongly recommend you declare your dependency on the ANTLR JAR in your POM. One of the primary benefits of using something like Maven is that you no longer need to link to physical JARs on your disk. Instead, you tell Maven you want to use ANTLR, with a statement such as: org.antlr antlr4 4.2 test Use tools such as http://mvnrepository.com/artifact/org.antlr/antlr4/4.2 to search for other JARs you need. It sounds like you need to read up about Maven. It's a really cool product, but you can't really start a project without some basic know-how.
type: Answer
accepted answer of: http://stackoverflow.com/q/27377711
downvote count: 0

http://stackoverflow.com/a/27725404
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27369269
has body: On Mac OS X Yosemite just install: Java SE Development Kit 8 and Java Version 8 Update 25 It's all, work for me too! like gehev said , so simple !
type: Answer

http://stackoverflow.com/comment/43342655
type: Comment
type: QuestionComment
has text: I am not a JTextPane expert, but if you're showing HTML, could using CSS style sheets help you wrap text? Again, I have no idea if this is possible or even if JTextPane's HTML editor kit supports this.
comment on: http://stackoverflow.com/q/27451491
score: 0

http://stackoverflow.com/comment/43275225
type: Comment
type: QuestionComment
has text: Is it for a testing device, or for user/market device?
score: 1
comment on: http://stackoverflow.com/q/27415434

http://stackoverflow.com/q/27391622
type: Question
has comment: http://stackoverflow.com/comment/43230987
has comment: http://stackoverflow.com/comment/43231585
score: 0
answer count: 1
tagged with: dependencies
has title: Didn't find class "android.support.v4.view.GridViewPager"
tagged with: android-support-library
type: UnansweredQuestion
tagged with: android
has body: I'm trying to put together a wearable app and I keep encountering the error Didn't find class "android.support.v4.view.GridViewPager". I'm also using android studio 1.0, and I can't find where to add a java build path. Here's what I have: dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:support-v4:20.0.0' compile 'com.google.android.support:wearable:1.0.0' compile 'com.google.android.gms:play-services-wearable:6.1.71' compile files('libs/support-v4-20.0.0-javadoc.jar') } I've looked around at a lot of problems similar to this, and most involve the support library. I have the support library installed and in my libs folder in the wear portion of my app, and I still get this error. Can anyone help?
tagged with: java
has answer: http://stackoverflow.com/a/27403283

http://stackoverflow.com/comment/43330425
comment on: http://stackoverflow.com/q/27427247
has text: Also, check your jar versions against the versions on the cluster. Many projects pull in different Hadoop versions by default, `gradle dependencies --configuration runtime` should give some clues
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27466538
tagged with: java
has answer: http://stackoverflow.com/a/27466999
type: Question
has comment: http://stackoverflow.com/comment/43369105
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27478738
has body: I have a project that has 2 applications (similar to a server and client) that both have the same core which contains methods to access a database and a configuration file. I need to be able to package both applications with minimal effort. It would also be helpful to work with all 'modules' in the same window of my IDE (I am using IntelliJ). Is a multi-module Maven project a good fit for this and if so how would you be able to package each module separately. Hopefully this makes it more clear of what I am trying to achieve:
type: UnansweredQuestion
tagged with: maven
has comment: http://stackoverflow.com/comment/43368967
has title: Compile JAR with core dependency

http://stackoverflow.com/q/27375810
tagged with: lotus-notes
tagged with: java
tagged with: stream
tagged with: eclipse
type: Question
has body: Hello Domino programmers! I work on a Java application using Notes classes. I wanted to use lotus.domino.Session object in order to create stream. I wanted to stream local computer files in order to embed them in a MIME field. However, though created stream is finally closed, I can't delete source of attached file. It looks like Notes is not closing stream correctly. Issue occurs even when I just open and close a stream, f.e. Stream stream = session.createStream(); stream.open(attachmentPath); stream.close(); stream.recycle(); // MORE CODE Document is locked till the end of main function. I have no idea what could be causing it, but in result it leaves some temp files, which can't be deleted through code. What could be cause of this issue? Any help will be appreciated! // I use 9.0 designer and 9.0 development server.
linked to: http://stackoverflow.com/q/12516858
score: 0
has title: lotus.domino.Stream locks files even after close()
has answer: http://stackoverflow.com/a/32488969
answer count: 1
has comment: http://stackoverflow.com/comment/43210450
type: UnansweredQuestion

http://stackoverflow.com/a/27364599
has comment: http://stackoverflow.com/comment/43181062
answers question: http://stackoverflow.com/q/27364562
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/43181031
downvote count: 0
has body: This while (loopagain=true) { is an assignment, and as a side-effect it evaluates to true. Use while (loopagain==true) { or while (loopagain) { Also, your if tests in the case(s) are pointless. That's what the switch tests.

http://stackoverflow.com/a/27368845
score: 1
upvote count: 1
downvote count: 0
type: Answer
has body: The musical scale is logarithmic (base-2): An increase in pitch of an octave doubles the fundamental frequency, and decrease of an octave halves it. In the western european music tradition, assuming equal temperament, we divide the octave into semitones. The frequencies of semitones form a geometric sequence whose ratio is ~1.06 (more precisely, it's the 12th root of 2 or pow(2, 1/12). Each semitone can be further divided into cents, yielding precisely 1200 per octave. Current musical practice is for A4 (the A above middle C) to be precisely 440Hz If you can't work out the maths from first principles, it's documented here.
answers question: http://stackoverflow.com/q/27357727

http://stackoverflow.com/a/29174954
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27430611
answers question: http://stackoverflow.com/q/27430611
has body: I am not sure that is even possible, to send object and to map properties of that object (maybe some dot notation but haven't check code or documentation). Maybe your notation would work if you work with UDT and you have Bean as UDT in DB. What works for sure is: @Accessor public interface TableAccessor { @Query( "INSERT INTO tableName " + "(id, data)" + "VALUES (:beanId, :beanData)") public ResultSet insertProblem(@Param("beanId") int beanId, @Param("beanData") Date beanData); And yhan you call method with insertProblem(bean.getBeanId(), bean.getBeanData())
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/a/27602971
has comment: http://stackoverflow.com/comment/43628257
score: 0
has comment: http://stackoverflow.com/comment/43628314
has comment: http://stackoverflow.com/comment/43628333
type: Answer
has comment: http://stackoverflow.com/comment/43628418
has comment: http://stackoverflow.com/comment/43628509
answers question: http://stackoverflow.com/q/27401933
has body: My suggestion is use subList You can follow these steps. Store all 81 values in a List (ArrayList) Then create 9 sub List from that using subList() You can convert List to array. List&lt;Integer&gt; fullList=new ArrayList&lt;&gt;(); List&lt;Integer&gt; list1=fullList.subList(0,8); // first 9 elements Integer[] bar = list1.toArray(new Integer[list1.size()]);

http://stackoverflow.com/q/27426389
type: Question
score: 2
downvote count: 0
answer count: 1
has title: How to NOT add HandlerMapping to Spring DispatchServlet
favorite count: 0
has body: I have a SpringMVC application. It has in it a custom class that extends DefaultAnnotationHandlerMapping. This class is used for some meta tools to generate reports and tools for use with the API of the MVC app. It is NOT needed to be used by the DispatchServlet. I am in the process of upgrading this system from Spring 3.2 to 4.1. One of the results of this upgrade is that the order of the HandlerMappers in the DispatchServlet changed. The custom class is now higher in priority than the RequestMappingHandlerMapping that we get the proper handler from. So my question is: Is there a way to ensure that the custom class NOT be added to the Dispatcher at all? I have not configured it to do so. I assume Spring is just picking it up because it is a HandlerMapping If not where is the best place to set the Order so I can push it lower. AbstractHandlerMapping has made the getter and setter for order final (So I can't override the getter). I attempted to set a low priority in the constructor of the custom class but apparently spring then resets it back to 0 later on.
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27426456
tagged with: spring
tagged with: spring-mvc
tagged with: java

http://stackoverflow.com/q/27430052
tagged with: unit-testing
has title: Jersey - How to mock service
tagged with: java
has answer: http://stackoverflow.com/a/27447345
type: Question
answer count: 2
tagged with: jersey
has comment: http://stackoverflow.com/comment/43329514
downvote count: 0
upvote count: 16
has answer: http://stackoverflow.com/a/32009541
has comment: http://stackoverflow.com/comment/43312758
has body: I am using "Jersey Test Framework" for unit testing my webservice. Here is my resource class : import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.Produces; // The Java class will be hosted at the URI path "/helloworld" @Path("/helloworld") public class class HelloWorldResource { private SomeService service; @GET @Produces("text/plain") public String getClichedMessage() { // Return some cliched textual content String responseFromSomeService = service.getSomething(); return responseFromSomeService; } } How can I mock SomeService in unit tests ?
has comment: http://stackoverflow.com/comment/43312168
tagged with: jax-rs
favorite count: 0
type: UnansweredQuestion
score: 16
tagged with: web-services

http://stackoverflow.com/q/27353063
score: 0
tagged with: jsoup
answer count: 1
has body: For example I store the two values in Array List Eaxmple link[0],link[1] and Commentslink[0] commentslink[1] and File name is Filewrite[0],Filewrite[1]. I want to retrieve Link[0] and Commentslink[0] write into Filewrite[0] I was storing the filename into Array List and I want retrieve the file name and write into a file using jsoup. How to use array list (object) file name to write the object value (Link) and (CommentsLink)? I want output like this: Filename to write head.txt Head, Shoulders, Knees and Toes | Popular Nursery Rhymes Collection for Kids | ChuChu TV Rhymes Zone All comments Filename to write twin.txt Twinkle Twinkle Little Star and Many More Videos | Popular Nursery Rhymes Collection by ChuChu TV All comments My code: ArrayList&lt;String&gt;link=new ArrayList&lt;String&gt;(); link.add("https://www.youtube.com/watch?v=hNcSKJQfrfM"); link.add("https://www.youtube.com/watch?v=Rj2QkLaaj2E"); ArrayList&lt;String&gt;commentslink=new ArrayList&lt;String&gt;(); commentslink.add("https://apis.google.com/u/0/wm/4/_/widget/render/comments?usegapi=1&amp;first_party_property=YOUTUBE&amp;href=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DhNcSKJQfrfM&amp;owner_id=BnZ16ahKA2DZ_T5W0FPUXg&amp;query=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DhNcSKJQfrfM&amp;stream_id=UCBnZ16ahKA2DZ_T5W0FPUXg&amp;substream_id=hNcSKJQfrfM&amp;view_type=FILTERED&amp;width=826&amp;youtube_video_acl=PUBLIC&amp;viewer_id=UCI7Gw-Kd1PkeBDQ7C33kN9A&amp;hl=en_US&amp;origin=https%3A%2F%2Fwww.youtube.com&amp;search=%3Fv%3DhNcSKJQfrfM&amp;hash=&amp;gsrc=1p&amp;jsh=m%3B%2F_%2Fscs%2Fabc-static%2F_%2Fjs%2Fk%3Dgapi.gapi.en.T4EayPRcrOA.O%2Fm%3D__features__%2Frt%3Dj%2Fd%3D1%2Frs%3DAItRSTOp4ORGjvVzLjTlu0PIOZx2FtcWuA#_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe%2C_renderstart%2Concircled%2Cdrefresh%2Cerefresh%2Confirsttimeplusonepromo%2Conthumbsup%2Contimestampclicked%2Conshareboxopen%2Conready%2Conallcommentsclicked&amp;id=I0_1418016584228&amp;parent=https%3A%2F%2Fwww.youtube.com&amp;pfname=&amp;…
has title: How to Retrieve the Array List Object(FileName) and Write the content Using Jsoup
has answer: http://stackoverflow.com/a/27353241
type: AnsweredQuestion
type: Question
accepted answer: http://stackoverflow.com/a/27353241
tagged with: java

http://stackoverflow.com/q/27452788
favorite count: 0
has title: Assign unique IDs to objects using Java 8 streams
upvote count: 6
tagged with: java-stream
has answer: http://stackoverflow.com/a/27452896
downvote count: 1
tagged with: java-8
type: Question
has answer: http://stackoverflow.com/a/27452840
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27452840
tagged with: java
possible better answer: http://stackoverflow.com/a/27452896
answer count: 2
score: 5
has body: static &lt;T&gt; Map&lt;T, Integer&gt; assignIds(Collection&lt;T&gt; objects); I want to write a function that takes a collection of unique objects and assigns a different ID number to each. The ID numbers should be assigned sequentially. I could easily do this with an explicit loop like: Map&lt;T, Integer&gt; ids = new HashMap&lt;&gt;(); int id = 0; for (T object: objects) { ids.put(object, id++); } Is there an elegant way to do this with the new Java 8 Stream API?

http://stackoverflow.com/q/27454727
tagged with: serialization
linked to: http://stackoverflow.com/q/5888754
linked to: http://stackoverflow.com/q/4064444
type: UnansweredQuestion
has body: well... i have a problem when i receive the string serialized , is something like a:1:{i:0;a:13:{s:2:"id";s:7:"1301087";s:6:"NOMBRE";s:12:"XxXxXx XXXXX";s:8:"XXXXXXXX";s:16:"XXXXXXX XXLLXXXX";s:4:"SEXO";s:1:"M";s:8:"XXXXXXXX";s:1:"P";s:7:"XXX_NAC";s:10:"1993-29-13";s:6:"DEPART";s:6:"XXXXXX";s:8:"DISTRITO";s:1:"0";s:4:"ZONA";s:4:"ENCA";s:5:"LOCAL";s:1:"8";s:4:"MESA";s:2:"20";s:5:"ORDEN";s:2:"42";s:6:"CEDULA";s:7:"2692282";}} in php before i serialize the object i have this Array ( [0] =&gt; Array ( [id] =&gt; 1301087 [NOMBRE] =&gt; XxXxXx XXXXX [XXXXXXXX] =&gt; P [SEXO] =&gt; M [XXX_NAC] =&gt; 1993-29-13 [DEPART] =&gt; XXXXXX [DISTRITO] =&gt; 0 [ZONA] =&gt; ENCA [LOCAL] =&gt; 8 [MESA] =&gt; 20 [ORDEN] =&gt; 42 [CEDULA] =&gt; 2692282 ) ) I need to use this array of arrays in my Android application, but I do not know how to retrieve the array to work with it in java PD: the info is sended with the header Content-type: text/plain and i already receive the string i need to convert it to array regards.
type: Question
tagged with: java
has title: serialized object from php to android view
score: 0
has comment: http://stackoverflow.com/comment/43354545
has comment: http://stackoverflow.com/comment/43347563
answer count: 1
has answer: http://stackoverflow.com/a/27458881
has comment: http://stackoverflow.com/comment/43348023

http://stackoverflow.com/comment/43167330
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27356919
type: Comment
has text: That's too sad. The only think that I will then investigate in your code is `Scanner` as I am not used to use/see it in android apps. And can be blamed for memory allocating. A fast search revealed this http://stackoverflow.com/a/24304955/944070. Good luck!

http://stackoverflow.com/a/27463795
type: Answer
accepted answer of: http://stackoverflow.com/q/27463631
score: 0
type: AcceptedAnswer
has body: I suggest you serialize the Vector as an ObjectOutputStream and use ObjectInputStream to get the original Vector. public static byte[] objectToBytes(Object o) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(o); oos.close(); return baos.toByteArray(); } to reverse public static &lt;T&gt; T bytesToObject(byte[] bytes) throws IOException, ClassNotFoundException { return (T) new ObjectInputStream(new ByteArrayInputStream(bytes)).readObject(); }
answers question: http://stackoverflow.com/q/27463631

http://stackoverflow.com/a/27354485
answers question: http://stackoverflow.com/q/27354312
has comment: http://stackoverflow.com/comment/43162144
has comment: http://stackoverflow.com/comment/43162064
score: 0
has body: One way to tackle the problem of identifying each key/value pair in each line would be to use regular expressions to find each pair in a line. The Java Tutorials on Regular Expressions provide a good, and fairly comprehensive, starting point on the topic. To get you started on this, the regular expression [A-Za-z]+: [0-9]+ will isolate each key-value pair for you, and a regular expression helper such as this web page at regexplanet.com will help greatly with testing and to start to identify the code you would need.
type: Answer
has comment: http://stackoverflow.com/comment/43162092

http://stackoverflow.com/comment/43142146
type: QuestionComment
type: Comment
has text: Create one data type class with array list and then define one search method inside the class to search for the keyword which would return the required data
comment on: http://stackoverflow.com/q/27343347
score: 0

http://stackoverflow.com/a/27327213
answers question: http://stackoverflow.com/q/27327011
type: Answer
has comment: http://stackoverflow.com/comment/43116513
has body: Your issue comes with the fact that your variable "line" is not changing his content and repeated in all your variables. Read all your lines into a collection or array and then proceeed. Something like this: int count = 0; String[] lines = new String[4]; String line; while ((line = bufferedReader.readLine()) != null) { lines[counter++] = line; } city = lines[0]; temp = lines[1]; // ....
has comment: http://stackoverflow.com/comment/43132062
score: 0

http://stackoverflow.com/q/27455679
has answer: http://stackoverflow.com/a/27455879
downvote count: 1
tagged with: network-programming
tagged with: server
has title: How to get IP's of all network devices in Java
tagged with: java
score: -1
type: Question
tagged with: ip
upvote count: 0
answer count: 1
has body: I'm working on a project, and basically I need this program to find a list of all connected IP addresses to a network, such as going to your network connections in Windows. I've looked all over the internet, and I cant find what I'm looking for and I hope someone can! This program cannot just crunch numbers (such as pinging all possible IP addresses), it needs to be faster than that. Being able to just connect to the network and obtain a "list" of all IP's that it can see would be perfect. Using the docs.oracle.com webpage did what it was supposed to, but there were too many extra results (including Eth10, etc). Also, the only IP address it listed that wasnt my own didnt match any active computers, so I dont know what was up with that... (192.168.0.9 was listed, the only other active connection was at 192.168.0.10, maybe I'm missing something?). What is a way to do this? Sorry if I'm unclear, I'm able to be clearer if there's something specific, hope this helps! Thanks! EDIT: I hope this helps; I want to do this in java, because for my designed program to work it needs a list of active IP addresses connectable to the active machine. Meaning that if I run it on a laptop at a school, I need all the IP addresses that I could connect to on the network. It is a network thing, but it does need to be done in java. The purpose is for a file manager, otherwise its pretty tough to explain. Does that help?
has comment: http://stackoverflow.com/comment/43349098
tagged with: connection
favorite count: 0
has comment: http://stackoverflow.com/comment/43349083
has comment: http://stackoverflow.com/comment/43349095
type: UnansweredQuestion

http://stackoverflow.com/comment/43166702
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27357035
has text: It is passed as a string parameter in venuesSearch method of foursquare api. I don't get an error, but the result has nothing inside. The result code is 200 (result.getMeta().getCode() == 200), and it is supposed to have result.getResult().getVenues() but this is empty.
score: 0

http://stackoverflow.com/q/27362499
has comment: http://stackoverflow.com/comment/43193438
has comment: http://stackoverflow.com/comment/43237373
type: Question
has comment: http://stackoverflow.com/comment/43187772
has comment: http://stackoverflow.com/comment/43193416
has comment: http://stackoverflow.com/comment/43185818
has comment: http://stackoverflow.com/comment/43224743
has title: Java file moving/copying using the FILE class
has answer: http://stackoverflow.com/a/27395698
answer count: 1
downvote count: 0
has body: I am a relatively novice programmer who can code in HTML, Python, and Java, and I decided to challenged myself to write a block of Java code(using JCreator). I came up with the following challenge: Design a program in which it would take a .exe file, copy it to a folder (which could be easily changed though a variable), run the file, then delete the file, then continue to do the same process throughout every sub-folder in that directory I proceeded to write the program, and got the parts of the program to run the exe and to find all of the sub-directories working (with help from stack-overflow, of course). I put all of them together, in addition to the part to copy the .exe file using Files.copy. Every time I run the program, it returns an error. Part of my code to copy the file, run it, then delete it. I use variables such as "location" and "destination" to allow for easy expansion to the program, and these variables are defined earlier in the program public static void EXETestGo(final File folder){ String destination = folder.getAbsolutePath(); //place to move the exe file; changes each time that the method is called String location = "C:/file.exe"; //origin of the exe file String runLocation = destination + "/" + "file.exe"; //place of the moved exe file | try{ Files.copy(location, destination, REPLACE_EXISTING); Runtime r = Runtime.getRuntime(); //These two combined Process p = r.exec(runLocation); //'runs' the exe file deleteIfExists(runLocation); //deleates file }catch(IOException ex){ //catches the failed process if it fails System.out.println (ex.toString()); //prints out the problem System.out.println("Error 404"); } Both of these pieces of code are from/used in the same method, so there should not be any problems regarding local variables and whatnot Any feedback/help would be greatly appreciated! EDIT: After being run, it returns the "cannot find symbol" error EDIT #2: I realize that I did not include my imports, which my be the source of the problem My i…
favorite count: 0
has comment: http://stackoverflow.com/comment/43224967
has comment: http://stackoverflow.com/comment/43177108
has comment: http://stackoverflow.com/comment/43225758
has comment: http://stackoverflow.com/comment/43230337
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27395698
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/25706216
has comment: http://stackoverflow.com/comment/43227675
upvote count: 1

http://stackoverflow.com/comment/43154240
has text: The main problem I am having is that the board is printing out all of the rows, but it is only printing out half of the columns. I don't know why only half of the columns are printing out.
type: QuestionComment
comment on: http://stackoverflow.com/q/27349560
score: 0
type: Comment

http://stackoverflow.com/q/27385961
has body: I made multiple apps and never got stuck on this but, I can't see any image. In eclipse i used the imageview, and nothing when running the app in the emulator or on my Xperia Z. Even tried just setting it as android:background. Didn't work either.. Also tried to change in the ImageView the src line to background and didn't work either. Also tried using a different image and nothing. The only image that works is the ic_launcher. By the way i also deleted the whole project on eclipse and recreating it + reinstalling eclipse multiple times. Both didn't work! So if anyone has a idea i would love to hear it because this really sucks. Splash Activity &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".Splash" &gt; &lt;ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:background="@drawable/sl" /&gt; &lt;/RelativeLayout&gt; Splash.java package com.skatelogic; import com.skatelogic.Main; import com.skatelogic.R; import android.os.Bundle; import android.app.Activity; import android.content.Intent; import android.view.Menu; public class Splash extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_splash); Thread splash_screen = new Thread(){ public void run(){ try{ sleep(2000); }catch(Exception e){ e.printStackTrace(); }finally{ startActivity(new Intent(getApplicationContext(),Main.class)); finish(); } } }; splash_screen.start(); } @Override public boolean onCre…
score: 0
has comment: http://stackoverflow.com/comment/43222495
has answer: http://stackoverflow.com/a/27387442
has comment: http://stackoverflow.com/comment/43222553
tagged with: android
has title: Image not shown on Emulator/Device? Eclipse Android
has comment: http://stackoverflow.com/comment/43220666
type: UnansweredQuestion
tagged with: java
tagged with: eclipse
has answer: http://stackoverflow.com/a/38554560
type: Question
answer count: 2
tagged with: imageview

http://stackoverflow.com/a/27403862
has body: This might be your answer as you did not describe your problem in deep. import java.io.IOException; import java.io.PrintWriter; import java.util.Calendar; import java.util.GregorianCalendar; public class Test extends HttpServlet { // Method to handle GET method request. public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //declaring custom object Person person = new Person("FirstName","LastName"); PrintWriter out = response.getWriter(); out.print(person); } // Method to handle POST method request. public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { doGet(request, response); } }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27398768

drop-down-menu
tags question: http://stackoverflow.com/q/27400901
tags question: http://stackoverflow.com/q/27442800
type: Tag
tag name: drop-down-menu
tags question: http://stackoverflow.com/q/27447430

http://stackoverflow.com/q/27361309
has comment: http://stackoverflow.com/comment/43256056
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43180488
has comment: http://stackoverflow.com/comment/43174742
downvote count: 0
has comment: http://stackoverflow.com/comment/43180027
has comment: http://stackoverflow.com/comment/43246920
favorite count: 0
has comment: http://stackoverflow.com/comment/43179508
score: 2
upvote count: 2
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/43244578
has comment: http://stackoverflow.com/comment/43248452
has comment: http://stackoverflow.com/comment/43175223
has body: I have stumbled on a weird issue with graphics drawRect - it adds two extra pixels at the bottom left and bottom right of the rectangular shape. Is this a VM problem? or something in my understanding is wrong? I am running this on windows 8.1 64bit java SE 1.8.0_25. EDIT: I have edited the code to do proper override of paintComponent. Also I have noticed that when the window first appears, I do see the content as in the attached screenshot (with the extra pixels), but when I resize it to a smaller window and back (thus forcing the EDT to repaint the whole panel again) - the pixels vanish and do not reappear in subsequent window resizing. I Even added fillRect to minimize the effect of artifacts (if any), but still, to no avail. I don't know what to make of it. EDIT 2: SSCCE modified to run from EDT - still same results import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.SwingUtilities; public class GuiTest extends JFrame { public GuiTest() { super( "Test" ); setContentPane( new MyPanel() ); setSize( new Dimension( 200, 200 ) ); setVisible( true ); } public static void main( String[] args ) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { new GuiTest(); } } ); } class MyPanel extends JPanel { @Override protected void paintComponent( Graphics g ) { super.paintComponent( g ); g.setColor( Color.WHITE ); g.fillRect( 0, 0, getWidth(), getHeight() ); g.setColor( Color.BLACK ); g.drawRect( 10, 10, 100, 100 ); } } }
tagged with: java
has answer: http://stackoverflow.com/a/27688219
has answer: http://stackoverflow.com/a/61461595
has title: Java swing weird extra pixels in drawRect
has comment: http://stackoverflow.com/comment/43176188

http://stackoverflow.com/comment/47864206
type: Comment
comment on: http://stackoverflow.com/a/29792668
score: 0
type: AnswerComment
has text: I've updated my answer with another possible solution :)

http://stackoverflow.com/q/27426724
possible better answer: http://stackoverflow.com/a/27426969
has answer: http://stackoverflow.com/a/27426969
tagged with: java
tagged with: mysql
has title: SQL Query throws exception
answer count: 2
has comment: http://stackoverflow.com/comment/43295490
has answer: http://stackoverflow.com/a/27426915
has body: I wrote the following code snipped with a SQL query which gets me the storeID of a particular store in the DB: private int inDB(String storename, String phone, int zipcode) { try { String select = "SELECT storeID FROM Store WHERE storename = ? OR phone = ? AND City_zipcode = ?;"; PreparedStatement pst = dbc.prepareStatement(select); pst.setString(1, storename); pst.setString(2, phone); pst.setInt(3, zipcode); ResultSet rs = pst.executeQuery(select); while(rs.next()) { return rs.getInt("storeID"); } } catch (Exception e) { e.printStackTrace(); } return -1; } Unfortunately this code throws a massive exception... And I try to figure out for a while whats the problem. com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? OR phone = ? AND City_zipcode = ?' at line 1 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 com.mysql.jdbc.Util.handleNewInstance(Util.java:377) at com.mysql.jdbc.Util.getInstance(Util.java:360) at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:978) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3887) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3823) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2526) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2484) at com.mysql.jdbc.StatementImpl.executeQuery(StatementImpl.java:1446) at db.Store.inDB(Store.java:297) As you can see, I'm using the MySQL db driver. All the other methods which are nearly the same ar…
has comment: http://stackoverflow.com/comment/43295269
score: 0
has comment: http://stackoverflow.com/comment/43295330
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27426915
type: Question

http://stackoverflow.com/a/27364179
answers question: http://stackoverflow.com/q/27363096
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: The problem is that StrongTextEncryptor uses StandardPBEStringEncryptor which in turn uses Base64 to encode the ciphertexts. The problem is that Base64 has a / character which is not URL-safe. When you try to decrypt, the parameter parser that you use probably drops those / characters which makes the ciphertext incomplete. The easiest solution is probably to change the offending characters with replace all: myEncryptedParam.replaceAll("/", "_").replaceAll("\\+", "-"); and back again before you try to decrypt: receivedParam.replaceAll("_", "/").replaceAll("-", "\\+"); This transforms the encoding from the normal Base64 encoding to the "URL and Filename safe" Base 64 alphabet.
type: Answer
score: 4
accepted answer of: http://stackoverflow.com/q/27363096

http://stackoverflow.com/a/27369159
accepted answer of: http://stackoverflow.com/q/27368525
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/69382849
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27368525
type: Answer
has comment: http://stackoverflow.com/comment/75152205
has comment: http://stackoverflow.com/comment/69407493
has body: Make an intent to the first activity in the stack and finish the current activity: Intent intent = new Intent(this, FirstActivity.class); intent.putExtra(EXTRA_FINISH, true); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); finish(); And, in the onResume method of the FirstActivity, something like this to finish the last activity in the stack (and hopefully removing the app from the recent apps list): if (getExtras() != null &amp;&amp; getIntentExtra(EXTRA_FINISH, false)) { finish(); }

http://stackoverflow.com/comment/43195251
type: AnswerComment
comment on: http://stackoverflow.com/a/27371748
has text: i removed 'JSONParser' class but 'JSONObject json = jParser.makeHttpRequest(url_all_products, "GET", params);' i m using url_all_products, other argument for further work to get display of information can u please tell me how to use these argument in your code
type: Comment
score: 0

http://stackoverflow.com/q/27422651
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43288004
has title: Log4j2 in a Unix environment
tagged with: log4j2
score: 1
tagged with: java
upvote count: 1
tagged with: classpath
type: Question
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27423449
has body: I have made a project in which I am creating logs with log4j2.xml. My configuration file works perfectly when I am running it in the eclipse of my windows system. Here is the configuration file which I have used to create the log files. <?xml version="1.0" encoding="UTF-8" standalone="no"?> /home/apps/ora_fin/IGL75D/Disco/splunk/log <ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL"/> <ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/> <ThresholdFilter level="fatal" onMatch="DENY" onMismatch="NEUTRAL"/> <ThresholdFilter level="INFO" onMatch="ACCEPT" onMismatch="DENY"/> %d{yyyy-MM-dd HH:mm:ss.SSS} - %msg%n <TimeBasedTriggeringPolicy interval="1" modulate="true"/> <ThresholdFilter level="info" onMatch="DENY" onMismatch="NEUTRAL"/> <ThresholdFilter level="fatal" onMatch="ACCEPT" onMismatch="NEUTRAL"/> <ThresholdFilter level="TRACE" onMatch="ACCEPT" onMismatch="DENY"/> <ThresholdFilter level="ERROR" onMatch="ACCEPT" onMismatch="DENY"/> <ThresholdFilter level="DEBUG" onMatch="ACCEPT" onMismatch="DENY"/> <ThresholdFilter level="FATAL" onMatch="ACCEPT" onMismatch="DENY"/> [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n <SizeBasedTriggeringPolicy size="1 MB"/> <AppenderRef ref="info-log"/> <AppenderRef ref="trace-log"/> This configuration file I have put under the src folder in my project and is picked up without any issues. However I need to deploy the application in the Unix environment, where should I put the configuration file in unix environment so that it is picked up by the java class to log ?? Thanks!
has comment: http://stackoverflow.com/comment/43288489
has answer: http://stackoverflow.com/a/27433501
tagged with: unix
favorite count: 0

http://stackoverflow.com/a/35724436
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27361538
upvote count: 2
type: Answer
has body: I am using the following code to print diffs between two commits. Using DiffFormatter.scan seems simpler than the other solutions I have seen on SO. It might be that I am missing some case(s) where this is not supported, but it works fine for our use case. public static void main(String[] args) throws Exception { Repository repository = new FileRepositoryBuilder() .setGitDir(new File("c:/temp/jgit-test/.git")).build(); // Here we get the head commit and it's first parent. // Adjust to your needs to locate the proper commits. RevCommit headCommit = getHeadCommit(repository); RevCommit diffWith = headCommit.getParent(0); FileOutputStream stdout = new FileOutputStream(FileDescriptor.out); try (DiffFormatter diffFormatter = new DiffFormatter(stdout)) { diffFormatter.setRepository(repository); for (DiffEntry entry : diffFormatter.scan(diffWith, headCommit)) { diffFormatter.format(diffFormatter.toFileHeader(entry)); } } } private static RevCommit getHeadCommit(Repository repository) throws Exception { try (Git git = new Git(repository)) { Iterable&lt;RevCommit&gt; history = git.log().setMaxCount(1).call(); return history.iterator().next(); } }

eclipse
tags question: http://stackoverflow.com/q/27380954
tags question: http://stackoverflow.com/q/27382921
tags question: http://stackoverflow.com/q/27334965
tags question: http://stackoverflow.com/q/27394147
tag name: eclipse
tags question: http://stackoverflow.com/q/27380640
tags question: http://stackoverflow.com/q/27321013
tags question: http://stackoverflow.com/q/27363178
tags question: http://stackoverflow.com/q/27470845
tags question: http://stackoverflow.com/q/27371621
tags question: http://stackoverflow.com/q/27365186
tags question: http://stackoverflow.com/q/27350353
tags question: http://stackoverflow.com/q/27389348
tags question: http://stackoverflow.com/q/27469802
tags question: http://stackoverflow.com/q/27473045
tags question: http://stackoverflow.com/q/27356658
tags question: http://stackoverflow.com/q/27434176
tags question: http://stackoverflow.com/q/27315699
tags question: http://stackoverflow.com/q/27375174
tags question: http://stackoverflow.com/q/27370757
tags question: http://stackoverflow.com/q/27447077
tags question: http://stackoverflow.com/q/27450663
tags question: http://stackoverflow.com/q/27389900
tags question: http://stackoverflow.com/q/27388713
tags question: http://stackoverflow.com/q/27405679
tags question: http://stackoverflow.com/q/27440029
tags question: http://stackoverflow.com/q/27440540
tags question: http://stackoverflow.com/q/27357092
tags question: http://stackoverflow.com/q/27404824
tags question: http://stackoverflow.com/q/27375644
tags question: http://stackoverflow.com/q/27420787
tags question: http://stackoverflow.com/q/27471696
tags question: http://stackoverflow.com/q/27426450
tags question: http://stackoverflow.com/q/27335077
tags question: http://stackoverflow.com/q/27396288
tags question: http://stackoverflow.com/q/27354895
tags question: http://stackoverflow.com/q/27383093
tags question: http://stackoverflow.com/q/27384933
tags question: http://stackoverflow.com/q/27330592
tags question: http://stackoverflow.com/q/27377808
tags question: http://stackoverflow.com/q/27330319
tags question: http://stackoverflow.com/q/27404920
tags question: http://stackoverflow.com/q/27405988
tags question: http://stackoverflow.com/q/27453400
tags question: http://stackoverflow.com/q/27387573
tags question: http://stackoverflow.com/q/27433467
tags question: http://stackoverflow.com/q/27355540
tags question: http://stackoverflow.com/q/27371413
tags question: http://stackoverflow.com/q/27369772
tags question: http://stackoverflow.com/q/27410702
tags question: http://stackoverflow.com/q/27411798
tags question: http://stackoverflow.com/q/27473990
tags question: http://stackoverflow.com/q/27332328
tags question: http://stackoverflow.com/q/27380381
tags question: http://stackoverflow.com/q/27433154
tags question: http://stackoverflow.com/q/27455476
tags question: http://stackoverflow.com/q/27355003
tags question: http://stackoverflow.com/q/27388538
tags question: http://stackoverflow.com/q/27346237
tags question: http://stackoverflow.com/q/27318242
tags question: http://stackoverflow.com/q/27389990
tags question: http://stackoverflow.com/q/27418247
tags question: http://stackoverflow.com/q/27341329
tags question: http://stackoverflow.com/q/27315809
tags question: http://stackoverflow.com/q/27437201
tags question: http://stackoverflow.com/q/27359930
tags question: http://stackoverflow.com/q/27458695
tags question: http://stackoverflow.com/q/27386327
tags question: http://stackoverflow.com/q/27322756
tags question: http://stackoverflow.com/q/27385818
tags question: http://stackoverflow.com/q/27461325
tags question: http://stackoverflow.com/q/27441300
tags question: http://stackoverflow.com/q/27448990
tags question: http://stackoverflow.com/q/27412682
tags question: http://stackoverflow.com/q/27337039
tags question: http://stackoverflow.com/q/27455392
tags question: http://stackoverflow.com/q/27364446
tags question: http://stackoverflow.com/q/27363668
tags question: http://stackoverflow.com/q/27376032
tags question: http://stackoverflow.com/q/27329474

http://stackoverflow.com/q/27422460
favorite count: 0
possible better answer: http://stackoverflow.com/a/27422523
has answer: http://stackoverflow.com/a/27422523
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27422998
has title: Java: Generic collection for holding primitives of different types
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27423434
upvote count: 1
tagged with: collections
type: Question
has body: This may be a stupid question, but is there a type of collection in Java that will hold primitives of varying type? I'm currently creating a method that formats two types of objects, and I'm attempting to store the parameters in arrays as a means of avoiding a method with ten+ parameters, instead using two arrays to hold the values and pass them in instead. The types will be a combination of Strings, ints and booleans.
accepted answer: http://stackoverflow.com/a/27422998
answer count: 3
downvote count: 0
tagged with: generics

http://stackoverflow.com/q/27362818
type: UnansweredQuestion
tagged with: android
has title: Modular Android Applications
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43199382
has comment: http://stackoverflow.com/comment/43181798
score: 0
has body: I am developing an Android application which needs to be dynamic depending on a users account settings in a separate web application. Are there development techniques, patterns etc which are alternatives to simply using an abundance of "if" statements to handle enabled features? For example, subsidiaries are a feature. If this is enabled, then this affects the workflow of the application. However if this is not enabled that application needs to work differently. I understand that this question is extremely broad. Thanks in advance
has comment: http://stackoverflow.com/comment/43258607

http://stackoverflow.com/q/27330314
tagged with: jpa-2.0
has answer: http://stackoverflow.com/a/27330386
score: 0
has body: I have the following class structure public class Emp implements java.io.Serializable { .... } public interface EmployeeDAO { public List&lt;Emp&gt; findAllEmployees(); } public class EmployeeDAOImpl implements EmployeeDAO { public List&lt;Emp&gt; findAllEmployees() { CriteriaQuery cq = getEntityManager().getCriteriaBuilder().createQuery(); cq.select(cq.from(Emp.class)); return getEntityManager().createQuery(cq).getResultList(); } ... } Issue I am having is return getEntityManager().createQuery(cq).getResultList(); The above line gives me the following error, what could be the reason for this? incompatible types; found: interface java.util.List&lt;java.lang.Object&gt;, required: interface java.util.List&lt;test.entity.Emp&gt; The same code works in other higher version of Java. My current JDK is 1.6
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27330386
type: Question
tagged with: jpa
answer count: 1
has title: Incompatible types; found: interface java.util.List<java.lang.Object>, required: interface java.util.List<test.entity.Emp>

http://stackoverflow.com/comment/43124564
has text: @Frakcool `What if we want the checkBox on the middle.` Agreed the documentation is not very good and the layout is not that intuitive. Basically you need to play with the `setAlignmentX()` property. I think you need to change the alignment of both components to be 0.5f. I can only get it to work by trial and error.
comment on: http://stackoverflow.com/a/27333258
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27358576
accepted answer: http://stackoverflow.com/a/27375927
possible better answer: http://stackoverflow.com/a/27358924
favorite count: 0
has comment: http://stackoverflow.com/comment/43169798
tagged with: tablemodel
has comment: http://stackoverflow.com/comment/43170550
upvote count: 2
has answer: http://stackoverflow.com/a/27375927
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: database
tagged with: mysql
has comment: http://stackoverflow.com/comment/43169642
has answer: http://stackoverflow.com/a/27358924
has comment: http://stackoverflow.com/comment/43169845
type: Question
answer count: 2
downvote count: 0
has body: I am running a query on ID column but I don't want it to be visible in my frame/pane. How can I achieve this? Shall I make another table, is there a function in sql/mysql which allows to hide columns? I tried to google it but havent found anything yet. Here is the code: public void tableChanged(TableModelEvent e) { int row = e.getFirstRow(); int col = e.getColumn(); model = (MyTableModel) e.getSource(); String stulpPav = model.getColumnName(col); Object data = model.getValueAt(row, col); Object studId = model.getValueAt(row, 0); System.out.println("tableChanded works"); try { new ImportData(stulpPav, data, studId); } catch (ClassNotFoundException e1) { e1.printStackTrace(); } catch (SQLException e1) { e1.printStackTrace(); } } public class ImportData { Connection connection = TableWithBottomLine.getConnection(); public ImportData(String a, Object b, Object c) throws ClassNotFoundException, SQLException { Statement stmt = null; try { String stulpPav = a; String duom = b.toString(); String studId = c.toString(); System.out.println(duom); connection.setAutoCommit(false); stmt = connection.createStatement(); stmt.addBatch("update finance.fin set " + stulpPav + " = " + duom + " where ID = " + studId + ";"); stmt.executeBatch(); connection.commit(); } catch (BatchUpdateException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } finally { if (stmt != null) stmt.close(); connection.setAutoCommit(true); System.out.println("Data was imported to database"); } } } public class MyTableModel extends AbstractTableModel{ int rowCount; Object data [][]; String columnNames []; public MyTableModel() throws SQLException{ String query ="SELECT ID, tbl_Date as Date, Flat, Mobile, Food, Alcohol, Transport, Outdoor, Pauls_stuff, Income, Stuff FROM finance.fin"; ResultSet rs ; Connection connection = TableWithBottomLine.getConnection(); Statement stmt = null; stmt = connection.createStatement(); rs = stmt.executeQuery(query); rs.last(); rowCount = rs.getRow(); data…
tagged with: jtable
has title: How to make one mySQL's table column invisible

http://stackoverflow.com/comment/43310769
type: Comment
type: QuestionComment
has text: Get rid of your `start` method, it's not how a `Thread` should be started. Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem. This will result in less confusion and better responses
score: 1
comment on: http://stackoverflow.com/q/27434943

http://stackoverflow.com/comment/43092680
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27315809
has text: Press Ctrl + 3 Write "Servers" - then a view will activate, that's the important view, or the Modules part from the screenshot you just sent. You should be able to add to modules your both projects.

http://stackoverflow.com/comment/43207985
type: AnswerComment
type: Comment
score: 1
has text: @LightnessRacesinOrbit You make a good point, but since this question is marked Java, how about `char number = 5; System.out.println(+number);`
comment on: http://stackoverflow.com/a/27371089

http://stackoverflow.com/comment/43252802
comment on: http://stackoverflow.com/a/27382418
score: 0
type: AnswerComment
type: Comment
has text: Thanks! But okay, when I go to the project properties, and then the java build path, the only jar that comes up is the appcombat7. How do i access the support jars out of the lib? I have the Android Private Library and Dependencies, but neither have a drop down list.

http://stackoverflow.com/comment/43348484
score: 0
type: Comment
type: QuestionComment
has text: Sure, you could run under an admin or system account. But i'd bet your app is not special enough for an admin or knowledgeable power user to overlook the gaping security hole they'd be opening up by doing so.
comment on: http://stackoverflow.com/q/27455315

http://stackoverflow.com/comment/43163818
type: QuestionComment
comment on: http://stackoverflow.com/q/27354320
type: Comment
score: 1
has text: Well I am not aware of how you achieve it in ffmpeg. But, just this might be of some help. [Here is a list of codecs which are supported by JavaFX Media currently](https://docs.oracle.com/javafx/2/api/javafx/scene/media/package-summary.html#SupportedMediaTypes)

http://stackoverflow.com/comment/43096991
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27317214
has text: no error, it just get stuck, like if it was in an infinite loop

http://stackoverflow.com/q/27468430
possible better answer: http://stackoverflow.com/a/27468471
type: Question
has comment: http://stackoverflow.com/comment/43372119
has answer: http://stackoverflow.com/a/27468471
has answer: http://stackoverflow.com/a/27468479
accepted answer: http://stackoverflow.com/a/27468444
has comment: http://stackoverflow.com/comment/43372153
has body: As I know == basically compares memory location, So I totally understand that line 1 is returning true. But we have not overridden the equal method in class , then why line 2 is returning true? private String category = "procedura1"; public static void main(String[] args) { Lang obj1 = new Lang(); Lang obj2 = new Lang(); if (obj1.category == obj2.category) { /// Line 1 System.out.println("Equal"); } else { System.out.println("Not equal"); } if (obj1.category.equals(obj2.category)) { /// Line 2 System.out.println("Equal"); } else { System.out.println("Not equal"); } } And Why line 3 of following returning false? String a1 = new String("String 1"); String a2 = new String("String 1"); if (a1 == a2) { // Line 3 System.out.println("True"); } else { System.out.println("False"); } if (a1.equals(a2)) { System.out.println("True"); } else { System.out.println("False"); }
has comment: http://stackoverflow.com/comment/43372198
answer count: 4
downvote count: 4
favorite count: 0
upvote count: 0
has answer: http://stackoverflow.com/a/27468569
has answer: http://stackoverflow.com/a/27468444
score: -4
type: AnsweredQuestion
has title: Java equal vs == (String Instance Variable)
tagged with: java
duplicate of: http://stackoverflow.com/q/513832

http://stackoverflow.com/comment/43345687
comment on: http://stackoverflow.com/a/27453593
type: AnswerComment
score: 0
type: Comment
has text: Take a look at this about returning values in methods https://docs.oracle.com/javase/tutorial/java/javaOO/returnvalue.html

http://stackoverflow.com/comment/43299939
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27428431
type: Comment
has text: Updated my answer. In theory it should work as you want, but I will admit I haven't tried it.

http://stackoverflow.com/comment/43119229
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27322052
type: Comment
has text: Usually, when you only care about running Java programs on your browser or computer you will only install JRE. It's all you need. On the other hand, if you are planning to do some Java programming, you will also need JDK.Sometimes, even though you are not planning to do any Java Development on a computer, you still need the JDK installed,for deploying web apps!So go for JDK to add on RAM disk ,it will be helpful. Thank you.

http://stackoverflow.com/comment/43332286
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27433696
type: QuestionComment
has text: @Zymus try to implement the factory when using generics in the GuitarTunignService and see the problem for yourself.

http://stackoverflow.com/q/27372736
has comment: http://stackoverflow.com/comment/43196632
type: Question
possible better answer: http://stackoverflow.com/a/27372838
score: 0
has answer: http://stackoverflow.com/a/27372838
answer count: 3
has body: Hi have error The constructor Intent(new View.OnClickListener(){}, Class) is undefined, I'm created the Util class in that class create popup layout in that layout screen logout, chanage password like created textview that text view onClick i have to call the another activity. that time its showing this error. public class Util { public static void initPopWindow(Activity a, Button button) { final Context context = a; // popupWindow View contentView = LayoutInflater.from(a).inflate(R.layout.my_list, null); // popupWindow contentView.setBackgroundColor(Color.LTGRAY); popupWindow = new PopupWindow(contentView, 340, 249, true); contentView.setFocusableInTouchMode(true); popupWindow.setBackgroundDrawable(new BitmapDrawable()); popupWindow.showAtLocation(button, Gravity.TOP|Gravity.RIGHT, 2, 127); change_passwrod_activity.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub startActivity((new Intent(this, ChangePasswordActivity.class))); } }); } } main Activity call public void onSetting(View v) { Util.initPopWindow(this, menubutton) }
accepted answer: http://stackoverflow.com/a/27372815
tagged with: android
has answer: http://stackoverflow.com/a/27372815
has comment: http://stackoverflow.com/comment/43197180
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27373251
has title: The constructor Intent(new View.OnClickListener(){}, Class<ChangePasswordActivity>) is undefined

http://stackoverflow.com/a/27458328
has comment: http://stackoverflow.com/comment/43354260
has comment: http://stackoverflow.com/comment/43353729
has comment: http://stackoverflow.com/comment/43354235
answers question: http://stackoverflow.com/q/27458297
score: 0
has body: you need to use pst.executeUpdate rather then pst.executeQuery
type: Answer
has comment: http://stackoverflow.com/comment/43354431

http://stackoverflow.com/q/27416834
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/56236821
has answer: http://stackoverflow.com/a/39844764
has answer: http://stackoverflow.com/a/47809353
tagged with: android-5.0-lollipop
type: Question
score: 92
has answer: http://stackoverflow.com/a/28183156
has answer: http://stackoverflow.com/a/28708981
tagged with: android-layout
has answer: http://stackoverflow.com/a/61739691
has answer: http://stackoverflow.com/a/53005806
possible better answer: http://stackoverflow.com/a/27749235
has answer: http://stackoverflow.com/a/56234868
has body: I'm trying to mess with the new RecyclerView and whenever I try to run it, my app immediately crashes. It gives me NullPointerException for trying to access methods from android.support.v7.widget.RecyclerView. I've looked at other posts and saw that most people didn't have compile 'com.android.support:recyclerview-v7:+' but I tried that and it hasn't helped at all. Not really sure what to do at this point, any help would be appreciated. Here the error log: (I would post a picture but I don't have 10 rep yet) java.lang.NullPointerException: Attempt to invoke virtual method 'void android.support.v7.widget.RecyclerView$LayoutManager.onMeasure(android.support.v7.widget.RecyclerView$Recycler, android.support.v7.widget.RecyclerView$State, int, int)' on a null object reference at android.support.v7.widget.RecyclerView.onMeasure(RecyclerView.java:1764) at android.view.View.measure(View.java:17430) at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:727) at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:463) at android.view.View.measure(View.java:17430) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463) at android.widget.FrameLayout.onMeasure(FrameLayout.java:430) at android.view.View.measure(View.java:17430) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463) at android.widget.FrameLayout.onMeasure(FrameLayout.java:430) at android.view.View.measure(View.java:17430) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463) at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1436) at android.widget.LinearLayout.measureVertical(LinearLayout.java:722) at android.widget.LinearLayout.onMeasure(LinearLayout.java:613) at android.view.View.measure(View.java:17430) at android.support.v4.widget.DrawerLayout.onMeasure(DrawerLayout.java:851) at android.view.View.measure(View.java:17430) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5463) at android.widget.Fra…
has answer: http://stackoverflow.com/a/27749235
has answer: http://stackoverflow.com/a/51920643
has answer: http://stackoverflow.com/a/57194901
has answer: http://stackoverflow.com/a/58981082
has answer: http://stackoverflow.com/a/27419093
downvote count: 1
accepted answer: http://stackoverflow.com/a/27419093
has answer: http://stackoverflow.com/a/31829770
has answer: http://stackoverflow.com/a/43464215
favorite count: 0
has comment: http://stackoverflow.com/comment/82007256
has comment: http://stackoverflow.com/comment/56742323
upvote count: 93
has answer: http://stackoverflow.com/a/39700471
has answer: http://stackoverflow.com/a/54065243
has title: App crashing when trying to use RecyclerView on android 5.0
has comment: http://stackoverflow.com/comment/82241760
tagged with: android
has answer: http://stackoverflow.com/a/64333495
has answer: http://stackoverflow.com/a/53006048
linked to: http://stackoverflow.com/q/26737113
has answer: http://stackoverflow.com/a/49263185
tagged with: android-recyclerview
answer count: 22
has answer: http://stackoverflow.com/a/58428142
has answer: http://stackoverflow.com/a/30751643

http://stackoverflow.com/q/27426173
type: Question
has body: I have the enum; enum testMe { one, two, three; long longValue() { return 1&lt;&lt;ordinal(); } } for (testMe myLoop = testMe.values()) { System.out.println(value.longValue() + ":" + myLoop); } Looping through the enum gives me exactly what I expect for the shift on the ordinal of the values in the enum. However, I need to qualify on an parameter I pass in a long; Long myLong = 3; for (testMe myLoop = testMe.values()) { if ((myLong &amp; value.longValue()) != 0) { System.out.println(value.longValue() + ":" + myLoop); } } In this case only the One and Two will be printed. However, this method will only work to 32 values in the enum. Does anyone have any ideas how I could use the BigInteger??? BigInteger longValue() { BigInteger one = BigInteger.valueOf(1); return one.shiftLeft(ordinal()); Thanks C
answer count: 2
has comment: http://stackoverflow.com/comment/43294529
possible better answer: http://stackoverflow.com/a/27426309
has comment: http://stackoverflow.com/comment/43294764
has answer: http://stackoverflow.com/a/27426309
score: 0
has title: Java BigInteger and the Shift operator
has comment: http://stackoverflow.com/comment/43295396
has comment: http://stackoverflow.com/comment/43294204
has comment: http://stackoverflow.com/comment/43296666
has answer: http://stackoverflow.com/a/27426420
tagged with: ordinal
tagged with: biginteger
type: AnsweredQuestion
tagged with: bit-shift
tagged with: java
accepted answer: http://stackoverflow.com/a/27426420

http://stackoverflow.com/q/27363255
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27363433
tagged with: interface
accepted answer: http://stackoverflow.com/a/27363472
has answer: http://stackoverflow.com/a/27363452
type: AnsweredQuestion
upvote count: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/27363452
has answer: http://stackoverflow.com/a/27363472
type: Question
has title: Equating interface with a class that implements it
tagged with: implementation
has body: I have a problem with trying to equate an interface to a class that implements that class. I have an interface called SortedSetADTx.java I have a class called BstSetKTUx.java Now in the my main class I have two variables private static SortedSetADTx&lt;Automobilis&gt; autoSet; private static BstSetKTUx&lt;Automobilis&gt; autoSetBst; and in one of my function I want to do this: autoSet = new BstSetKTUx(new Automobilis()); autoSetBst = autoSet; And I get an error that those two are incompatible types. The reason I am doing that, I want to use a function that BstSetKTUx class has. I hope you can understand my question, it's really hard to explain.
score: -1
answer count: 3

http://stackoverflow.com/a/27460878
has comment: http://stackoverflow.com/comment/43359592
has comment: http://stackoverflow.com/comment/43388823
type: Answer
has comment: http://stackoverflow.com/comment/43358526
downvote count: 0
score: 2
accepted answer of: http://stackoverflow.com/q/27460838
answers question: http://stackoverflow.com/q/27460838
upvote count: 2
has comment: http://stackoverflow.com/comment/43358335
has comment: http://stackoverflow.com/comment/43358616
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43358137
has body: Use equals instead of temp!="end" // temp.equals("end") Flush the output stream before closing because by default PrintWriter object is created without automatic line flushing. Hence outfile.flush() or when you are creating PrintWriter object then pass true as second argument like this PrintWriter outfile = new PrintWriter(new FileWriter(filename), true);

http://stackoverflow.com/comment/43269982
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27412744
score: 0
has text: *Just a tip:* If you are sure that the file will always have the structure "string:integer" you can use the `split(":")` method to separate the string from the integer. Maybe it will be more easily to handle.

http://stackoverflow.com/q/27349044
tagged with: swing
type: Question
tagged with: swingworker
has answer: http://stackoverflow.com/a/27349226
has body: I have searched the net and can't find the specific thing that would help me out. I have my Swing Worker class doing some work in the background, while that is happening i would like to disable everything on my UI. I don't want to go from one button to the next (Jlist, Jtable) etc and disabling everything. is there an easier way; Like drawing something on top of my UI and then removing it when Swing Worker is done? can somebody show me how to do something like that. Or what would be your suggestion. I already know how to get a notice when Swing Worker is done. just looking for the best way to disable everything.
has comment: http://stackoverflow.com/comment/43152753
score: 0
answer count: 1
linked to: http://stackoverflow.com/q/19324918
linked to: http://stackoverflow.com/q/19799451
has title: Disabling everything while swingworker is working?
linked to: http://stackoverflow.com/q/12169662
linked to: http://stackoverflow.com/q/20799814
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/43344393
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27452969
has text: It's not my real problem, I just need to understand it before applying more complex regex to my problem.
score: 0

http://stackoverflow.com/a/27449512
type: Answer
has comment: http://stackoverflow.com/comment/43342673
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43343959
has body: You have to convert your JSON into the desired type. The following example converts it into a Map&lt;String,String&gt;. If it can't be converted, it will throw an exception. public class JsonMapExample { public static void main(String[] args) { String json = "{\"name\":\"mkyong\", \"age\":\"29\"}"; Map&lt;String,String&gt; map = new HashMap&lt;String,String&gt;(); ObjectMapper mapper = new ObjectMapper(); try { map = mapper.readValue(json, new TypeReference&lt;HashMap&lt;String,String&gt;&gt;(){}); } catch (JsonMappingException e) { e.printStackTrace(); } } } That's typically what happens when sending serialized objects over the network, you lose type safety when marshalling it, and add it back in on the other end by unmarshalling it. See: http://jackson.codehaus.org/1.1.2/javadoc/org/codehaus/jackson/map/ObjectMapper.html#readValue(byte[],%20int,%20int,%20java.lang.Class) http://www.mkyong.com/java/how-to-convert-java-map-to-from-json-jackson/
has comment: http://stackoverflow.com/comment/43343267
upvote count: 1
has comment: http://stackoverflow.com/comment/43338089
has comment: http://stackoverflow.com/comment/43339241
answers question: http://stackoverflow.com/q/27449365

http://stackoverflow.com/comment/43214010
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27381253
has text: Depending on your system architecture (e.g. x86) you may only get reorderings when certain system events happen (e.g. you have high system load, your process is interrupted often or you only have a dual-core CPU, which reduces the chance of true concurrency. Note that only because it *appears* to work on your system is by no means a guarantee that it *will* work under all circumstances. I for one certainly wouldn't bet the bank on your implementation. :-)
score: 0

http://stackoverflow.com/comment/43373654
has text: I can't because i have to use the result of the asynch task after that ...
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27382743

http://stackoverflow.com/comment/43232575
has text: But what would be the point? You want to check `number`, but the method doesn't know what `number` is until you provide? I'd be like me asking you what type of pie I have without giving it to you....
comment on: http://stackoverflow.com/q/27392578
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/43189619
type: QuestionComment
comment on: http://stackoverflow.com/q/27368816
score: 1
has text: This is because you haven't initialized the array_produtos ArrayList
type: Comment

http://stackoverflow.com/q/27425817
tagged with: syntax-error
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27425945
accepted answer: http://stackoverflow.com/a/27425935
tagged with: subclass
has title: Compilation error in main method
possible better answer: http://stackoverflow.com/a/27425945
upvote count: 1
has body: package morepackage; public class Subclass extends Superclass { public static void main ( String args[] ) { String name = super.text;//compilation error in this line String name1 = text;//no compilation error in this line } } The code of the superclass is: public class Superclass { static String text = "flowers"; } Can anyone please tell me why the line String name = super.text is showing error while the line String name1 = text; is not showing error ?
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27425935
tagged with: eclipse
type: Question

http://stackoverflow.com/comment/43350283
comment on: http://stackoverflow.com/q/27456303
score: 0
has text: Lazy loading is more popular nowadays. Certain sites (e.g. http://www.computerra.ru/lenta/) implement lazy loading quite nicely
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/92486978
type: AnswerComment
has text: its giving me the list of user id how i can get the count of that
type: Comment
comment on: http://stackoverflow.com/a/27323239
score: 2

http://stackoverflow.com/comment/43283387
has text: Which line is throwing this error?
comment on: http://stackoverflow.com/q/27420294
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43230975
score: 0
comment on: http://stackoverflow.com/q/27391390
type: Comment
type: QuestionComment
has text: Completely agree with you @Selvin. I'm trying to figure out though, why the same (un-altered) code would run so clean multiple times for two days and then throw an NPE on the third.

http://stackoverflow.com/q/27425998
upvote count: 1
score: 1
tagged with: java
tagged with: jboss
has answer: http://stackoverflow.com/a/27432922
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/27471649
has answer: http://stackoverflow.com/a/27432944
answer count: 3
has title: is there any way to look up external CDI bean or EJB session using its name?
downvote count: 0
favorite count: 0
tagged with: cdi
has body: i was working with jboss Seam framework to invoke seam components like that Component.forName("exampleBean").newInstance(); as "exampleBean" the name of the bean that i have to look up. But recently i migrate into JEE6 and i'm loooking for the way to look up EJBs or CDI beans without using JNDI context?
type: UnansweredQuestion

http://stackoverflow.com/q/27334854
has answer: http://stackoverflow.com/a/27335638
has body: My friend sent me a project from his eclipse workspace for me to take a look at, however when I tried to put the folder in my workspace it did nothing. I opened eclipse and nothing was there. So i tried to make my own project and just put the .java and .class files in their respected folders, but it still didn't work. Is there some special way I have to transfer them? I should also mention he has a windows computer and I have a mac if that makes any difference for file types like that. Thanks for the help!
has title: Issues getting files from my friend to work on my eclipse?
has comment: http://stackoverflow.com/comment/43126745
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27335087
type: Question
tagged with: eclipse
score: 0
answer count: 2

http://stackoverflow.com/q/27339555
type: UnansweredQuestion
tagged with: java
type: Question
has title: Cannot programmatically submit Spark application (with Cassandra connector) to cluster from remote client
tagged with: apache-spark
score: 3
answer count: 1
downvote count: 0
tagged with: amazon-ec2
favorite count: 0
tagged with: cassandra
tagged with: linux
has body: I'm running a standalone Spark cluster on EC2, and I'm writing a application using Spark-Cassandra connector driver and try to submit job to Spark cluster programmatically. The job itself is simple: public static void main(String[] args) { SparkConf conf; JavaSparkContext sc; conf = new SparkConf() .set("spark.cassandra.connection.host", host); conf.set("spark.driver.host", "[my_public_ip]"); conf.set("spark.driver.port", "15000"); sc = new JavaSparkContext("spark://[spark_master_host]","test",conf); CassandraJavaRDD&lt;CassandraRow&gt; rdd = javaFunctions(sc).cassandraTable( "keyspace", "table"); System.out.println(rdd.first().toString()); sc.stop(); } Which runs fine when I run that in the Spark Master node of my EC2 cluster. I'm trying to running this in a remote Windows client. The problem was from these two lines: conf.set("spark.driver.host", "[my_public_ip]"); conf.set("spark.driver.port", "15000"); First, if i comment out these 2 lines, application would not throw a exception, but the Executor is not running, with following log: 14/12/06 22:40:03 INFO client.AppClient$ClientActor: Executor updated: app-20141207033931-0021/3 is now LOADING 14/12/06 22:40:03 INFO client.AppClient$ClientActor: Executor updated: app-20141207033931-0021/0 is now EXITED (Command exited with code 1) 14/12/06 22:40:03 INFO cluster.SparkDeploySchedulerBackend: Executor app-20141207033931-0021/0 removed: Command exited with code 1 Which never ends, when I check the worker node log, I found: 14/12/06 22:40:21 ERROR security.UserGroupInformation: PriviledgedActionException as:[username] cause:java.util.concurrent.TimeoutException: Futures timed out after [30 seconds] Exception in thread "main" java.lang.reflect.UndeclaredThrowableException: Unknown exception in doAs at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1134) at org.apache.spark.deploy.SparkHadoopUtil.runAsSparkUser(SparkHadoopUtil.scala:52) at org.apache.spark.executor.CoarseGrainedExecutorBa…
has answer: http://stackoverflow.com/a/29971067
upvote count: 3

http://stackoverflow.com/comment/43222311
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27385418
has text: Your `Box` is passive - think about processing a message 'change'. Provide a useful `toString()`. I see a constructor demanding a parameter `num` - and ignoring it - think about numbering `Box`es automatically (and about concurrency). You might model `Person`.

http://stackoverflow.com/q/27473097
downvote count: 2
has body: Im new with programming and have been trying to solve this problem for a while, been looking at similar questions but im not understanding whats wrong with my code. So the assignment is to write a method that takes an array that has three doubles in it. Then return the average of the three doubles. Then write a main that should call and then type the method. Thanks! Main public class Tenta131031upg1main { public static void main (String[]args){ double []arr ={3.15, 4.41, 7.64}; Tenta131031upg1.genomsnitt(double arr[]); System.out.println(Tenta131031upg1.genomsnitt(arr)); } } Class public class Tenta131031upg1 { static int i =0; static double sammanlagd=0; static double genomsnitt=0; public static double genomsnitt(double[]arr){ while(i&lt;arr[].length()){ sammanlagd = sammanlagd + arr[i]; i++; } genomsnitt = sammanlagd/arr[].length(); return genomsnitt; } } PS. they are two different classes with 1 main and 1 class they are not in the same file! The error: Syntax error on token "double", new expected Variable must provide either dimension expressions or an array initializer arr cannot be resolved to a type at Tenta131031upg1main.main(Tenta131031upg1main.java:7)
tagged with: java
has comment: http://stackoverflow.com/comment/43380739
tagged with: methods
type: Question
answer count: 2
upvote count: 0
score: -2
tagged with: arrays
has comment: http://stackoverflow.com/comment/43380716
has answer: http://stackoverflow.com/a/27473151
has answer: http://stackoverflow.com/a/27473194
has title: method returning average of double array
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/43234789
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27393076
has text: *"It would be better if.."* ..the user attended to those dialogs. Dismissing them if need be.

http://stackoverflow.com/comment/43288700
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27422724
type: Comment
has text: I need only three field.dont want whole record

http://stackoverflow.com/a/27396191
has comment: http://stackoverflow.com/comment/43238874
downvote count: 1
upvote count: 0
score: -1
has body: This is bit strange exception as the actual problem differs with the displayed error. You should check whether the project(the program is running in) having any build errors. If any such error exists like refered lib is not available etc, the program will not run. Concentrate on project for any build errors.
accepted answer of: http://stackoverflow.com/q/27396099
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27396099
type: Answer

http://stackoverflow.com/q/27366566
has comment: http://stackoverflow.com/comment/43185780
has answer: http://stackoverflow.com/a/27366795
has title: How to use a JProgressBar with java to make a browser?
has comment: http://stackoverflow.com/comment/43185788
has comment: http://stackoverflow.com/comment/43185946
tagged with: java
tagged with: jcomponent
has comment: http://stackoverflow.com/comment/43185387
type: Question
has body: I'm trying to build a browser in Java. It contains JProgressBar, JTextField and JEditorPane, but when I ran the program I found a problem: When the editor pane set the page searched, the JProgressBar doesn't work. I've tried this code: String az = jTextField1.getText(); if(az.contains("1")){ String hh = WorkSpace.jTextField1.getText(); try { WorkSpace.jEditorPane1.setPage("" + hh ); WorkSpace.jProgressBar1.setValue(); // which value? } catch (Exception e) { } So should the editor pane set the page when the JProgressBar is complete? How I can do this?
has comment: http://stackoverflow.com/comment/43185467
score: 0
has comment: http://stackoverflow.com/comment/43185654
has comment: http://stackoverflow.com/comment/43185990
answer count: 1
has comment: http://stackoverflow.com/comment/43185811
type: UnansweredQuestion

http://stackoverflow.com/q/27443233
accepted answer: http://stackoverflow.com/a/27444313
has body: I am sending HTTP request to server using AsnncTask.I am calling one function checkServer() with three arguments. From this function i am calling a class URLDataProvider().execute("url").get(). When i call checkServer then asynctask is called but after getting response code of 404 checkProtocol method is called. after that OnPostExecute method is called. After that i again calling checkServer() from Post execute if response code is 404. But the rest of code is called and after that i get the response code of 200 Ok. May i know why checkProtocol() &amp; rest of the code is called before the end of checkServer(). Here is the code checkServer("http","servername","firstlogin"); checkProtocol(host_ip, portnumber); -----------Some code------------- new Thread(new Runnable(){ URL DATA PROVIDER private class UrlDataProvider3 extends AsyncTask&lt;String, Void, String&gt; { String ret=""; int checkStatus; Boolean exception=false; @Override protected String doInBackground(String... url) { HttpURLConnection con = null; try { HttpURLConnection.setFollowRedirects(true); con = (HttpURLConnection) new URL(url[0]).openConnection(); con.setRequestMethod("HEAD"); con.setConnectTimeout(20000); if(con.getResponseCode()==HttpURLConnection.HTTP_NOT_FOUND &amp;&amp; con.getURL().toString().contains("pdata/Login")) { checkStatus=1; return "done"; } else if(con.getResponseCode()==HttpURLConnection.HTTP_NOT_FOUND &amp;&amp; con.getURL().toString().contains("cdata/Login")) { checkStatus=2; return "done"; } if(con.getResponseCode()==HttpURLConnection.HTTP_OK &amp;&amp; con.getURL().toString().contains("pdata/Login")) { return "done"; } else if(con.getResponseCode()==HttpURLConnection.HTTP_OK &amp;&amp; con.getURL().toString().contains("cdata/Login")) { return "done"; } } catch (SocketTimeoutException ste) { con.disconnect(); return null; } catch (IOException e) { } return ret; } @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub super.onPostExecute(result…
possible better answer: http://stackoverflow.com/a/27444324
answer count: 2
has answer: http://stackoverflow.com/a/27444324
upvote count: 1
has answer: http://stackoverflow.com/a/27444313
favorite count: 0
has comment: http://stackoverflow.com/comment/43326178
tagged with: android
tagged with: httpurlconnection
tagged with: android-asynctask
type: AnsweredQuestion
downvote count: 0
tagged with: http
type: Question
has title: Asyc task finishing after execution of rest of code?
has comment: http://stackoverflow.com/comment/43326127
score: 1
tagged with: java

http://stackoverflow.com/comment/43260710
comment on: http://stackoverflow.com/q/27408091
has text: that has to be `protected` considering your subclass won't be able to see it to override it if it's `private`
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/43284537
comment on: http://stackoverflow.com/q/27421009
has text: p.s. You don't use the backticks for blocks of code. Just the indentation is enough.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43243759
comment on: http://stackoverflow.com/a/27398689
score: 0
type: AnswerComment
type: Comment
has text: It works and made my code really short and faster. Thanks a lot. One more thing, can you tell me if my share1 method is correct? What I want to do is get the Red, green, blue values of the original pixel and then call share1..in that, I add and multiple random things and return a new_pixel value..BUT, the old pixel values are like -60000 or so and new pixel values are like 150 or 200..Is it correct? I need to return back a packed RGB pixel value.I am supposed to get back noise-like images!! which I am not!!

http://stackoverflow.com/q/27473144
has comment: http://stackoverflow.com/comment/43380894
favorite count: 0
has answer: http://stackoverflow.com/a/27473371
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27473226
tagged with: multithreading
has comment: http://stackoverflow.com/comment/43380862
type: Question
has answer: http://stackoverflow.com/a/27473241
tagged with: java
has title: Connection Refused - Java Client/Server
tagged with: concurrency
score: 0
tagged with: client-server
answer count: 3
upvote count: 1
has body: I'm trying to create a java push server model for testing on my own machine, this won't be used to connect external clients as the server and client will be on the same machine. After the client connects on the port specified by he/she, they should send a message of their choice that will be sent back to them, and any other clients connected to the same port. The problem I'm having is i receive a java.net.ConnectException: Connection refused: connect when this is attempted. Below is the client and the server. Edit: I've taken the time to ensure that the necessary ports are open too, and even disabled my firewall, but to no avail. Server: class MainServer { // port that oir server is going to operate on final static int port = 1234; public static void main(String[] args) { // this is going to model the server for the moment System.out.println("Server has been started..."); Buffer&lt;Messages&gt; store = new Buffer&lt;Messages&gt;(10); new Writer(store).start(); try { ServerSocket serve = new ServerSocket(port); while(true) { // wait for server request Socket socket = serve.accept(); // start thread to service request new ServerThread(socket,store).start(); } } catch(IOException e) {e.printStackTrace();} } } class ServerThread extends Thread { Socket socket; Buffer&lt;Messages&gt; buffer; public ServerThread(Socket s, Buffer&lt;Messages&gt; b) { socket = s;buffer = b; } public void run() { try { DataInputStream in = new DataInputStream(socket.getInputStream()); int port = in.readInt(); System.out.println("Port: "+port); Messages ms = new Messages(port); // Read message as string from user String message = in.readUTF(); int k = in.readInt(); while(k != -1) { // Add message to array // read next message ms.add(message); message = in.readUTF(); } // close connection socket.close(); // add message to buffer buffer.put(ms); } catch(IOException e) {e.printStackTrace();} } } class Writer extends Thread { Buffer&lt;Messages&gt; buffer; public Writer(Buffer&lt;Messages&gt; m) …
downvote count: 1

http://stackoverflow.com/q/27385823
favorite count: 0
has title: Spring-data-mongodb sum and count
has comment: http://stackoverflow.com/comment/43220987
answer count: 0
type: UnansweredQuestion
score: 1
tagged with: spring-data
has comment: http://stackoverflow.com/comment/43260814
upvote count: 1
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/43260383
tagged with: mongodb
downvote count: 0
has body: I have a database with documents that have a category and a filesize. I want to query and produce a count of the different categories and the total filesize for each category. I'm using spring-data and I'm able to do exactly what I want using 2 aggregation queries. My question is this...Is it possible to do this in a single query so that I have just 1 list that contains the category name, the number of times it is stored and the sum of the filesizes? The answer was found TypedAggregation&lt;CatInfo&gt; agg = newAggregation(CatInfo.class, group("category").count().as("count").sum("bytes").as("bytes"), project("count","bytes").and("category").previousOperation(), sort(Sort.Direction.ASC,"category")); AggregationResults&lt;FileCount&gt; results = mongoOps.aggregate(agg, FileCount.class); // FileCount class has category and count List&lt;FileCount&gt; fclist = results.getMappedResults(); So no longer do I need this separate query to get the total file size

http://stackoverflow.com/comment/43253744
type: Comment
type: QuestionComment
has text: Didn't want to create an issue since it's just a question, might be that it is done on purpose with a good reason..
score: 3
comment on: http://stackoverflow.com/q/27401792

gridview
tags question: http://stackoverflow.com/q/27457372
tags question: http://stackoverflow.com/q/27431434
tag name: gridview
tags question: http://stackoverflow.com/q/27471784
tags question: http://stackoverflow.com/q/27392027
tags question: http://stackoverflow.com/q/27441495
tags question: http://stackoverflow.com/q/27445220
type: Tag

http://stackoverflow.com/comment/43150853
score: 0
type: AnswerComment
type: Comment
has text: Just tried this. The `IllegalArgumentException` is thrown: "Can not refresh not managed object: ftcApp.model.Item@5dadd2e0."
comment on: http://stackoverflow.com/a/27348015

http://stackoverflow.com/q/27332518
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43127403
tagged with: jpa
has title: Pound Sign in JPA Field Name
has body: Our database contains a lot of fields with a pound sign (#) in the field name. If we try to use a native query in JPA it treats the # as a parameter. Here is an example: public List&lt;?&gt; getRecordList(String sql){ Query query = getEntityManager().createNativeQuery(sql); return query.getResultList(); } List&lt;?&gt; r = getRecordList("SELECT VENDOR.\"ve#\", ITEM.\"item#\" FROM ITEM LEFT JOIN VENDOR ON ITEM.\"itemve#\" = VENDOR.\"ve#\"); When this is executed we receive the following error: Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: Parameter index out of range (4 &gt; number of parameters, which is 3). Error Code: 0 Call: SELECT VENDOR."ve?, ITEM."item? FROM ITEM LEFT JOIN VENDOR ON ITEM."itemve? = VENDOR."ve?
upvote count: 1
has comment: http://stackoverflow.com/comment/43122748
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43122994
has answer: http://stackoverflow.com/a/27369058
type: UnansweredQuestion
downvote count: 0

http://stackoverflow.com/a/27469121
answers question: http://stackoverflow.com/q/27469094
type: AcceptedAnswer
downvote count: 0
has body: The View communicates with the controller, the controller communicates with the model and vice-versa. Say you have a model class Graph that contains the points of a graph. Your views purpose is to display that graph. The Graph class would be an Observable that the controller observes. If the controller observes change, it will tell the view update/change accordingly. If you press a button on the view, say to display a different graph object, your button has an actionListener that asks the controller to change the graph. And yes, your view classes would create the Swing components.
type: Answer
has comment: http://stackoverflow.com/comment/43373483
has comment: http://stackoverflow.com/comment/43373479
has comment: http://stackoverflow.com/comment/43373467
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27469094
has comment: http://stackoverflow.com/comment/43373522
score: 1

http://stackoverflow.com/a/27360746
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43173801
type: Answer
has comment: http://stackoverflow.com/comment/43173583
has comment: http://stackoverflow.com/comment/43173744
answers question: http://stackoverflow.com/q/27360679
has comment: http://stackoverflow.com/comment/43177263
has body: Since you have the index, try this: for(int i=0;i&lt;50;i++) { Random t = new Random(); // random integers in [0, 100] if(i==49) { System.out.println(t.nextInt(100)); } }
score: 0

http://stackoverflow.com/q/27473692
has comment: http://stackoverflow.com/comment/43382385
has comment: http://stackoverflow.com/comment/43383800
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/43381960
has comment: http://stackoverflow.com/comment/43382138
has body: I'm receiving a null pointer exception when trying to load the string value from sharedpreferences into the string value on my fragment. I have the sharedpreference working correctly, so I know the string is being saved, but I can't replace the string value in my fragment with the sharedpreference value. MainActivity SharedPreferences saveLocation = getSharedPreferences(SAVE, MODE_PRIVATE); SharedPreferences.Editor editor = saveLocation.edit(); editor.putString("name", marker.getTitle()); editor.commit(); //applies the name to XML FlickrFragment public class FlickrFragment extends Fragment{ GridView mGridView; ArrayList&lt;GalleryItem&gt; mItems; ThumbnailDownloader mThumbnailThread; String textToSearch = "Keating Hall"; Basically "Keating Hall" is the text that's being used to generate a gridview of photos. That works correctly, however, I'm trying to replace "Keating Hall" with the sharedpreference value, but have been unsuccessful in all methods that I've tried. Please let me know if my description needs to be updated to better reflect what I need help with. Thank you. Updated: Included LogCat 12-14 15:12:25.161 14902-14902/com.example.ramap E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.example.ramap, PID: 14902 java.lang.NullPointerException at com.example.ramap.FlickrFragment.&lt;init&gt;(FlickrFragment.java:41) at com.example.ramap.adapter.TabsPagerAdapter.getItem(TabsPagerAdapter.java:25) at android.support.v4.app.FragmentPagerAdapter.instantiateItem(FragmentPagerAdapter.java:97) at android.support.v4.view.ViewPager.addNewItem(ViewPager.java:837) at android.support.v4.view.ViewPager.populate(ViewPager.java:987) at android.support.v4.view.ViewPager.populate(ViewPager.java:919) at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1441) at android.view.View.measure(View.java:16660) at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:5150) at android.widget.FrameLayout.onMeasure(FrameLayout.java:310) at android.view.View.measure(View.…
type: Question
has comment: http://stackoverflow.com/comment/43383848
has title: Null Pointer Exception when loading SharedPreference value into fragment string
has comment: http://stackoverflow.com/comment/43385986
has comment: http://stackoverflow.com/comment/43384346
score: 0
tagged with: flickr
tagged with: android
has comment: http://stackoverflow.com/comment/43382103
has comment: http://stackoverflow.com/comment/43383582
has comment: http://stackoverflow.com/comment/43383256
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43383828
has comment: http://stackoverflow.com/comment/43382015
has comment: http://stackoverflow.com/comment/43385895
has comment: http://stackoverflow.com/comment/43382092
has comment: http://stackoverflow.com/comment/43382007

http://stackoverflow.com/q/27459150
duplicate of: http://stackoverflow.com/q/17471913
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/43355253
answer count: 1
linked to: http://stackoverflow.com/q/1386275
has comment: http://stackoverflow.com/comment/43355181
linked to: http://stackoverflow.com/q/4345999
favorite count: 0
tagged with: arraylist
score: 0
has body: I want to compare the add method (for 1000 elements) in the class Vector and in the class ArrayList. Why is the add method in Vector faster then add method in ArrayList? Here is the code I am using to measure: public static void main(String[] args) { List v = new Vector(); List l = new ArrayList(); long startTime = System.nanoTime(); for (int i = 0; i &lt; 1000; i++) { v.add(i); } long duration = System.nanoTime() - startTime; System.out.println("Vector: " + duration + " ns"); startTime = System.nanoTime(); for (int i = 0; i &lt; 1000; i++) { l.add(i); } duration = System.nanoTime() - startTime; System.out.println("ArrayList: " + duration + " ns"); }
has comment: http://stackoverflow.com/comment/43355256
has comment: http://stackoverflow.com/comment/43355259
has title: add() method in Vector faster than in ArrayList
upvote count: 3
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27459286
linked to: http://stackoverflow.com/q/17471913
has comment: http://stackoverflow.com/comment/43355254
type: Question
has comment: http://stackoverflow.com/comment/43355190

http://stackoverflow.com/a/64850029
answers question: http://stackoverflow.com/q/27379046
type: Answer
upvote count: 4
has body: Use Matcher.quoteReplacement if the replacement string should be treated literally. It escapes all \ characters and also $ characters. String replacement= "a\\b" matcher.appendReplacement(sb, Matcher.quoteReplacement(replacement));
downvote count: 0
score: 4

http://stackoverflow.com/comment/43265028
type: Comment
comment on: http://stackoverflow.com/q/27410182
has text: We would need to see the `createStringFromInfo()` method to be sure why `data` contains no data, but my first guess would be that it's because you're passing an empty list to that method.
score: 0
type: QuestionComment

http://stackoverflow.com/a/27387186
type: Answer
has comment: http://stackoverflow.com/comment/43225127
has body: this feels kinda stupid but I did it.If the words have to be real then you will need something else. import java.util.Random; public class random { public static void main(String[] args){ String word1=generateWord(); String word2=generateWord(); String word3=generateWord(); System.out.print(word1+"\n"+word2+"\n"+word3+"\n"); String allThreeWithTheFirstLetterCapital=putThemTogether(word1,word2,word3); System.out.print(allThreeWithTheFirstLetterCapital); } public static String generateWord(){ Random r=new Random(); StringBuilder sb=new StringBuilder(); sb.append((char)(65+r.nextInt(25))); for(int i=0;i&lt;9;i++){ sb.append((char)(97+r.nextInt(25))); } return sb.toString(); } public static String putThemTogether(String...strings){ StringBuilder sb=new StringBuilder(strings[0]); for(int i=1;i&lt;strings.length;i++){ sb.append(strings[i].toLowerCase()); } return sb.toString();} } this is it import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagLayout; import java.awt.Toolkit; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; public class weirdMath { public static void main(String[] args){ double number1=Double.parseDouble(JOptionPane.showInputDialog("input a first number")); double number2=Double.parseDouble(JOptionPane.showInputDialog("input a second number")); String operation=JOptionPane.showInputDialog("input an operation (+-/*)"); number1*=2;number2*=2; double result=0; if(operation.equals("+")){result=number1+number2;} else if(operation.equals("-")){result=number1-number2;} else if(operation.equals("/")){result=number1/number2;} else if(operation.equals("*")){result=number1*number2;} JFrame jf=new JFrame("your answer"); jf.setSize(300,75); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int width = (int)screenSize.getWidth(); int height = (int)screenSize.getHeight(); jf.setLocation((int)(width/4.5), (int)(height/3…
accepted answer of: http://stackoverflow.com/q/27386578
has comment: http://stackoverflow.com/comment/43238373
answers question: http://stackoverflow.com/q/27386578
has comment: http://stackoverflow.com/comment/43228102
score: 0
has comment: http://stackoverflow.com/comment/43228189
type: AcceptedAnswer

http://stackoverflow.com/comment/43179171
comment on: http://stackoverflow.com/a/27362707
score: 0
type: AnswerComment
has text: I don't see how / where to double the apostrophe (it is being pulled from the title of an email - so I'll need to remove it when parsing it out) http://pastebin.com/CNVT3e26
type: Comment

http://stackoverflow.com/comment/43337800
has text: Depends. What are you *trying* to do?
comment on: http://stackoverflow.com/q/27449526
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/43124914
type: Comment
has text: Do you have an error when you do that ?
comment on: http://stackoverflow.com/q/27333879
score: 3
type: QuestionComment

http://stackoverflow.com/comment/43245327
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27399826
has text: If you take care to read the screenshot, you should notice that these are *class modifiers*, not *access modifiers*. Be very careful to read each word, especially the word "Nonaccess" in plain sight on that screenshot.

http://stackoverflow.com/comment/43342621
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27450944
has text: You should answer this question. Cause that's the case ^^
score: 0

http://stackoverflow.com/q/27346582
tagged with: jpa
answer count: 1
tagged with: many-to-one
has comment: http://stackoverflow.com/comment/43148435
has body: say I have a User table, and a UserRecordInfo table, which saves the action taken to change user's information. for example: User: |UserID | UserName| |1 | test| and UserRecordInfo: |UserRecordInfoID | UserID | Action | oldValue | newValue | | 1 | 1 | update Name | oldTest | test2 | | 2 | 1 | update Name | test2 | test | Apparently in Java, when designing Objects, I dont want to have a UserRecordInfo field in User, because there could be hundreds of UserRecordInfo for each user. What I have is: @Entity @Table(name="User") public class User { private userName; @Column(name = "userName") public String getUserName() { System.out.println("getting username"); return userName; } ... } and @Entity @Table(name="UserRecordInfo") public class UserRecordInfo { private User user; @JoinColumn(name = "UserID") // using javax.persistence.JoinColumn @ManyToOne(fetch = FetchType.LAZY) // using javax.persistence.ManyToOne public User getUser() { return user; } public void setUser(User user) { this.user = user; } } The way I create new UserRecordInfo is: User u = {get user from hibernate} UserRecordInfo record = new UserRecordInfo(); record.setUser(u); .setNewName("test1"); ... Session session = DBSessionHandler.getSession(); Transaction tx = null; try { tx = session.beginTransaction(); Serializable result = session.save(record); tx.commit(); return result; } catch (HibernateException ex) { ex.printStackTrace(); if (tx!=null) tx.rollback(); throw ex; } finally { DBSessionHandler.close(); } however it seems like whenever I am inserting a new UserRecordInfo , the User Object always get touched (the println always prints the "getting username"). Why is this happening? am I doing something wrong?
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has title: Hibnerate ManyToOne always cascade when it is not asked to
has answer: http://stackoverflow.com/a/27346877
accepted answer: http://stackoverflow.com/a/27346877
type: Question
has comment: http://stackoverflow.com/comment/43154844
score: 0

http://stackoverflow.com/q/27415077
accepted answer: http://stackoverflow.com/a/27415133
favorite count: 0
has body: I am new to Lambda expression and I have a Java 1.6 version. Can anyone explain how to convert the following code (Java 1.8) to Java 1.6? // 1st Code public int getEdgeCount() { return adjacencyList.values() .stream() .mapToInt(Node::getEdgeCount) .sum(); } // 2nd Code while (!queue.isEmpty()) { Node&lt;T&gt; first = queue.remove(); first.setVisited(true); first.edges().forEach(edge -&gt; { Node&lt;T&gt; neighbour = edge.toNode(); if (!neighbour.isVisited()) { neighbour.setParent(first); queue.add(neighbour); } }); }
type: AnsweredQuestion
tagged with: java-8
type: Question
score: 1
possible better answer: http://stackoverflow.com/a/27415307
tagged with: java
has comment: http://stackoverflow.com/comment/43274161
has answer: http://stackoverflow.com/a/27415307
has comment: http://stackoverflow.com/comment/43274172
upvote count: 2
answer count: 2
downvote count: 1
has title: Converting Java 8 Code to Java 6: Lambda Expressions
has answer: http://stackoverflow.com/a/27415133

http://stackoverflow.com/comment/43376255
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27469761
has text: Then it's luck. That is the problem with race conditions is that you can test them and observe that it works, thus conclude that it *must* work. Until such time that it doesn't and then you scratch your head for hours. I suggest you fix it today. It will save you headaches later.

http://stackoverflow.com/comment/43171039
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27322141
has text: i am not using mvc annotation driven as of now for all the beans i have bean and in controller bean as a property attribute i am refering that bean as well in controller i have respective setter method if its problem with the conf then i same project instead of ajax call through form submit file is getting saved but i my case i need to send this file using ajax call instead of form submit. so i boubt problem with parameter that controller expect and what ajax is sending may be

http://stackoverflow.com/a/27343421
has body: You would use insert . . . on duplicate key update: insert into table(name, uuid, world, x, y, z) values (@name, @uuid, @world, @x, @y, @z) on duplicate key update name = values(name), uuid = values(uuid); The variables @name and so on are just place holders for your values. This also assumes that id is auto-incremented, so it doesn't need to be inserted. For this to work, you need a unique index on the four columns: create unique index idx_table_world_x_y_z on table(world, x, y, z); If these are already declared as a primary key, then this is not necessary.
downvote count: 0
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27343383

http://stackoverflow.com/q/27367636
has comment: http://stackoverflow.com/comment/43189302
has comment: http://stackoverflow.com/comment/43201125
type: Question
has body: I have an android app and the main activity has a list view in it, and when I open the app it looks like this. The first item in the list view appears selected. How can I get rid of this? So it just looks like this when it is opened. Thanks for the help in advance.
score: 1
tagged with: java
tagged with: listview
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27371947
accepted answer: http://stackoverflow.com/a/27371947
favorite count: 0
tagged with: android-listview
tagged with: android
has comment: http://stackoverflow.com/comment/43194244
type: AnsweredQuestion
has title: ListView remove selection on open
upvote count: 1

http://stackoverflow.com/comment/46514038
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/29122057
has text: You have an example link http://www.codeproject.com/Articles/815900/Android-social-network-integration and the code https://github.com/gorbin/ASNETutorial
score: 0

http://stackoverflow.com/q/27418770
has comment: http://stackoverflow.com/comment/43447980
type: Question
linked to: http://stackoverflow.com/q/364301
has title: how to get paragraph response from search in lucene?
tagged with: lucene
upvote count: 3
tagged with: http://stackoverflow.com/tag/html
has body: I've made a search component in my application with lucene. everything works fine, Indexing, highlighting ,etc. I need now to return a paragraph as my search response and not just limit the result to "fragmentSize" in SimpleSpanFragmenter method.there is part of my code: SimpleHTMLFormatter formatter = new SimpleHTMLFormatter("&lt;span class='highlight'&gt;", "&lt;/span&gt;"); QueryScorer scorer = new QueryScorer(query, NodeDocument.TEXT_FIELD); Highlighter highlighter = new Highlighter(formatter, scorer); highlighter.setTextFragmenter(new SimpleSpanFragmenter(scorer, MAX_FRAGMENT_LEN)); String excerpt = highlighter.getBestFragment(analyzer, Document.MESSAGE_FIELD, nForumPost.getMessage()); This code returns "MAX_FRAGMENT_LEN" which I've set to 256. but its not my ideal. I want to get a paragraph which contains my search word in query.
favorite count: 0
answer count: 0
type: UnansweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: paragraph
tagged with: lucene-highlighter

http://stackoverflow.com/q/27315946
has body: I have have an embbeded derby db in my application. if (new File(database).exists()) { connection = DriverManager.getConnection("jdbc:derby:" + database); } else { connection = DriverManager.getConnection("jdbc:derby:" + database + ";create=true"); } With JPA i can open the DB and work with it. Now I would like to look inside the DB while debbuging. I am using Netbeans. What I tried: Start the app and go to Services -> Databases -> New Connection --> Java DB (embedded) and choose derby as driver --> specified the JDBC URL (in same why like in the persistence.xml which work) But then I get the Error: "Cannot establish a connection to jdbc:derby:swot usering EmbeddedDriver (Die Datenbank 'swot' wurde nicht gefunden.)" last part in english: "Database "swot" not found." Have I to allow the access somehow?
upvote count: 1
type: Question
tagged with: derby
has title: Open embbeded Derby DB while debbunging
answer count: 1
downvote count: 0
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27320764
accepted answer: http://stackoverflow.com/a/27320764
score: 1
tagged with: java

http://stackoverflow.com/comment/43362500
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27463048
has text: It may be a good idea to rephrase as seems difficult to get where is exactly the problem.

http://stackoverflow.com/q/27361482
has answer: http://stackoverflow.com/a/27364075
tagged with: winsock
has comment: http://stackoverflow.com/comment/43200822
tagged with: java
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/43176684
has comment: http://stackoverflow.com/comment/43184255
score: 0
answer count: 2
downvote count: 2
has title: Ending of "messages" exchanged between client and server sockets
has answer: http://stackoverflow.com/a/27366371
favorite count: 0
has comment: http://stackoverflow.com/comment/43176667
tagged with: sockets
has body: Java server socket In the following code: https://docs.oracle.com/javase/tutorial/networking/sockets/examples/KnockKnockServer.java import java.net.*; import java.io.*; public class KnockKnockServer { public static void main(String[] args) throws IOException { if (args.length != 1) { System.err.println("Usage: java KnockKnockServer &lt;port number&gt;"); System.exit(1); } int portNumber = Integer.parseInt(args[0]); try ( ServerSocket serverSocket = new ServerSocket(portNumber); Socket clientSocket = serverSocket.accept(); PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true); BufferedReader in = new BufferedReader( new InputStreamReader(clientSocket.getInputStream())); ) { String inputLine, outputLine; // Initiate conversation with client KnockKnockProtocol kkp = new KnockKnockProtocol(); outputLine = kkp.processInput(null); out.println(outputLine); while ((inputLine = in.readLine()) != null) { outputLine = kkp.processInput(inputLine); out.println(outputLine); if (outputLine.equals("Bye.")) break; } } catch (IOException e) { System.out.println("Exception caught when trying to listen on port " + portNumber + " or listening for a connection"); System.out.println(e.getMessage()); } } } when the server sends its response to the client socket, it writes to the "PrintWriter" "out" using the "println()" method (line 63). I have tried using the "print()" method instead. In the "println()" case, the client socket receives the message properly. In the "print()" case, the client socket doesn't receive anything. Is this normal? Is it required to send an EOF, a CR LF (in my case) (10 and 13 ASCII characters) at the end of the message? Is it documented somewhere? Winsock In the following code: http://msdn.microsoft.com/en-us/library/windows/desktop/ms737591%28v=vs.85%29.aspx #define WIN32_LEAN_AND_MEAN #include &lt;windows.h&gt; #include &lt;winsock2.h&gt; #include &lt;ws2tcpip.h&gt; #include &lt;stdlib.h&gt; #include &lt;stdio.h&gt; // Need to link with Ws2_32.…
has comment: http://stackoverflow.com/comment/43175166
type: UnansweredQuestion

http://stackoverflow.com/comment/43215209
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27361612
type: Comment
has text: @GordThompson Im a bit confused about this though because we have managed to get the connection to work on a development machine without tweaking authorisation dll's. The only difference with the server with the issue is that it is outside our network??

http://stackoverflow.com/q/27400700
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27400775
downvote count: 0
has comment: http://stackoverflow.com/comment/43246546
has comment: http://stackoverflow.com/comment/43246440
favorite count: 0
tagged with: integer
has comment: http://stackoverflow.com/comment/43246485
upvote count: 2
has title: Java(BlueJ) Adding up all numbers between two integers
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/27400846
has body: I'm creating a method to add up all numbers between two integers. I currently have: /** * Add up all numbers between two integers */ public void Sum(int a,int b) { int result = 0; while (a &lt;=b) { result+=a; a++; } System.out.println("The sum of all numbers is "+result); } This only works if a &lt;= b. How do i also do it for if a &gt; b ? I have to use a while loop

http://stackoverflow.com/comment/43368275
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27466038
type: QuestionComment
has text: Are you allowed to use Math.Random()?

http://stackoverflow.com/comment/43092589
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27316310
has text: I thing you need to add your page in WEB-INF or http://stackoverflow.com/questions/2511301/setting-the-default-jsp-view-with-spring-mvc

http://stackoverflow.com/comment/81271051
type: AnswerComment
has text: Say there are 2 threads. Say, I want each of the threads individually not to take more than 10s. Say 1st thread takes 10s, 1st future.get() will wait for 10s. Say 2nd thread is still running at this point, a future.get() on 2nd will wait for another 10s and so a totally of 20s. How to avoid this ?
comment on: http://stackoverflow.com/a/27329740
type: Comment
score: 1

http://stackoverflow.com/comment/43313636
comment on: http://stackoverflow.com/q/27436479
type: Comment
score: 1
has text: Sort the characters of both `String`(s) into lexical order, then you could use `contains()` or `String.indexOf(String) > -1`
type: QuestionComment

http://stackoverflow.com/comment/43286165
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27420411
has text: Now you packed that into jar and run using "hadoop jar command" am I right?
type: AnswerComment

http://stackoverflow.com/a/27435058
type: AcceptedAnswer
type: Answer
has body: Thread.start() code registers the Thread with scheduler and the scheduler calls the run() method.You need to override the run() method.No need to call run() implicitly.
answers question: http://stackoverflow.com/q/27434943
score: 0
accepted answer of: http://stackoverflow.com/q/27434943

http://stackoverflow.com/a/27330379
type: AcceptedAnswer
has body: However, if thread one has mutated object A while it is in the collection, does getting it by thread two still provide the same full visibility guarantee? No, definitely not. The concurrency guarantees only apply to the collection itself. Once you've fetched the element from the collection, it's just a reference in a normal way - so even if there was a memory barrier at the end of the "get" operation, there'd still be the possibility of something like: Thread 1 Thread 2 get get mutate read ... and after both get operations had occurred, the collection is irrelevant. Concurrent collections should be used for: Immutable types which are naturally safe to use from multiple threads Types which are mutable, but which you never mutate Types where you apply explicit synchronization etc to ensure safety
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/27330347
downvote count: 0
answers question: http://stackoverflow.com/q/27330347
upvote count: 2

http://stackoverflow.com/a/27449047
score: 1
upvote count: 1
has body: The parameter passed into the synchronized block is not a statement but rather a object to synchronize upon (the mutex). To disable synchronization for whatever reason you should encase the statement in a if-condition as such: if(condition){ synchronized(myLock){ // Critical segment } } note however, if the evaluation of condition can be dependent on several threads (i.e. multiple writes to a boolean from different threads) you may need to use an existing thread-safe mechanism like AtomicBoolean as such: AtomicBoolean condition = ... // defined elsewhere if(condition.get()){ synchronized(myLock){ // Critical segment } } if you need conditional synchronization upon a synchronized method, remove the synchronized keyword from the method declaration and move it into the body: public synchronized void foo(){ // Critical segment } to public void foo(){ if(condition){ synchronized(this){ // Critical segment } } }
accepted answer of: http://stackoverflow.com/q/27448676
answers question: http://stackoverflow.com/q/27448676
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/27473199
answer count: 1
downvote count: 0
favorite count: 0
upvote count: 2
has body: I've been musing on this for a week and I'm not quite sure of a way to do this. A common task I am running into is building an ImmutableMap containing ImmutableLists, as in ImmutableMap&lt;K,ImmutableList&lt;V&gt;&gt;, for the values of the given type, and I'd like to do it through a collector so I can leverage it on streams. I found this great ImmutableMap collector on a blog shown below. But I want the V to be an ImmutableList, and I'd like the incoming stream to map multiple values with the same key paired to said key with an ImmutableList value. Every implementation I've tried has been suboptimal and not stream-like, as I kept falling back on using a plain HashMap holding ImmutableList.Builder values, and when I'm done populating I would loop through it and convert it into ImmutableList values by calling build() and putting it in a new map. Any ideas? public static &lt;T, K, V&gt; Collector&lt;T, ?, ImmutableMap&lt;K, V&gt;&gt; toImmutableMap( Function&lt;? super T, ? extends K&gt; keyMapper, Function&lt;? super T, ? extends V&gt; valueMapper) { Supplier&lt;ImmutableMap.Builder&lt;K, V&gt;&gt; supplier = ImmutableMap.Builder::new; BiConsumer&lt;ImmutableMap.Builder&lt;K, V&gt;, T&gt; accumulator = (b, t) -&gt; b.put(keyMapper.apply(t), valueMapper.apply(t)); BinaryOperator&lt;ImmutableMap.Builder&lt;K, V&gt;&gt; combiner = (l, r) -&gt; l.putAll(r.build()); Function&lt;ImmutableMap.Builder&lt;K, V&gt;, ImmutableMap&lt;K, V&gt;&gt; finisher = ImmutableMap.Builder::build; return Collector.of(supplier, accumulator, combiner, finisher); } I'd like the implementation to have a header of... public static &lt;T, K, V&gt; Collector&lt;T, ?, ImmutableMap&lt;K, ImmutableList&lt;V&gt;&gt;&gt; Okay I was successful thanks to fge's help! See answer below.
has answer: http://stackoverflow.com/a/27473599
score: 2
tagged with: immutability
type: AnsweredQuestion
tagged with: guava
tagged with: java
tagged with: stream
type: Question
has comment: http://stackoverflow.com/comment/43381276
accepted answer: http://stackoverflow.com/a/27473599
has title: Create an efficient ImmutableMap collector that holds an ImmutableList for each key
tagged with: collectors
has comment: http://stackoverflow.com/comment/43381330

http://stackoverflow.com/q/27385171
has title: Show progress while rendering fractals in multiple threads
tagged with: swing
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43220290
has comment: http://stackoverflow.com/comment/43222629
has body: Hello, I'm currently writing a fractal explorer/generator and I'm stuck with implementing a progress bar. Currently I have an abstract class Renderer that inherits a render method public abstract long render(int[] pixels, int w, int h);. This method returns the number of iterations. An example of a Renderer class would be BuddhaRenderer, here's an excerpt from the render()method of BuddhaRenderer: int[] numHits = new int[w * h]; ArrayList&lt;BuddhaThread&gt; threads = new ArrayList&lt;BuddhaThread&gt;(); for (int i = 0; i &lt; controller.processors; i ++) { BuddhaThread th = new BuddhaThread(controller, w, h, numHits, anti); th.start(); threads.add(th); } try { for(Thread th : threads) th.join(); } catch (InterruptedException e) { e.printStackTrace(); } This will start multiple threads that will write their results into numHits. I'm waiting for all threads to finish before continuing with drawing the image when running the join() method for all threads. Now, how would I go about displaying a progress bar of all those threads either inside the same JFrame or inside a different JFrame without the progress bar freezing? The progress in those could be read reliably since they just iterate over a given amount of random points. This is my first time using threads so please feel free to correct me If I'm doing something terribly wrong.
tagged with: progress-bar
score: 0
has comment: http://stackoverflow.com/comment/43226674
answer count: 0
type: UnansweredQuestion
tagged with: multithreading

http://stackoverflow.com/comment/43339885
score: 0
comment on: http://stackoverflow.com/q/27450518
type: Comment
type: QuestionComment
has text: Are you trying to call close on the DB or the MongoClient? Method chaining is convenient, but you need to keep a tab on which method returns what refernce.

bulkinsert
type: Tag
tag name: bulkinsert
tags question: http://stackoverflow.com/q/27365318

http://stackoverflow.com/q/27463122
has comment: http://stackoverflow.com/comment/43362493
type: AnsweredQuestion
has title: Writing to a file in java by user input
upvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43362634
has comment: http://stackoverflow.com/comment/43362510
score: -1
possible better answer: http://stackoverflow.com/a/27463271
answer count: 2
has comment: http://stackoverflow.com/comment/43363470
accepted answer: http://stackoverflow.com/a/27463942
has answer: http://stackoverflow.com/a/27463271
downvote count: 1
has body: How do i write text in file java. I have 10 rows, and i wanna write for each row? I did this so far String filename ="data.txt"; PrinterWriter output= new PrintWriter ( new FileWriter(filename, true)); System.out.println("Please enter the student's data: "); I want the user to add students for each students ( i want them to add their first name, studetn number, gender, their year, birthday, maybe phone number 2 and time table.) I don't know how to do that
has comment: http://stackoverflow.com/comment/43362589
favorite count: 0
has answer: http://stackoverflow.com/a/27463942
has comment: http://stackoverflow.com/comment/43362506

http://stackoverflow.com/q/27424825
downvote count: 0
has title: java EventQueue throwing error
favorite count: 0
has comment: http://stackoverflow.com/comment/43292409
has comment: http://stackoverflow.com/comment/43291921
linked to: http://stackoverflow.com/q/27404362
has comment: http://stackoverflow.com/comment/43292671
has comment: http://stackoverflow.com/comment/43295681
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: swing
type: Question
score: 1
tagged with: java
has body: i'm trying to create a simple login application here is my code java.awt.EventQueue.invokeLater(() -&gt; { Login dialog = new Login(new javax.swing.JFrame(), true); dialog.addWindowListener(new java.awt.event.WindowAdapter(){ public void windowClosing(java.awt.event.WindowEvent e){ System.exit(0); } }); dialog.setVisible(true); }); and i got red line in the first line of the code and its saying "illegal start of expression" i tried hard and ddnt figure it out yet, please help me out.
has comment: http://stackoverflow.com/comment/43292307

http://stackoverflow.com/a/27441924
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27441694
accepted answer of: http://stackoverflow.com/q/27441694
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43323475
has body: It's not a great file format, but it would be pretty easy to parse like this: public static void main(String[] args) throws Exception { String s; Scanner scanner = new Scanner(new File("c:/temp/x.txt")); while( ! "=".equals((s = scanner.next()))) { // Ignore - getting to start } while( ! "==".equals((s = scanner.next()))) { // Put in first array System.out.println("First section: " + s); } while( ! "===".equals((s = scanner.next()))) { // Put in first array System.out.println("Second section: " + s); } // etc... }

http://stackoverflow.com/a/27408574
has comment: http://stackoverflow.com/comment/43261922
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43261830
has body: You can use ResultTransformer without doubt. But, if you have a lot of columns/entities which requires this then use Hibernate Interceptors. In your example annotate name with custom annotation like below City { @CustomAnnotation(decrypt = true) private String name; .. } Within the interceptor when ever data is loaded, check the entities property for this custom annotation. If it is set to true then decrypt it. This approach is non intrusive. Example Update: ResultTransformer sess.createSQLQuery("SELECT name from City where name like 'xxyy'") .setResultTransformer(new ResultTransformer(){ Object transformTuple(Object[] tuple, String[] aliases){ // assign each tuple value to your object and return } })
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43261590
type: Answer
answers question: http://stackoverflow.com/q/27408211
accepted answer of: http://stackoverflow.com/q/27408211

http://stackoverflow.com/a/67093189
has body: You can easily work around this by declaring your final variable as an array: final int x[] = {2}; then from within your inner class, set the array value (example with method call returning a value): x[0] = methodcall(); or (example with just setting the value to 10): x[0] = 10;
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27429992
upvote count: 1
score: 1

http://stackoverflow.com/a/27336759
has body: There are two types of Exception : 1) checked Exception: those should be handle at compile time (by using try,catch,throws) 2) unchecked Exception: No compiler error for these exception but at run time exception may occurs. Your case is first one FileNotFoundException is checked exception so either you have to write that line inside try catch block or you have to use keyword throws. to pass exception handling to calling method.
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27335792

http://stackoverflow.com/comment/43380338
score: 0
type: Comment
has text: Why do you need .setParameter on the request object? The multi-form should send a post to your handler that has all the fields (including the meta-data your form provided). So in your servlet's Post handler, just use .getParameter("parameterName") and extract the meta-data you want with the Blob.
type: AnswerComment
comment on: http://stackoverflow.com/a/27471990

http://stackoverflow.com/comment/43299463
type: Comment
type: QuestionComment
score: 0
has text: Thanks mkorbel, I'm looking into it now
comment on: http://stackoverflow.com/q/27407319

http://stackoverflow.com/comment/43260906
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27408125
has text: Are you familiar with [`JSTL`](http://docs.oracle.com/javaee/5/tutorial/doc/bnake.html) in general and `<c:forEach>` in particular?

http://stackoverflow.com/q/27389690
has body: Hello everyone I'm working on my Android project, I created my expandable list view with Men's and Women's sports, and under each of them list of sports. Next what I have to do is to display data in each sport in textview format. I used intent to get my new activity for each sport and putExtra to display my data with events. Something is wrong in my code and does not want to display any data. I'm new in android world and if someone can help me with this I would really appreciate! Here is my Main.java code: public class MainActivity&lt;View&gt; extends ActionBarActivity { ExpandableListView exv; List&lt;GroupedFeed&gt; gfList; GroupedFeed gfResult; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); exv=(ExpandableListView)findViewById(R.id.expandableListView1); exv.setAdapter(new MyAdapter(this)); exv.setOnChildClickListener(new OnChildClickListener() { // Here I wanted to create my for loop but that did not work private GroupedFeed findFeed(String locateSport){ if ((!gfList.isEmpty())){ gfResult = null; for (int i = 0; i != gfList.size();i++){ if (gfList.get(i).category.equalsIgnoreCase(locateSport)){ gfResult = gfList.get(i); } } return gfResult; } return null; } public boolean onChildClick(ExpandableListView parent, android.view.View v, int groupPosition, int childPosition, long id) { switch (groupPosition) { case 0: switch (childPosition) { case 0: gfResult = findFeed("Men's Baseball"); Baseball(gfResult); // pass gfResult break; case 1: gfResult =findFeed("Men's Basketball"); MensBasketball(gfResult); break; } return false; } private void Baseball(GroupedFeed gfResult) { Intent myIntent = new Intent(MainActivity.this, Baseball.class); myIntent.putExtra("Men's Baseball", gfResult); startActivity(myIntent); } private void MensBasketball(GroupedFeed gfResult) { Intent myIntent = new Intent(MainActivity.this, MensBasketball.class); myIntent.putExtra("Men's Basketball", gfResult);…
has comment: http://stackoverflow.com/comment/43229504
has comment: http://stackoverflow.com/comment/43229134
score: 0
has title: How to display data in text view?
has comment: http://stackoverflow.com/comment/43229471
tagged with: android-activity
has comment: http://stackoverflow.com/comment/43229398
answer count: 0
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/43229053
has comment: http://stackoverflow.com/comment/43229353
tagged with: android-intent
has comment: http://stackoverflow.com/comment/43228407
tagged with: java
has comment: http://stackoverflow.com/comment/43228152
type: Question

http://stackoverflow.com/q/27391028
type: AnsweredQuestion
tagged with: java-stream
tagged with: java-8
has answer: http://stackoverflow.com/a/27391086
type: Question
has body: If you have an Array and you want to use the Java8 forEach() method, which approach is better or more efficient: Arrays.asList(new String[]{"hallo","hi"}).forEach(System.out::println); or Arrays.stream(new String[]{"hallo","hi"}).forEach(System.out::println); Is the difference significant or are there any better solutions to solve this?
has answer: http://stackoverflow.com/a/27433464
tagged with: java
score: 17
has title: Arrays.asList vs. Arrays.stream to use forEach()
answer count: 3
has answer: http://stackoverflow.com/a/50771185
downvote count: 0
upvote count: 17
favorite count: 0
has comment: http://stackoverflow.com/comment/43229896
has comment: http://stackoverflow.com/comment/43229884
possible better answer: http://stackoverflow.com/a/27433464
tagged with: lambda
accepted answer: http://stackoverflow.com/a/27391086

infinite-loop
tags question: http://stackoverflow.com/q/27335654
tags question: http://stackoverflow.com/q/27466970
type: Tag
tags question: http://stackoverflow.com/q/27446120
tag name: infinite-loop
tags question: http://stackoverflow.com/q/27373201
tags question: http://stackoverflow.com/q/27459203

http://stackoverflow.com/q/27373838
tagged with: email
linked to: http://stackoverflow.com/q/20771794
has title: Email address validation Vs sending mail for activation?
tagged with: regex
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27373971
type: Question
has body: Well it looks like stupid Question but I recently came across a scenario where I have to decide which way should I do this? Let me explain my case. Email address are used in many other cases apart from just Signup and sending mails e.g. service must be allowed if the request came from the mail, it was sent to not if the mail is forwarded to another address; I assume you got the point. there are two approaches ( as far as I was able to classify, let me know if there are more) viz. while signup, system will send a mail and user has to click on link ( inside mail) in order to activate its account. In just above case; First we are verifying that person who is signing Up owns the email address, Also he wants to use system. So, here we just check that email address provided has '@' in it and we try to send a mail to it. If it is fake it will bounce. Use Regular expression in order to validate email address with certain formats which are in use like person cannot have email address with '! { } &amp; ^ " many more characters, Ultimately It will reduce the mail bouncing as per me. I tried to explain both the cases above; Hereby I ask you which way you think is best? OR There is another way apart from above which is much better?
accepted answer: http://stackoverflow.com/a/27373971
score: 0
has comment: http://stackoverflow.com/comment/43200273
answer count: 1

http://stackoverflow.com/q/27351561
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/43157124
has answer: http://stackoverflow.com/a/27351593
answer count: 3
has comment: http://stackoverflow.com/comment/43232466
favorite count: 0
has title: Boolean variable Explanation
has comment: http://stackoverflow.com/comment/43157120
type: UnansweredQuestion
has body: I have a question about this block of Java code. (Yes, I am a beginner). The code works, I am just a little confused. This code checks the people and cars arrays to find if it has empty seats, which is what the tryToAdd method does. It will then add the person to that car. My question is about the boolean values. It looks to me that added is set to false. Then in the for loop it says: as long as added is true..do the loop. So, it seems that the loop should never run. public void loadPassengers() { for (Person p : people) { boolean added = false; for (int i = 0; !added &amp;&amp; i &lt; cars.size(); i++) { added = cars.get(i).tryToAdd(p); } } }
downvote count: 1
tagged with: java
has answer: http://stackoverflow.com/a/27351603
has answer: http://stackoverflow.com/a/27351625
has comment: http://stackoverflow.com/comment/43157607
type: Question

http://stackoverflow.com/comment/43278263
comment on: http://stackoverflow.com/a/27417155
type: Comment
score: 0
type: AnswerComment
has text: you can gain access to your internal system , but you can't gain access for external system, instead i will recommend go with API that will not be tightly coupled as per your case , because you are giving flexibility to call the URL but when someone calls the URL by using your API , your API is intelligent enough to append these headers along with the request. The only thing you have to do is you have to tell your clients to use your API whenever they call your system.

http://stackoverflow.com/comment/43209749
comment on: http://stackoverflow.com/a/27380243
has text: @dfsq...please see my question again. i have corrected it.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43234879
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27393856
has text: Perhaps [`Path2D@createTransformedShape`](https://docs.oracle.com/javase/7/docs/api/java/awt/geom/Path2D.html#createTransformedShape(java.awt.geom.AffineTransform))

http://stackoverflow.com/a/27392081
type: Answer
answers question: http://stackoverflow.com/q/27391971
has comment: http://stackoverflow.com/comment/43232833
score: 1
has body: You could go with the traditional String#replace way. Example below. File file = ...; try { Scanner scanner = new Scanner(file); while(scanner.hasNextLine()) { String line = scanner.nextLine(); String[] values = line.split("-"); String rank = values[0].replace("[", "").trim(); String suite = values[1].replace("]", "").trim(); System.out.println(rank + " of " + suite + " - Value = " + rank); // ***** } } catch (Exception e) { e.printStackTrace(); } Input: [2-C] Output: 2 of C - Value = 2 You can and should modify that println function to your liking.
upvote count: 1
has comment: http://stackoverflow.com/comment/43234718
downvote count: 0
has comment: http://stackoverflow.com/comment/43231823
accepted answer of: http://stackoverflow.com/q/27391971
has comment: http://stackoverflow.com/comment/43231818
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43231761

http://stackoverflow.com/a/27328519
answers question: http://stackoverflow.com/q/27327630
has body: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/layout" tools:context="com.spencer.app.ProfileActivity"&gt; &lt;ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:minHeight="140dp" android:minWidth="140dp" android:id="@+id/logoBackground" android:layout_marginStart="25dp" android:background="#ffffd0cd" android:layout_centerVertical="true" android:layout_centerHorizontal="true" /&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="U" android:id="@+id/u_textView" android:layout_marginTop="30dp" android:layout_marginLeft="45dp" android:textSize="80sp" android:layout_alignTop="@+id/logoBackground" android:layout_alignLeft="@+id/logoBackground" android:layout_alignStart="@+id/logoBackground" /&gt; I didnot changed much but Its work. Replace your code with this it will work for you. :)
score: 0
type: Answer

http://stackoverflow.com/comment/43152300
type: AnswerComment
score: 0
has text: timeout in socket.connect means connection will timeout if it cannot connect within a certain time.
type: Comment
comment on: http://stackoverflow.com/a/27348750

http://stackoverflow.com/q/27432520
has answer: http://stackoverflow.com/a/27432570
has answer: http://stackoverflow.com/a/27432578
has comment: http://stackoverflow.com/comment/43306606
downvote count: 0
answer count: 7
linked to: http://stackoverflow.com/q/1958636
has title: How to put String arrays into an array of String arrays?
favorite count: 0
type: UnansweredQuestion
score: 5
has comment: http://stackoverflow.com/comment/43306432
has answer: http://stackoverflow.com/a/27432735
tagged with: java
linked to: http://stackoverflow.com/q/4443892
type: Question
has answer: http://stackoverflow.com/a/27432632
has body: I have 4 string arrays like this: String[] array1 = new String{"there", "there2", "there3", "there4"}; String[] array2 = new String{"here","here2","here3"}; String[] array3 = new String{"hi","hi2"}; String[] array4 = new String{"blah","blah2","blah3"}; And I want to put these into an array of arrays that would look something like this: Array myArray = [{"there", "there2", "there3", "there4"}, {"here","here2","here3"},{"hi","hi2"}, {"blah","blah2","blah3"}]; And then would be able to access element in it somewhat like this: myArray[0][1] would equal "there2" myArray[1][2] would equal "here3" Hope that makes sense, how could I go about doing this? I have tried making an ArrayList like this and then adding them but it doesn't seem to work ArrayList&lt;String[]&gt; myArrayList = new ArrayList&lt;String[]&gt;(); myArrayList.add(myArray);
has answer: http://stackoverflow.com/a/27432665
upvote count: 5
tagged with: arrays
has answer: http://stackoverflow.com/a/27432757
has answer: http://stackoverflow.com/a/27432629

http://stackoverflow.com/q/27320522
tagged with: java
type: Question
has title: Error accessing variable of a nested class
tagged with: nested-class
has comment: http://stackoverflow.com/comment/43100548
has answer: http://stackoverflow.com/a/27321032
answer count: 1
has body: I desperately need help. I have two classes. One is a PatientRecord with nested classes in it. The other is a PatientGenerator which fills a database with PatientRecords by generating random data for each field of the PatientRecord. My problem is that I can't access the variables of some of the nested classes but I can access others. (At least it compiles for some and fails with an error for others.) error: cannot find symbol temp.fname = getRFirstName(); symbol: variable fname location: variable temp of type PatientRecord.Visitor Here is the failing calls private ArrayList&lt;PatientRecord.Visitor&gt; generateVisitors(PatientRecord p) { int payments = rnd.nextInt(10); ArrayList&lt;PatientRecord.Visitor&gt; array = new ArrayList&lt;PatientRecord.Visitor&gt;(); for (int i = 0; i &lt; payments; i++) { PatientRecord.Visitor temp = p.new Visitor(); temp.fname = getRFirstName(); temp.lname = getRLastName(); temp.relation = relations[rnd.nextInt(relations.length)]; array.add(temp); } return array; } and here is part of the class with nested class Visitor in it. public class PatientRecord implements Serializable{ public int pId; public String FirstName; public String MiddleName; public String LastName; public boolean gender; public Location location; public ArrayList visitors; public ArrayList emergencyContacts; public DateTime discharge; public Admission admission; public String primaryDoctor; public ArrayList procedures; public ArrayList prescriptions; public ArrayList nurseNotes; public ArrayList doctorNotes; public InsurancePolicy insurancePolicy; public ArrayList billing; // Arraylist of payments public PatientRecord() { init(); } public PatientRecord(int id) { pId = id; init(); } private void init() { visitors = new ArrayList&lt;Visitor&gt;(); emergencyContacts = new ArrayList&lt;Contact&gt;(); location = new Location(); discharge = new DateTime(); admission = new Admission(); procedures = new ArrayList&lt;Procedure&gt;(); prescriptions = new ArrayList&lt;Prescriptio…
score: 0
has comment: http://stackoverflow.com/comment/43100533
has comment: http://stackoverflow.com/comment/43100510
type: UnansweredQuestion

http://stackoverflow.com/comment/43229680
type: Comment
type: QuestionComment
has text: Note the code snippet you've posted has no concurrency concerns, since `map` isn't being accessed by multiple threads. Presumably your actual application *is* using `map` concurrently, but I just wanted to call that out.
comment on: http://stackoverflow.com/q/27390281
score: 0

http://stackoverflow.com/comment/43350040
comment on: http://stackoverflow.com/q/27456286
type: Comment
type: QuestionComment
has text: What does "better" mean? What is your problem?
score: 1

http://stackoverflow.com/q/27315055
answer count: 1
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has title: Hibernate DTD not loading from the classpath, the jar is there, still getting FileNotFoundException
has answer: http://stackoverflow.com/a/27315878
accepted answer: http://stackoverflow.com/a/27315878
tagged with: spring
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/43090301
type: Question
has body: I am getting Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from relative location [hibernate.cfg.xml] Offending resource: ServletContext resource [/WEB-INF/applicationContext.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/WEB-INF/hibernate.cfg.xml]; nested exception is java.io.FileNotFoundException: class path resource [org/hibernate/hibernate-configuration-3.0.dtd] cannot be opened because it does not exist this is the dependency I am using org.hibernate hibernate-core 4.3.5.Final hibernate.cfg.xml - <?xml version='1.0' encoding='UTF-8'?> importing hibernate file in spring using import- <import resource="hibernate.cfg.xml"/> Jar is there in the maven dependencies but still cannot load DTD
tagged with: configuration
has comment: http://stackoverflow.com/comment/43090525
upvote count: 2
has comment: http://stackoverflow.com/comment/43090420

http://stackoverflow.com/comment/43305853
type: Comment
comment on: http://stackoverflow.com/q/27432214
has text: There are no reliable guarantees for shutdown hooks. The only safe assumption is that all other threads are gone.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43277648
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27417091
has text: probably blocking, waiting for a connection - try debugging
score: 0

http://stackoverflow.com/a/27432857
score: 4
has comment: http://stackoverflow.com/comment/43430540
has comment: http://stackoverflow.com/comment/43340421
has comment: http://stackoverflow.com/comment/43323308
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/27420589
has body: There has never been a constructor on the Controller class that took a JAXP Transformer as a parameter, I don't know where you got that idea from. In releases prior to Saxon 9.6, you can cast the Transformer to a Controller if you want to call methods on the Controller object, that is Controller controller = (Controller)transformer; In 9.6, the relationship between Controller and Transformer has changed, because the JAXP API is becoming increasingly unsuitable to take advantage of the facilities becoming available in XSLT 3.0. You can now cast the Transformer to net.sf.saxon.jaxp.TransformerImpl, and from the TransformerImpl you can call getUnderlyingController() to get to the Controller. But do you really want to do it this way? An alternative would be to do factory.setAttribute(FeatureKeys.MESSAGE_EMITTER_CLASS, MyMessageEmitter.class) where MyMessageEmitter is your implementation of Saxon's MessageEmitter inferface.
has comment: http://stackoverflow.com/comment/43446599
has comment: http://stackoverflow.com/comment/43322945
type: Answer

http://stackoverflow.com/q/27343359
tagged with: user-interface
downvote count: 1
has title: How to get input from an EditText field in Android?
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/43142232
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
upvote count: 0
possible better answer: http://stackoverflow.com/a/27343455
has comment: http://stackoverflow.com/comment/43142702
tagged with: java
type: Question
has body: When coding for Android, there are two main ways I have seen to get text from an editText field. The first way seems to be very commonly used, and looks a little like this. display = (EditText) findViewById(R.id.editText1); displayContents = display.getText().toString(); displayTwo = (EditText) findViewById(R.id.editText2); displayText = (Button) findViewById(R.id.button1); displayText.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { displayTwo.setText(displayContents); } This seems to use a clickListener in the mainActivity class to detect the click, then finds the value of the textfields. However, when I was looking through Google's official Android tutorial, they used an alternative method. They first added this line of code to the button: android:onClick="sendMessage"; and then had this method instead of the onClickListener: public void sendMessage(View view) { Intent intent = new Intent(this, DisplayMessageActivity.class); EditText editText = (EditText) findViewById(R.id.edit_message); String message = editText.getText().toString(); intent.putExtra(EXTRA_MESSAGE, message); startActivity(intent); } After that, i created a new activity which made a new xml file with a different GUI, and a new class with the following: public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // Get the message from the intent Intent intent = getIntent(); String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE); // Create the text view TextView textView = new TextView(this); textView.setTextSize(40); textView.setText(message); // Set the text view as the activity layout setContentView(textView); } This seems to have the button broadcast a message rather than having a passive listener, and then trigger a new activity. So after all that, I suppose my question would be which method is better to use? From both a technical and design standpoint, which one works with what situations? Like, when would I use each…
has answer: http://stackoverflow.com/a/27343539
accepted answer: http://stackoverflow.com/a/27343539
has answer: http://stackoverflow.com/a/27343541
score: -1
answer count: 3
has answer: http://stackoverflow.com/a/27343455

http://stackoverflow.com/a/27354573
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43162552
score: 1
has body: Just create a simple classe to hold your data: public class Pair { private String key; private String value; public Pair( String k, String v ) { key = k value = v; } public String getKey() { return key; } public String getValue() { return value; } } And the you just need this to use it: Pair pair = new Pair( "one", "ele );
has comment: http://stackoverflow.com/comment/43162597
downvote count: 0
answers question: http://stackoverflow.com/q/27354481

http://stackoverflow.com/comment/43271678
type: Comment
comment on: http://stackoverflow.com/a/27413746
has text: please if you can add getter and setter concept to your answer
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43183622
type: AnswerComment
has text: @MrNice, What did I just tell you? You can't add an Array to the ListModel. "selected" is an Array!!! You need to add the items in the Array to the ListModel.
type: Comment
comment on: http://stackoverflow.com/a/27365554
score: 0

navigation-drawer
tags question: http://stackoverflow.com/q/27412055
type: Tag
tags question: http://stackoverflow.com/q/27341865
tag name: navigation-drawer
tags question: http://stackoverflow.com/q/27409133

http://stackoverflow.com/q/27314682
has title: How correctly convert this String using substring() Java method?
has answer: http://stackoverflow.com/a/27314911
has answer: http://stackoverflow.com/a/27314736
has comment: http://stackoverflow.com/comment/43090672
tagged with: string
has answer: http://stackoverflow.com/a/27314949
has comment: http://stackoverflow.com/comment/43089380
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27314764
accepted answer: http://stackoverflow.com/a/27314911
tagged with: java
type: Question
answer count: 6
has answer: http://stackoverflow.com/a/27314806
has answer: http://stackoverflow.com/a/27314713
tagged with: substring
score: 0
has body: I have the following problem using the substring() Java function. I have to do the following operation: I have a String representing a date having the following form: 2014-12-27 (YEARS-MONTH-DAY). And I want convert it into a String like this: 20141227 (without the space betwen date component). So I have implemented the following method that use the substring() method to achieve this task: private String convertDate(String dataPar) { String convertedDate = dataPar.substring(0,3) + dataPar.substring(5,6) + dataPar.substring(8,9); return convertedDate; } But it don't work well and return to me wrong conversion. Why? What am I missing?
possible better answer: http://stackoverflow.com/a/27314713

http://stackoverflow.com/q/27342154
answer count: 7
has title: Using Docker in development for Java EE applications
has answer: http://stackoverflow.com/a/33401763
favorite count: 0
has answer: http://stackoverflow.com/a/40602642
type: UnansweredQuestion
has body: I will add 300 points as bounty I have recently started to take a closer look at Docker and how I can use it for faster getting new member of the team up and running with the development environment as well as shipping new versions of the software to production. I have some questions regarding how and at what stage I should add the Java EE application to the container. As I see it there are multiple ways of doing this. This WAS the typical workflow (in my team) before Docker: Developer writes code Developer builds the code with Maven producing a WAR Developer uploads the WAR in the JBoss admin console / or with Maven plugin Now after Docker came around I am a little confused about if I should create the images that I need and configure them so that all that is left to do when you run the JBoss Wildfly container is to deploy the application through the admin console on the web. Or should I create a new container for each time I build the application in Maven and add it with the ADD command in the Dockerfile and then just run the container without ever deploying to it once it is started? In production I guess the last approach is what it preffered? Correct me if I am wrong. But in development how should it be done? Are there other workflows?
tagged with: maven
upvote count: 16
has answer: http://stackoverflow.com/a/27344458
has answer: http://stackoverflow.com/a/34739261
has answer: http://stackoverflow.com/a/29155872
tagged with: java
has answer: http://stackoverflow.com/a/27361131
score: 16
tagged with: jboss
type: Question
tagged with: jakarta-ee
linked to: http://stackoverflow.com/q/27280082
has answer: http://stackoverflow.com/a/27388881
tagged with: docker
downvote count: 0

http://stackoverflow.com/a/27431392
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27430975
downvote count: 0
type: Answer
has body: Interfaces are also more useful when you don't exactly know if all your entities will need to override a specific method. Consider for instance birds, some can fly and some can't. You don't want to force overriding a fly() method in all Bird subclasses. public abstract class Bird(){ ... public abstract void eat(); //all birds eat public abstract void sleep(); //all birds sleep public abstract void fly(); //is wrong here since not all birds can fly } A more correct way would be to define interfaces for specific cases, so in this case public interface Flyable{ abstract void fly(); } Then you can define your subclasses as birds that can fly or not based on the fact they implement the Flyable interface or not. public class Eagle extends Bird implements Flyable{ @override public void fly(); //needed ----- } public class Ostrich extends Bird{ //does't fly }

http://stackoverflow.com/q/27471301
tagged with: java
has answer: http://stackoverflow.com/a/27472844
has answer: http://stackoverflow.com/a/27471728
has answer: http://stackoverflow.com/a/27471370
type: Question
has title: Java: Generic keyvalue like C#
tagged with: c#
has answer: http://stackoverflow.com/a/27471655
tagged with: hashmap
possible better answer: http://stackoverflow.com/a/27472844
has answer: http://stackoverflow.com/a/27472681
has body: I'm currently looking for a way in java to do something like c#. For example in ASP MVC you can write: DoMethod(new {key = value, another = value2}); Is there any nice way to do this in java? I've tried just an array: new object[] {value, value...} However that way i don't get the keys just the values. I know you can do: HashMap&lt;String, object&gt; map = new HashMap(); map.put("key", "value"); map.put("anoter", "value2"); DoMethod(map); Unfortunately is that a cumbersome way if you need to do it a lot. Cheers!
tagged with: arrays
has comment: http://stackoverflow.com/comment/43377437
linked to: http://stackoverflow.com/q/459652
has comment: http://stackoverflow.com/comment/43377388
accepted answer: http://stackoverflow.com/a/27471655
answer count: 5
score: 0
has comment: http://stackoverflow.com/comment/43377406
type: AnsweredQuestion

http://stackoverflow.com/comment/130699910
comment on: http://stackoverflow.com/a/73013833
has text: gradle.properties?
score: 5
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27321101
type: Question
has title: Passing a List of Conditions to a WHERE-clause in JOOQ
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27329892
tagged with: jooq
type: AnsweredQuestion
has body: My question is very simple, really, I just want to know what boolean operator is used in the generated SQL when passing a List of Conditions to a WHERE-clause using JOOQ. For example: List&lt;Condition&gt; conditions = new ArrayList&lt;&gt;(); conditions.add(MY_TABLE.MY_COLUMN1.equal("Foo").and(MY_TABLE.MY_COLUMN2.equal("Far")); conditions.add(MY_TABLE.MY_COLUMN1.equal("Boo").and(MY_TABLE.MY_COLUMN2.equal("Bar")); DSL.selectFrom(MY_TABLE).where(conditions).fetch(); Is the resulting SQL this: SELECT * FROM MY_TABLE WHERE (MY_COLUMN1='Foo' AND MY_COLUMN2='Far') OR (MY_COLUMN1='Boo' AND MY_COLUMN2='BAR'); or this: SELECT * FROM MY_TABLE WHERE (MY_COLUMN1='Foo' AND MY_COLUMN2='Far') AND (MY_COLUMN1='Boo' AND MY_COLUMN2='BAR');
tagged with: java
accepted answer: http://stackoverflow.com/a/27329892
tagged with: mysql

http://stackoverflow.com/q/27447945
has comment: http://stackoverflow.com/comment/43334971
upvote count: 1
has answer: http://stackoverflow.com/a/27454282
type: AnsweredQuestion
has body: I need to insert Text in ImageView, for example I need to use an EditText inside a ImageView and do zoom, draw etc. I think with canvas, I want when I click the ImageView the EditText shows up and write in any place of the ImageView but I don't need the normal EditText. I need transparent EditText only show the characters and can manage the text if that was part of the ImageView.
tagged with: java
type: Question
has title: Insert Text in ImageView
answer count: 2
tagged with: canvas
accepted answer: http://stackoverflow.com/a/27454282
favorite count: 0
has answer: http://stackoverflow.com/a/27449470
tagged with: android
score: -1
possible better answer: http://stackoverflow.com/a/27449470
tagged with: android-edittext
downvote count: 2

http://stackoverflow.com/a/27464020
type: Answer
has body: There is, as of this moment time, no Java support on the Unreal Engine. There is a C# plugin available however, you could probably explore how they accomplished it if you plan on making your own wrapper.
score: 3
accepted answer of: http://stackoverflow.com/q/27463987
upvote count: 3
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27463987

http://stackoverflow.com/q/27339096
tagged with: arraylist
tagged with: nullpointerexception
type: Question
has body: I am currently experiencing error with the following code. import java.util.ArrayList; public class Catapult { ArrayList&lt;Double&gt; distance; Catapult() { ArrayList&lt;Double&gt; distance = new ArrayList&lt;Double&gt;(); } public void calcDistance(Integer[][] data) { int counter = 0; for(int a = 0; a &lt; data.length; a++) { double speed = data[a][0]; for(int x = 0; x &lt; data[0].length; x++) { double radian = Math.toRadians(data[0][1 + x]); double dist = (speed * speed * Math.sin(2 *radian)) / 9.8; distance.add(dist); } } } public void print() { for(int x = 0; x &lt; distance.size(); x++) { System.out.println(distance.get(x)); } } } import java.util.ArrayList; public class CatapultTester { public static void main(String[] args) { Integer[][] data = {{20, 25, 30, 35, 40, 45, 50}, {25, 25, 30, 35, 40, 45, 50}, {30, 25, 30, 35, 40, 45, 50}, {35, 25, 30, 35, 40, 45, 50}, {40, 25, 30, 35, 40, 45, 50}, {45, 25, 30, 35, 40, 45, 50}, {50, 25, 30, 35, 40, 45, 50}}; Catapult range = new Catapult(); range.calcDistance(data); range.print(); } } Whenever I try to run it, I would get java.lang.NullPointerException "Null". This is an assignment that asks to calculate the range of a projectile with different speeds and angles which are stored in the double array data. However, the error keeps showing up and it does not let me add dist to the array list distance.
has answer: http://stackoverflow.com/a/27339208
answer count: 2
upvote count: 1
tagged with: java
downvote count: 5
type: UnansweredQuestion
has title: ap computer science hw error
has comment: http://stackoverflow.com/comment/43134700
has answer: http://stackoverflow.com/a/27339180
has comment: http://stackoverflow.com/comment/43134742
score: -4
has comment: http://stackoverflow.com/comment/43134730
favorite count: 0

http://stackoverflow.com/comment/43345945
has text: You are wellcome, but don't thank in comments: [accept](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) the answer that was useful to you [or upvote if it wasn't your own question](http://blog.stackoverflow.com/2011/01/how-to-say-thanks-in-an-answer/).
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27453593
type: Comment

http://stackoverflow.com/comment/43310142
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27434549
has text: There is no errors thrown.
score: 0

http://stackoverflow.com/q/27395334
has body: I am having a hard time trying to read in a text file into java. Basically, when the program tells me to "Enter file name" I do it. However it comes back as java.io.FileNotFoundException: Students.txt (The system cannot find the file specified) And I don't know why it's doing that. I have spent hours searching the internet for help and nada. I added a screenshot to show how I have my files. I don't know if it helps or not. Well I've tried adding import java.FileNotFoundException and nothing. So this is my code: import java.util.*; import java.io.*; import java.util.Scanner; public class Match { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter file name: "); String filename = input.next(); Student[] student = new Student[100]; for (int i=0; i &lt; 100; i++) student[i]= new Student(); try { Scanner kbd = new Scanner (new FileReader(filename)); int count = 0; while (kbd.hasNextLine()) { Scanner line = new Scanner(kbd.nextLine()); line.useDelimiter("[\t-]"); student[count].setname(line.next()); student[count].setgender(line.next().charAt(0)); student[count].getbirthDay().setmonth(line.nextInt()); student[count].getbirthDay().setday(line.nextInt()); student[count].getbirthDay().setyear(line.nextInt()); student[count].getpref().setquietTime(line.nextInt()); student[count].getpref().setmusic(line.nextInt()); student[count].getpref().setreading(line.nextInt()); student[count].getpref().setchatting(line.nextInt()); count++; } for(int i=0; i&lt; count; i++) { Student s1 = student[i]; Student bestMatch=null; int bestScore=0; int currentScore; if (s1.getmatch()) continue; for (int j= i+1; j&lt;100; j++) { Student s2 = student[j]; currentScore=s1.compare(s2); if (!s2.getmatch() &amp;&amp; (currentScore&gt;0) &amp;&amp; (bestMatch == null || currentScore &gt; bestScore)) { bestMatch = s2; bestScore=s1.compare(bestMatch); } } if (bestMatch != null) { System.out.println(s1.getname() + " matches with " + bestMatch.getname() + "…
has comment: http://stackoverflow.com/comment/43237432
has comment: http://stackoverflow.com/comment/43237222
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43237357
upvote count: 0
has title: Having a hard time reading in a text file into java(Eclipse)
has comment: http://stackoverflow.com/comment/43237401
downvote count: 3
score: -3
has comment: http://stackoverflow.com/comment/43237164
possible better answer: http://stackoverflow.com/a/27395399
has answer: http://stackoverflow.com/a/27395422
accepted answer: http://stackoverflow.com/a/27395422
has comment: http://stackoverflow.com/comment/43237262
type: Question
has comment: http://stackoverflow.com/comment/43237165
has comment: http://stackoverflow.com/comment/43237329
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43237188
answer count: 2
has answer: http://stackoverflow.com/a/27395399
favorite count: 0
has comment: http://stackoverflow.com/comment/43237248

http://stackoverflow.com/a/27385502
has comment: http://stackoverflow.com/comment/43219274
has comment: http://stackoverflow.com/comment/43254112
upvote count: 1
has comment: http://stackoverflow.com/comment/43254949
has comment: http://stackoverflow.com/comment/43219409
type: Answer
has comment: http://stackoverflow.com/comment/43253673
answers question: http://stackoverflow.com/q/27385165
has comment: http://stackoverflow.com/comment/43219366
has body: As an alternative to aurelianus' answer above, to consider for your use case: Sort the items array, then remove the Child objects from the children array in descending order of the indexes. Cost considerations: sorting the list of indexes - depends on the number of indexes to remove whether that's a concern. For every Child object removed all children with higher indexes are shifted by one in the backing array. I suspect this is done with a System.arraycopy(), which would be quite efficient. Still, the cost rises with the number of elements to remove and the number of children with higher indexes. memory is used in-place.
downvote count: 0
score: 1

http://stackoverflow.com/comment/43144156
type: Comment
comment on: http://stackoverflow.com/a/27344311
type: AnswerComment
has text: But I do suggest you look into foreach (used as norm in Java), first have a look at iterator and foreach explanation will follow.
score: 0

http://stackoverflow.com/a/27406569
has body: You seem to be trying to implement the Method for constructing a magic square of odd order. The method prescribes starting in the central column of the first row with the number 1. You seem to have that right. After that, the fundamental movement for filling the squares is diagonally up and right, one step at a time. I would code this as: int newRow = row - 1; int newCol = col + 1; When an "up and to the right" move would leave the square, it is wrapped around to the last row or first column, respectively. This is clearly: if ( newRow &lt; 0 ) { newRow = num - 1; } if ( newCol &gt; num - 1 ) { newCol = 0; } If a filled square is encountered, one moves vertically down one square instead, then continues as before. if (magic[newRow][newCol] != 0) { newRow = row + 1; newCol = col; } I know this doesn't actually solve your problem but I hope it gets you somewhere towards your goal. See how I take the words of the algorithm and match them as accurately as possible with code.
downvote count: 0
answers question: http://stackoverflow.com/q/27405914
has comment: http://stackoverflow.com/comment/43263993
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/43259230

http://stackoverflow.com/q/27460556
answer count: 5
possible better answer: http://stackoverflow.com/a/27460621
has answer: http://stackoverflow.com/a/33603909
tagged with: spring
has answer: http://stackoverflow.com/a/27460621
tagged with: spring-mvc
type: AnsweredQuestion
tagged with: mapping
has answer: http://stackoverflow.com/a/27460852
tagged with: java
has title: Spring 4 - HTTP Status 400, Required parameter is not present
linked to: http://stackoverflow.com/q/17978333
has answer: http://stackoverflow.com/a/27460652
type: Question
upvote count: 4
downvote count: 0
tagged with: jsp
score: 4
has body: I have Spring form in index.jsp: <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <form:form action="save" name="employeeDTO" method="POST"> Name Surname E-mail Salary </form:form> In WorkController.java I try to map form submit (at this moment, it doesn't do anything with data): @Controller public class WorkController { @RequestMapping(value = "/save", method = RequestMethod.POST) public String save(@RequestParam EmployeeDTO employeeDTO){ return "saved"; } } But I got HTTP 400 Status: Required EmployeeDTO parameter 'employeeDTO' is not present with description: The request sent by the client was syntactically incorrect. There is EmployeeDTO.java: public class EmployeeDTO implements Serializable, DTO { private Long id; private String name; private String surname; private String email; private Double salary; public EmployeeDTO(){} public EmployeeDTO(Long id, String name, String surname, String email, Double salary){ this.id = id; this.name = name; this.surname = surname; this.email = email; this.salary = salary; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getSurname() { return surname; } public void setSurname(String surname) { this.surname = surname; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public Double getSalary() { return salary; } public void setSalary(Double salary) { this.salary = salary; } @Override public Serializable toEntity() { return new Employee(getId(), getName(), getSurname(), getEmail(), getSalary()); } } If I remove @RequestParam EmployeeDTO employeeDTO from save method signature - it works, it redirects to saved.jsp file. Earlier, I uses @RequestParam String name, @RequestParam String surname etc to catch data from HTML forms. Is there any solution to "catch" data from Spring form as DTO object? I wolud be happy if …
accepted answer: http://stackoverflow.com/a/27460652
has answer: http://stackoverflow.com/a/27460773
favorite count: 0
linked to: http://stackoverflow.com/q/3423262

http://stackoverflow.com/q/27333468
has body: Apparently to send mail with the Mailer Plugin in Java, you start by getting an instance of the MailerAPI: MailerAPI mail = MailerPlugin.email(); In Playframework version 2.7.3 I get non-static method email() cannot be referenced from a static context MailerPlugin is a Scala Trait. I thus cannot instanciate it nor do I know which class reliably uses/implements that trait (In which case I could create an instance and call email() on it...).
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27334483
score: 0
accepted answer: http://stackoverflow.com/a/27363905
linked to: http://stackoverflow.com/q/14307978
type: Question
possible better answer: http://stackoverflow.com/a/27334483
tagged with: playframework-2.3
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/27363905
has title: Java Playframework 2.3.* and MailerPlugin
tagged with: email

http://stackoverflow.com/comment/43282460
has text: I can't see where any actual geometry is put into your VAO...? Are you sure you are drawing any geometry? Do you see anything when not using shaders? Also: what is `out vec4 color` and why is it not written to nor bound to any output buffer? Many questions... could be anything including the red dot @ratchet mentioned.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27419491

http://stackoverflow.com/q/27441960
has comment: http://stackoverflow.com/comment/43324080
has title: Controller cannot be found in java fx
has comment: http://stackoverflow.com/comment/43324067
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43323403
has comment: http://stackoverflow.com/comment/43323516
answer count: 0
tagged with: java
tagged with: javafx
has comment: http://stackoverflow.com/comment/43323459
type: Question
has comment: http://stackoverflow.com/comment/43326687
score: 0
has comment: http://stackoverflow.com/comment/43323522
has body: I used Eclpse Luna and java 8 to create java fx Project. But when I try following code &lt;VBox fx:controller="com.foo.MainController"&gt; &lt;fx:include fx:id="dialog" source="dialog.fxml"/&gt; ... &lt;/VBox&gt; public class MainController extends Controller { @FXML private Window dialog; @FXML private DialogController dialogController; } it says that the Controller cannot be found
has comment: http://stackoverflow.com/comment/43324018

http://stackoverflow.com/q/27417111
type: Question
has answer: http://stackoverflow.com/a/28905715
has body: My question is when i filter listview with baseadapter than i got perfect result but after click on this item,i can't get related values of that item but i get wrong position item so notifydatasetchenged not work. 'public ConsultationAdpater(Context context, ArrayList&lt;Doctor&gt; doctors) { this.context = context; this.doctorList = doctors; this.mStringFilterList = doctors; getFilter(); imageLoader = ImageLoader.getInstance(); this.inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); // set options for image display options = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.activity_indicator) .showImageForEmptyUri(R.drawable.image_not_available) .showImageOnFail(R.drawable.image_not_available) .resetViewBeforeLoading(true).cacheInMemory(true) .cacheOnDisk(true).considerExifParams(true) .bitmapConfig(Bitmap.Config.RGB_565).build(); } @Override public int getCount() { return doctorList.size(); } @Override public Object getItem(int position) { return doctorList.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder = null; if (convertView == null) { convertView = inflater.inflate(R.layout.row_consult, parent, false); holder = new ViewHolder(); holder.image = (ImageView) convertView .findViewById(R.id.img_row_const); holder.txtName = (TextView) convertView .findViewById(R.id.tDtNm_row_const); holder.txtSpeciality = (TextView) convertView .findViewById(R.id.tDtPt_row_const); holder.txtPrice = (TextView) convertView .findViewById(R.id.tDtPr_row_const); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } Doctor doctor = doctorList.get(position); holder.txtName.setText(doctor.base_user.first_name); holder.txtSpeciality.setText(doctor.specialization); holder.txtPrice.setText(doctor.cost_per_minute + "$/min"); if (images[position] == null) { holder.image.setImageRes…
has title: Getting wrong position after filter listview
answer count: 2
downvote count: 0
tagged with: android-activity
favorite count: 0
type: UnansweredQuestion
tagged with: android
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27417242
upvote count: 1

http://stackoverflow.com/comment/43299622
type: Comment
type: QuestionComment
has text: Did you read [When is SQLiteOpenHelper onCreate() / onUpgrade() run?](http://stackoverflow.com/questions/21881992/when-is-sqliteopenhelper-oncreate-onupgrade-run)?
comment on: http://stackoverflow.com/q/27426786
score: 0

http://stackoverflow.com/a/27436853
has comment: http://stackoverflow.com/comment/43316575
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/27436200
accepted answer of: http://stackoverflow.com/q/27436200
score: 2
type: AcceptedAnswer
downvote count: 0
has body: The meaning of the Scope = "step" is that it create a instance for each step of execution which means that you will have a new instance for each thread. So what should be happening is, once you define "step" scope, the map row is called by a new instance of your processor and it has the starting value 0. It is further indicated when you say that it works properly when you remove the step scope. So what you can do is, keep a static atomic integer (Thread safe) and rely on that counter for your logic rather than relying on the rowNumber. If this does not make sense, share your configuration for further analysis as well. Thanks.
has comment: http://stackoverflow.com/comment/43317813

http://stackoverflow.com/a/27386781
has comment: http://stackoverflow.com/comment/43544428
type: Answer
has comment: http://stackoverflow.com/comment/50428756
answers question: http://stackoverflow.com/q/27385516
score: 0
has body: try this import java.awt.Dimension; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; public class Joption { public static void main(String[] args) { final JFrame f = new JFrame("The Frame"); f.setSize(300, 300); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int width = (int)screenSize.getWidth(); int height = (int)screenSize.getHeight(); f.setLocation((int)(width/4.5), (int)(height/3.5)); JButton play=new JButton("play"); play.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { System.out.print("your code/start meathod goes here"); f.dispose(); }}); f.add(play); f.setVisible(true); } } I don't really understand your code so I cant do any better than this well maybe I could make the button look better but you get the idea. import java.awt.Dimension; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JApplet; import javax.swing.JButton; import javax.swing.JFrame; public class Jap extends JApplet { /** * */ private static final long serialVersionUID = 1L; public void init(){ // r = new Random(); // user = new AnimateSprite(); // user.setImage(getImage(getCodeBase(), "player.gif")); // user.setLocation(0, 0); // monster = new AnimateSprite(); // monster.setImage(getImage(getCodeBase(), "monster.gif")); // monster.setLocation(100, 100); // troll = new AnimateSprite(); //troll.setImage(getImage(getCodeBase(), "monster.gif")); //troll.setLocation(350, 350); //setupCoins(); setFocusable(true); //addKeyListener(this); //thread = new Thread(this); final JFrame f = new JFrame("The Frame"); f.setSize(300, 300); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); int width = (int)screenSize.getWidth(); int height = (int)screenSize.getHeight(); f.setLocation((int)(width/4.5), (int)(height/3.5)); JButton play=new JButton("play"); play.addAction…

nfc
tags question: http://stackoverflow.com/q/27463893
tags question: http://stackoverflow.com/q/27361775
tags question: http://stackoverflow.com/q/27389445
tags question: http://stackoverflow.com/q/27403288
tags question: http://stackoverflow.com/q/27420657
tag name: nfc
tags question: http://stackoverflow.com/q/27355009
type: Tag

http://stackoverflow.com/comment/43166143
type: AnswerComment
score: 0
type: Comment
has text: With this it print output looks like: ľščťžýáíéúäôň�íéúäôňäôň�ň� ľščťžýáíéúäôň�íéúäôňäôň�ň� It looks like everithing is printed ok but there is additional chars printed out !?
comment on: http://stackoverflow.com/a/27355726

http://stackoverflow.com/a/27366219
accepted answer of: http://stackoverflow.com/q/27366154
type: AcceptedAnswer
type: Answer
has body: The name "pool-1-thread-1" is coming from the ExecutorService. If your information that the NPE happens in the line boolean resul t = (boolean) query.getUniqueResult(); is true, it could be one of the following two causes: query is null. query.getUniqueResult() returns null, and (boolean) (Boolean) null throws NullPointerException.
has comment: http://stackoverflow.com/comment/43184484
answers question: http://stackoverflow.com/q/27366154
score: 0

http://stackoverflow.com/comment/43320179
score: 0
comment on: http://stackoverflow.com/q/27440191
has text: I cannot know if you don't show us...
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43243987
type: Comment
has text: that should be visible by default. For example i have "[project_name]/build/classes" and i see folder "build" in my project explorer, right under the libraries
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27395435

http://stackoverflow.com/comment/43120417
comment on: http://stackoverflow.com/a/27331129
has text: the numbers come from a scanner ,basically from the user
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/43094213
score: 0
type: Comment
has text: I added something like this: `@Entity @Table(schema="gmlDatabase"). `@table after `@entity. Is good? If yes, now i get error :"cannot resolve schema". But i assigned data sources and dont know why not working.
type: AnswerComment
comment on: http://stackoverflow.com/a/27316863

http://stackoverflow.com/a/27359383
downvote count: 0
has body: Try a text based xpath search text based xpath solved a lot of issues for me. You just need to make sure you have enough wait time before clicking the element EDIT: try using action By saveButton = By.xpath("//*[.='Save']"); WebElement element = driver.findElement(saveButton); Actions action = new Actions(driver); action.moveToElement(element).build().perform(); driver.findElement(saveButton).click(); Note: untested code written in java
has comment: http://stackoverflow.com/comment/43170926
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43171998
answers question: http://stackoverflow.com/q/27359279
score: 1

http://stackoverflow.com/a/27334566
has body: What i want to know is what is the point of doing it? Well your condition is that no two ISBNs can be the same. You're changing your equals method so that it will consider two Book objects equal if the ISBN is the same. and why are we calling the equals method inside the equals method again? Your ISBN is an Object. When you're comparing two Objects, if you do it like this.. Object1 == Object2 Then you are testing if they are the same object. Not if they have the same value. When you call equals, you are testing some other condition. For example, in the case of String.. String s = new String("Hello"); String s2 = new String("Hello"); s == s2; // Returns false. s.equals(s2); // Returns true. This is because s is not the same object as s2, but it has the same value. Extra Reading Here is a really in depth analysis of why you need to override the hashCode method. Here is an SO detailing exactly why you need to use equals with Objects and not ==.
has comment: http://stackoverflow.com/comment/43140968
downvote count: 0
answers question: http://stackoverflow.com/q/27334545
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/43126242
score: 2

http://stackoverflow.com/a/27590508
has body: The problem turned out to be an import statement for the standard ArrayList, which Eclipse had "helpfully" hidden from me. When I expanded the import list, there it was. Removed it and all works as expected.
answers question: http://stackoverflow.com/q/27464656
accepted answer of: http://stackoverflow.com/q/27464656
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/43301620
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27428394
has text: Taking the heapdump fails because of this bug https://bugs.openjdk.java.net/browse/JDK-8044416

http://stackoverflow.com/a/27420308
has body: You need to initialize the class with something like: CustomCardAccueil myCard = new CustomCardAccueil(mContext, R.mylayout); The context you can get from your activity class using something like MyActivity.this or getApplicationContext(). Then you can use methods such as the class' setText: myCard.setText("blah")
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43283966
upvote count: 2
answers question: http://stackoverflow.com/q/27420082
type: Answer

http://stackoverflow.com/q/27343089
has answer: http://stackoverflow.com/a/27343142
has title: Creating Variable Table Name in SQL through Java?
has comment: http://stackoverflow.com/comment/43141658
accepted answer: http://stackoverflow.com/a/27343096
score: 2
upvote count: 2
type: AnsweredQuestion
tagged with: java
type: Question
answer count: 2
tagged with: sql
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27343096
possible better answer: http://stackoverflow.com/a/27343142
has body: I am trying to make a variable Table name through Java. My code is : public void createTable(String tableName){ try { Statement stmt = con.createStatement(); stmt.executeUpdate("CREATE TABLE '"+tableName+"'" + "(id INTEGER not NULL, " + " username VARCHAR(255), " + " pass VARCHAR(255), " + " age INTEGER, " + " PRIMARY KEY ( id ))"); } catch (SQLException e){ e.printStackTrace(); } } It gives me a syntax error saying: Incorrect syntax near 'VariableTableNameIChose'. Does anyone have any ideas?

http://stackoverflow.com/a/27445179
has comment: http://stackoverflow.com/comment/43329290
has body: You are looking for Factory pattern. You almost did it, just create factory class and move your buildClassAbstract method to it.
upvote count: 2
answers question: http://stackoverflow.com/q/27445075
has comment: http://stackoverflow.com/comment/43329219
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27445075
type: Answer
score: 2

http://stackoverflow.com/comment/43151874
type: Comment
has text: Could you provide the whole code on PasteBin or CollabEdit ?
comment on: http://stackoverflow.com/a/27348050
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43350839
score: 0
type: QuestionComment
type: Comment
has text: @DhavalGondaliya your answer was right i clicked the check option
comment on: http://stackoverflow.com/q/27456238

http://stackoverflow.com/q/27435380
favorite count: 0
tagged with: while-loop
possible better answer: http://stackoverflow.com/a/27435458
accepted answer: http://stackoverflow.com/a/27435469
has answer: http://stackoverflow.com/a/27435458
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/27435469
type: Question
has comment: http://stackoverflow.com/comment/43311756
tagged with: java
tagged with: runtime-error
upvote count: 2
answer count: 3
has answer: http://stackoverflow.com/a/27435573
downvote count: 1
has title: Java Grade Calculator
tagged with: string
has body: My objective is to have the user enter the name of a category, the grade of that category, and the weight of that category. In theory, everything should work perfectly, except my first loop never ends. This is the code I have so far: package gradecalculator; import java.util.Scanner; public class GradeCalculator { public static void main(String[] args) { String categoryName = null; double categoryGrade; double categoryWorth; double Grade = 0; String[] nameArray = new String[10]; double[] gradeArray = new double[10]; double[] worthArray = new double[10]; double[] categoryArray = new double[10]; int c = 0; int c1 = 0; Scanner entry = new Scanner(System.in); while(!"Quit".equals(categoryName)) { categoryName = entry.next(); nameArray[c] = categoryName; categoryGrade = entry.nextDouble(); gradeArray[c] = categoryGrade; categoryWorth = entry.nextDouble(); worthArray[c] = categoryWorth; categoryArray[c] = finalCategory(categoryGrade, categoryWorth); c++; } while(c != 0) { System.out.printf("%S:\t%f%\tWorth: %f\n", nameArray[c1], gradeArray[c1], worthArray[c1]); c--; c1++; } while(c1 != 0) { Grade = Grade + categoryArray[c]; c1--; c++; } } public static double finalCategory(double Grade, double Worth) { return (Grade * (Worth / 100)); } } I believe that the problem has been narrowed down to: while(!"Quit".equals(categoryName)) { categoryName = entry.next(); nameArray[c] = categoryName; categoryGrade = entry.nextDouble(); gradeArray[c] = categoryGrade; categoryWorth = entry.nextDouble(); worthArray[c] = categoryWorth; categoryArray[c] = finalCategory(categoryGrade, categoryWorth); c++; } and more specifically: while(!"Quit".equals(categoryName)) What I am trying to accomplish is that as soon as the user enters the categoryName and it turns out to be the word "Quit", the while loop will be terminated, and the program will move on. Obviously this isn't happening, so I would greatly appreciate any help to solve the problem.

http://stackoverflow.com/comment/43279972
score: 1
type: QuestionComment
has text: Please check [this post](http://stackoverflow.com/questions/13890903/receiving-sms-in-android-manifest-xml). The question itself contains a basic SMS with the described Receiver. Ignore the answers.
type: Comment
comment on: http://stackoverflow.com/q/27411876

http://stackoverflow.com/q/27413818
tagged with: generics
has answer: http://stackoverflow.com/a/27435756
favorite count: 0
has comment: http://stackoverflow.com/comment/43271753
tagged with: parameter-passing
has comment: http://stackoverflow.com/comment/43272059
has comment: http://stackoverflow.com/comment/43272005
has comment: http://stackoverflow.com/comment/43272135
accepted answer: http://stackoverflow.com/a/27418726
linked to: http://stackoverflow.com/q/18471701
type: AnsweredQuestion
score: 0
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/43271819
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/27413112
has body: I changed my method to generic method. What is happening now is that I was deserializing the class inside the methodB and accessing its methods which I can not do anymore. &lt;T&gt; void methodB(Class&lt;T&gt; clazz) { T var; HashMap&lt;String, T&gt; hash = new HashMap&lt;&gt;(); } void methodA () { methodB(classA.class); } Initially inside methodB with no generics, var = mapper.convertValue(iter.next(), ClassA.class); var.blah() //works fine After using generics, var = mapper.convertValue(iter.next(), clazz); var.blah() //cannot resolve the method. How do I access blah() method of classA?
tagged with: class
has comment: http://stackoverflow.com/comment/43272033
has comment: http://stackoverflow.com/comment/43272117
has answer: http://stackoverflow.com/a/27418726
has title: Cannot access class methods via generics
has comment: http://stackoverflow.com/comment/43272102
possible better answer: http://stackoverflow.com/a/27415997
answer count: 3
has comment: http://stackoverflow.com/comment/43271914
has answer: http://stackoverflow.com/a/27415997
tagged with: deserialization
has comment: http://stackoverflow.com/comment/43272124

http://stackoverflow.com/comment/43322899
has text: i checked by my browser it's showing the data
score: 0
comment on: http://stackoverflow.com/q/27441489
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27432248
has title: Splitting String with ".split" but keep delimeters (a string) in match array
tagged with: regex
favorite count: 0
has body: I have this string "name={{0,0,0},{0,0,0},{0,0,0}}lastName={{0,0,0},{0,0,0},{0,0,0}}street[696]{{0,0,0},{0,0,0},{0,0,0}}OK that I'd like to have back into this array: ['name={{0,0,0},{0,0,0},{0,0,0}}', 'lastName={{0,0,0},{0,0,0},{0,0,0}}', 'street[696]{{0,0,0},{0,0,0},{0,0,0}}', 'OK'] I tried with this: String[] tokens = buffer.split("(?&lt;=[a-zA-Z]+)"); but looks like the jvm got stuck! any help?
upvote count: 2
possible better answer: http://stackoverflow.com/a/27432356
answer count: 2
has answer: http://stackoverflow.com/a/27432356
has answer: http://stackoverflow.com/a/27432366
tagged with: java
accepted answer: http://stackoverflow.com/a/27432366
tagged with: split
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: string
type: Question

http://stackoverflow.com/a/32661577
has comment: http://stackoverflow.com/comment/58198366
has comment: http://stackoverflow.com/comment/134668228
upvote count: 21
downvote count: 1
has body: To help anyone who searched this, but can't figure out where the above statement goes... It is placed in the build.gradle which is under the {project_name}/app folder. Specifically: {YourApp} / app / build.gradle And not the build.gradle at the root of the project. Place it inside the "defaultConfig" section. defaultConfig { .... sourceSets.main { jniLibs.srcDir 'src/main/libs' jni.srcDirs = [] //disable automatic ndk-build call } Hopefully, this small advice will prevent someone from spending an excessive amount of time trying to figure out which and where this change needs to be made.
answers question: http://stackoverflow.com/q/27453085
score: 20
type: Answer

http://stackoverflow.com/comment/43349399
comment on: http://stackoverflow.com/q/27455775
score: 0
type: Comment
type: QuestionComment
has text: Can you please share the class code in which you have item name and its price listed ?

http://stackoverflow.com/comment/69111616
has text: @AlexisC.question changed, I hope now is easy to understand what I wanted to ask
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27458444
type: Comment

http://stackoverflow.com/comment/43343531
comment on: http://stackoverflow.com/a/27452061
score: 0
type: Comment
type: AnswerComment
has text: I'm fairly certain it does answer the question; it explains why the ArrayLists would be nonempty even if the OP believed the arrays being used to initialize them were empty.

http://stackoverflow.com/comment/43109588
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27324947
has text: @RuslanOstafiychuk - I attempted to implement it as you suggested however I still get a ' in my title String and it is still force closing: pastebin.com/ZqY1tyFK
score: 0

http://stackoverflow.com/q/27454741
tagged with: java
has title: Mule standalone (command line) cant find a file in its classes folder
type: Question
tagged with: mule
has answer: http://stackoverflow.com/a/27458683
downvote count: 0
answer count: 1
has body: I have a mule flow in Project B that references a Java component in Project A. The projects are structured in the following manner. Project A src/test/java-ComponentClass src/test/resources- propertyfile.properties Project B(Mule project) src/main/app(Flows)- testflow(flow with component referencing ComponentClass) src/main/resources - propertyfile.properties testFlow creates the component class bean in the following manner . &lt;spring:beans&gt; &lt;spring:bean id="beanA" class="com.packagename.ComponentClass"/&gt; &lt;/spring:beans&gt; The following segment shows how the ComponentClass accesses the propertyfile. propFilePath="src/test/resources/propertyfile.properties" File propFile = new File(propFilePath); if(!propFile.exists())// To handle mule flow as mule doesnt bundle src/test/resources { propFilePath=this.getClass().getResource("/propertyfile.properties"); // points to /usr/local/mule/mule-enterprise-standalone-3.6.0-M2/apps/ProjectB-1.0-SNAPSHOT/classes/propertyfile.properties -for standalone.- 1 //propFilePath="propertyfile.properties". &lt;--eclipse-mule plugin-2 } //process the file from its path-- Project A has been compiled in such a way that its test classes are accessible. Project B imports the test-jar from Project A through its pom. Now when I try to run the flow through the mule standalone on my system after building the project. The project fails to deploy on mule throwing a nested exception that the propertyfile is missing and hence the bean creation for ComponentClass has failed. However, upon inspecting the path location in 1-(within the zip) I find that the file actually exists within the classes folder. Any thoughts whats happening and how I could fix it? Also when I place the file in the base folder of ProjectB and provide the path as in line -2 there seem to be no problems when I run the project off the mule runtime in eclipse but this fails when I try to deploy to the standalone. Any feedback or suggestions would be appreciated.
tagged with: eclipse-plugin
favorite count: 0
tagged with: mule-component
tagged with: maven
accepted answer: http://stackoverflow.com/a/27458683
type: AnsweredQuestion
score: 3
upvote count: 3

http://stackoverflow.com/comment/43333071
type: AnswerComment
comment on: http://stackoverflow.com/a/27433938
type: Comment
has text: This is an acceptable answer, and the only one so far. I will give it a shot soon. If no better answer comes I will accept this one.
score: 0

http://stackoverflow.com/comment/43221072
has text: You need to ask a question.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27385516

http://stackoverflow.com/comment/43232411
comment on: http://stackoverflow.com/q/27392432
score: 0
type: Comment
type: QuestionComment
has text: what will happen after that?

http://stackoverflow.com/comment/43239684
type: Comment
score: 1
type: QuestionComment
has text: You're just looking at blind statistics, numbers - at this point in time: lies in the making. What is interesting is where those exceptions are coming from. Then at least you know what to blame rather than just pointing the finger at "jersey 2". More likely it is one of the object mapping technologies that is configured. Dig deeper, don't stop at the first sign of trouble.
comment on: http://stackoverflow.com/q/27396097

http://stackoverflow.com/q/27412937
type: UnansweredQuestion
has body: I need to store a Class object in SharedPreferences so as to be able to retrieve it on another activity. Here is the code: ForecastIO fio = new ForecastIO(apikey); fio.setUnits(ForecastIO.UNITS_SI); fio.setLang(ForecastIO.LANG_ENGLISH); fio.getForecast(""+latif+"",""+longit+""); FIOCurrently currently = new FIOCurrently(fio); How can I store "currently" in a SharedPreferences?
tagged with: android
has comment: http://stackoverflow.com/comment/43270311
has answer: http://stackoverflow.com/a/27423000
has comment: http://stackoverflow.com/comment/43270481
has comment: http://stackoverflow.com/comment/43270241
tagged with: java
tagged with: sharedpreferences
linked to: http://stackoverflow.com/q/2139134
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43271114
has answer: http://stackoverflow.com/a/27423579
score: -1
answer count: 2
upvote count: 0
has title: Save Class object to SharedPreferences
favorite count: 0

http://stackoverflow.com/a/27329989
type: Answer
downvote count: 0
score: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27329903
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27329903
has body: Arrays in Java are fixed-size: their length cannot be changed. So you need to create and return a new array because the result might contain fewer elements. Determine the size of the output array (count the odd values) to know the length of the result array, then iterate over your input and add the odd numbers to the output. Example: public static int[] youMakeMeOdd(int[] arr) { int count = 0; for (int n : arr) if (n % 2 == 1) count++; int[] result = new int[count]; int i = 0; for (int n : arr) if (n % 2 == 1) result[i++] = n; return result; }

http://stackoverflow.com/comment/43274831
score: 1
has text: how does your young generation look like ? if it stays almost empty - may be you can tune the heap distribution to give more to old generation
comment on: http://stackoverflow.com/q/27415368
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27353697
score: 0
has body: Suppose I have a pair of forms in a web application each displayed in a separate html file: form1.html &lt;form action="my_controller.java" method="POST"&gt; First name:&lt;br&gt; &lt;input type="text" name="firstname" value="Mickey"&gt; &lt;br&gt; Last name:&lt;br&gt; &lt;input type="text" name="lastname" value="Mouse"&gt; &lt;br&gt;&lt;br&gt; &lt;input type="submit" value="Next"&gt; &lt;/form&gt; form2.html &lt;form action="my_controller.java" method="POST"&gt; Address:&lt;br&gt; &lt;input type="text" name="address" value="123 My Way"&gt; &lt;br&gt; Favorite Color:&lt;br&gt; &lt;input type="text" name="color" value="Green"&gt; &lt;br&gt;&lt;br&gt; &lt;input type="submit" value="Submit"&gt; &lt;/form&gt; Suppose I also have a Java object: public Person(String firstName, String lastName, String address, String favColor) My question is how am I supposed to handle the submission and control of this form? I entertain the following options: Create a Person object on form1 POST and write do DB with empty strings for the remaining fields then update DB on form2 POST Build up the Person object client side and create the illusion of new pages with AJAX Make use of sessions via the controller and pass this information as the user navigates through the forms It seems like option three is the best solution, though I am not quite sure how to do this. If option 3 is the best practice, how do I do this using the play framework
tagged with: playframework
accepted answer: http://stackoverflow.com/a/27355875
answer count: 1
has title: How to handle multiple successive forms and Java objects
type: AnsweredQuestion
tagged with: java
tagged with: web-applications
has answer: http://stackoverflow.com/a/27355875
tagged with: forms
type: Question
tagged with: session

http://stackoverflow.com/q/27433900
tagged with: int
answer count: 2
has answer: http://stackoverflow.com/a/27433962
accepted answer: http://stackoverflow.com/a/27433953
downvote count: 1
favorite count: 0
upvote count: 0
has body: As far as I know, to convert an integer to a double one can multiply the former by "1.0". It's apparently also possible to add "1d" (the double literal) to it. What, then, is the difference? Thanks!
has comment: http://stackoverflow.com/comment/43308889
has answer: http://stackoverflow.com/a/27433953
tagged with: double
has comment: http://stackoverflow.com/comment/43308897
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27433962
tagged with: java
has comment: http://stackoverflow.com/comment/43308886
tagged with: literals
type: Question
has comment: http://stackoverflow.com/comment/43308956
score: -1
has title: Converting an int to a double by multiplying by 1.0 or adding 1d?

http://stackoverflow.com/q/27337641
has title: Java interrupted during install
has answer: http://stackoverflow.com/a/27337688
tagged with: installation
score: 0
type: UnansweredQuestion
tagged with: 64-bit
type: Question
has body: I have been trying to install Java 6 Update 67 (64 bit) on a computer and I am continuously getting the error that java was interrupted during the install. When I try to delete or uninstall java using tools like javaRA and fixit nothing works. For some reason the computer can install 32 bit java versions, just not the 64 bit versions although it is a 64 bit computer and I checked to make sure of it. Any help would be much appreciated, thank you!
tagged with: java
answer count: 1
tagged with: windows

http://stackoverflow.com/comment/43142324
score: 0
type: Comment
type: QuestionComment
has text: FYI: `len` is not defined and in your for-loop you should also use the same `len` variable and not a constant value. Secondly, I think it would be more appropriate to add a `get(int index)` method to your `ArrayClass` where you return the `input_array[index]` element. so that you can access it in your `main` method like this: `input_array.get(i)`
comment on: http://stackoverflow.com/q/27343448

http://stackoverflow.com/q/27400933
tagged with: swing
has title: Single MouseListener Event to get text from JTextArea
type: Question
tagged with: jtextarea
has answer: http://stackoverflow.com/a/27401044
accepted answer: http://stackoverflow.com/a/27401044
has comment: http://stackoverflow.com/comment/43250098
upvote count: 1
answer count: 1
favorite count: 0
type: AnsweredQuestion
has body: I am creating a football draw app. I currently have 9 text areas which hold 6 different teams. I have attached a MouseListener to each text area. When you click on the text area, you see a new window with each team seperated into a group format. I have an issue trying to get the text from the text areas. I could achieve this by adding a MouseListener to each individual text area but this violates the Don't Repeat Yourself (DRY) principle as far as I am aware. I have included my code below: gui.getTable1().addMouseListener(new tableListener()); gui.getTable2().addMouseListener(new tableListener()); gui.getTable3().addMouseListener(new tableListener()); gui.getTable4().addMouseListener(new tableListener()); gui.getTable5().addMouseListener(new tableListener()); gui.getTable6().addMouseListener(new tableListener()); gui.getTable7().addMouseListener(new tableListener()); gui.getTable8().addMouseListener(new tableListener()); gui.getTable9().addMouseListener(new tableListener()); public static class TableListener implements MouseListener { @Override public void mouseClicked(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseEntered(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mouseExited(MouseEvent e) { // TODO Auto-generated method stub } @Override public void mousePressed(MouseEvent e) { // TODO Auto-generated method stub //get text from text area and pass to new GUI } @Override public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub } } I would like to use the TableListener private class for all my text areas instead of 9 different MouseListeners. I think this can be done in a single line but I can't think how. Can someone please help?
downvote count: 0
tagged with: mouselistener
score: 1
tagged with: java
tagged with: mouse-listeners

http://stackoverflow.com/q/27431001
downvote count: 0
tagged with: jar
has body: I wrote a Java GUI program in Netbeans IDE 8.0.1 called SampleChat and used the 'clean and build' function to create a jar file. I went to the 'dist' directory that Netbeans created and double-clicked the jar file it produced. A cmd window opened with the following line: "Error: could not find or load main class. However, when I opened cmd, changed to the same 'dist' directory and typed the command: java -jar "SampleChat.jar" the program ran just fine. Can I not use Netbeans to create jar files that execute on double-click? I did not use any pre-existing jar files to complete the program, hence, there was no 'lib' directory or anything like that. I intend to share programs from a USB stick so it is vital that the only requirement is a JVM, mouse and maybe some fingers to double-click it. An awkward solution I came up with is to write a batch file that runs the program, but it requires the jar file to not be moved around - screw that. So how do I make my programs double-click executable?
favorite count: 0
accepted answer: http://stackoverflow.com/a/27431117
tagged with: netbeans
upvote count: 1
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/14143015
score: 1
tagged with: java
has title: Java - Executable Jars
type: Question
has answer: http://stackoverflow.com/a/27431117
answer count: 1

http://stackoverflow.com/q/27405766
has body: Sorry for not being clear enough. English is my second language. I have done a complet code down here to generate four random numbers and then printing out four images (image two). I have image one, two, thre, four, five and six. Random tarning = new Random(); String strOutput=""; int nummer; for(int i=1; i&lt;=4; i++){ nummer = 1+tarning.nextInt(6); strOutput=strOutput+" "+nummer; } lblOutput.setText(strOutput); jPanel2.setLayout(new java.awt.GridLayout(1,6)); for(int n=0;n&lt;=3;n++){ x[n].setIcon(new ImageIcon("two.png")); jPanel2.add(x[n]); jPanel2.revalidate(); jPanel2.repaint(); } When it prints out like 1 2 3 4, How can i get image One to print when number one comes and then image two when number two comes etc.
tagged with: java
has comment: http://stackoverflow.com/comment/43256237
has answer: http://stackoverflow.com/a/27406411
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27406662
possible better answer: http://stackoverflow.com/a/27406411
has title: Java, add image when there is a specific number
score: 0
has comment: http://stackoverflow.com/comment/43257402
tagged with: netbeans
has comment: http://stackoverflow.com/comment/43256467
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27406662

http://stackoverflow.com/comment/43374305
type: Comment
comment on: http://stackoverflow.com/a/27469248
type: AnswerComment
has text: Found the last part for my solution, I'll need to use @Transactional(rollbackFor = GenericException.class) to specify my own exceptions that should cause rollback on spring. thanks =)
score: 0

http://stackoverflow.com/comment/43137349
has text: @KelvinHii : plz don't edit your question with another issue , because it makes confusion to someone else which may read this question later. my answer is no longer valid to your issue.make another question
comment on: http://stackoverflow.com/a/27340492
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27445269
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27446488
has comment: http://stackoverflow.com/comment/43331289
answer count: 1
downvote count: 0
favorite count: 0
has body: I have a central 'core' module which contains things such as database and configuration. I also have multiple plugin modules for different platforms such as Eclipse, IntelliJ and Netbeans which depend on the core module. Is there a way I can build one of the plugins with the core module or build all plugins at the same time and save them under different names? Is this something Maven is made to do and if not is there something better suited to what I want to be able to do?
has title: Build selected modules Maven
type: UnansweredQuestion
tagged with: maven
upvote count: 1

http://stackoverflow.com/comment/43300525
type: QuestionComment
score: 1
has text: Why not go through a `List` and use `Collections.shuffle()`?
comment on: http://stackoverflow.com/q/27429538
type: Comment

http://stackoverflow.com/comment/43327911
has text: I think `getSmth()` should return the value of an entity's property `smth` and not its caption, see my example above. Besides that, why do you want to create methods for everything? Isn't that bloat? The captions are `static final` constants, you can easily make the `public` just like I did. But if you want to get accessor methods for them, maybe a code generation step similar to what AspectJ can do via [annotation processing](http://andrewclement.blogspot.de/2014/08/annotation-processing-in-ajdt.html) might be the way to go. I still think this kind of architecture is a nightmare.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27402619

http://stackoverflow.com/comment/43352519
comment on: http://stackoverflow.com/q/27457565
type: QuestionComment
has text: @gknicker oh I'm getting Running a 64-bit JVM is not supported on this platform. on 32 Bit SDK and Running a 32-bit JVM is not supported on this platform. in 64-bit SDK if I type java -d32 -version respectively...
type: Comment
score: 0

synchronized
tags question: http://stackoverflow.com/q/27425705
type: Tag
tag name: synchronized
tags question: http://stackoverflow.com/q/27377351
tags question: http://stackoverflow.com/q/27403110
tags question: http://stackoverflow.com/q/27358881

http://stackoverflow.com/comment/43145405
type: QuestionComment
comment on: http://stackoverflow.com/q/27344766
has text: @TungstenX there are many ways to manipulate session attributes other than by calling a servlet. A session is just an object, which can be manipulated at any point in Java code. And it is not possible to manipulate (or even access) the session object directly from Javascript code.
score: 0
type: Comment

http://stackoverflow.com/comment/43229859
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27336936
has text: @Lincoln I will try to reproduce the problem soon with a different server. I just noticed something interesting. If I run this Google AppEngine app on the localhost, it gives me a proper 404 page. But, if it is hosted on AppEngine and then run, it loops infinitely. I believe this issue might not be because of PrettyFaces afterall!

exception
tags question: http://stackoverflow.com/q/27344161
tags question: http://stackoverflow.com/q/27406960
tags question: http://stackoverflow.com/q/27422154
tags question: http://stackoverflow.com/q/27326588
tags question: http://stackoverflow.com/q/27345835
tags question: http://stackoverflow.com/q/27381938
tags question: http://stackoverflow.com/q/27338064
tags question: http://stackoverflow.com/q/27416612
tags question: http://stackoverflow.com/q/27406571
tags question: http://stackoverflow.com/q/27467422
tags question: http://stackoverflow.com/q/27338753
tags question: http://stackoverflow.com/q/27424855
tags question: http://stackoverflow.com/q/27320717
tags question: http://stackoverflow.com/q/27377423
type: Tag
tags question: http://stackoverflow.com/q/27406590
tags question: http://stackoverflow.com/q/27456124
tags question: http://stackoverflow.com/q/27372562
tags question: http://stackoverflow.com/q/27440327
tags question: http://stackoverflow.com/q/27340619
tags question: http://stackoverflow.com/q/27355646
tags question: http://stackoverflow.com/q/27331080
tags question: http://stackoverflow.com/q/27320813
tags question: http://stackoverflow.com/q/27354971
tags question: http://stackoverflow.com/q/27339505
tags question: http://stackoverflow.com/q/27415444
tags question: http://stackoverflow.com/q/27331116
tags question: http://stackoverflow.com/q/27466774
tags question: http://stackoverflow.com/q/27473519
tags question: http://stackoverflow.com/q/27424237
tags question: http://stackoverflow.com/q/27348657
tags question: http://stackoverflow.com/q/27435094
tag name: exception
tags question: http://stackoverflow.com/q/27392432
tags question: http://stackoverflow.com/q/27383780
tags question: http://stackoverflow.com/q/27352794
tags question: http://stackoverflow.com/q/27335292
tags question: http://stackoverflow.com/q/27364351
tags question: http://stackoverflow.com/q/27457825
tags question: http://stackoverflow.com/q/27432265
tags question: http://stackoverflow.com/q/27367322
tags question: http://stackoverflow.com/q/27460533
tags question: http://stackoverflow.com/q/27376129

http://stackoverflow.com/comment/43285580
score: 0
has text: Zipping in a filter... Why not enable built in tomcat conector GZIP compression?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27421470

http://stackoverflow.com/comment/43315820
comment on: http://stackoverflow.com/q/27437609
score: 0
type: Comment
type: QuestionComment
has text: @user3924466 is your path `productColor` available in `commandObject`, look for the errors in server logs

http://stackoverflow.com/a/27477734
accepted answer of: http://stackoverflow.com/q/27451055
upvote count: 4
has body: Actually you have to put hello.agi mapping with actual java class file in fastagi-mapping.properties file , so that it can find the corresponding AGI file that u call from asterisk..
answers question: http://stackoverflow.com/q/27451055
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43399678
has comment: http://stackoverflow.com/comment/43399267
type: Answer
has comment: http://stackoverflow.com/comment/43397955
has comment: http://stackoverflow.com/comment/43399708
score: 4

http://stackoverflow.com/q/27414163
type: UnansweredQuestion
score: 0
tagged with: java
has title: ProcessBuilder java Unix Commands
type: Question
answer count: 1
has answer: http://stackoverflow.com/a/27414594
has body: I have code like below ProcessBuilder pb = new ProcessBuilder("bash", "-c", " awk -f awkfile " + " file2 " + file1); p = pb.start(); p.waitFor(); p.destroy(); pb = new ProcessBuilder("bash", "-c", " awk -f awkfile " + " file3 " + outFile); p = pb.start(); p.waitFor(); p.destroy(); pb = new ProcessBuilder("bash", "-c", " awk -f awkfile " + " file4 " + outFile); p = pb.start(); p.waitFor(); p.destroy(); awkfile has the contents FILENAME==ARGV[1] {vals[$1FS$2FS$3] = ",Y"; next} !($1FS$2FS$3 in vals) {vals[$1FS$2FS$3] = ",N"} {$(NF+1) = vals[$1FS$2FS$3]; print &gt; "outFile"} The first ProcessBuilder runs fine.The outFile has complete output (I commented out the remaining code and tested). When I include the second ProcessBuilder or third processbuilder then the outFile is incomplete. Is this a space issue or a memory issue. I do not how to find the total space allocated to my home directory. The du command results are below du -s /home/xxxxx 19172 /home/xxxxx the df command results are below df -k /home/xxxxx Filesystem 1K-blocks Used Available Use% Mounted on /dev/mapper/rootvg-homelv 2064208 193068 1766296 10% /home Is the available above 1766296 for the entire /home directory or just for my home directory /home/xxxxx Can you please guide me as to how to get past this issue.
tagged with: unix
has comment: http://stackoverflow.com/comment/43273857

http://stackoverflow.com/a/27456048
upvote count: 1
has body: I guess that the problem is that you're trying to create a Toast not from the main thread. You must create a handler and Runnable for that and use handler.post() For example Runnable showToast = new Runnable() { public void run() { // Create your Toast here or whatever you want } }
type: Answer
answers question: http://stackoverflow.com/q/27455943
downvote count: 0
score: 1

http://stackoverflow.com/comment/52907112
type: Comment
comment on: http://stackoverflow.com/a/31289731
has text: @UmangKothari i have tried above solution which you have mentioned in comment. close() method.
type: AnswerComment
score: 0

http://stackoverflow.com/a/27358636
type: Answer
has body: The problem is with SQL syntax. I suspect the semicolon at the end of the SQL statement. It does not belong there - you probably copied it form some other tool where you tested your query.
downvote count: 1
answers question: http://stackoverflow.com/q/27358495
score: -1
upvote count: 0

http://stackoverflow.com/q/27437230
has title: How to enumerate vertices in a graph
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43332875
has answer: http://stackoverflow.com/a/27437284
type: Question
tagged with: java
tagged with: graph
has body: Given a graph G that I have to make a square product of and make graph H. Graph H will consist of all possible pairs of vertices in G. Basically, a Cartesian product on graph G to produce graph H. in the pseudo code, i am told to build the square H of G by enumerating all pairs of vertices in G in o(n^2) time then construction edges for a total of o(n^3). However i don't understand what is meant by enumerating all pairs of vertices, can someone please explain it to me? Thanks
answer count: 1
tagged with: data-structures
score: 0

http://stackoverflow.com/q/27444564
has comment: http://stackoverflow.com/comment/43328044
has comment: http://stackoverflow.com/comment/43328063
has title: JComboBox. What am I doing wrong?
tagged with: methods
has comment: http://stackoverflow.com/comment/43380215
has comment: http://stackoverflow.com/comment/43328022
has answer: http://stackoverflow.com/a/27445280
upvote count: 0
has comment: http://stackoverflow.com/comment/43328050
has comment: http://stackoverflow.com/comment/43328023
has answer: http://stackoverflow.com/a/27444635
score: -4
has comment: http://stackoverflow.com/comment/43380147
answer count: 4
downvote count: 4
type: AnsweredQuestion
has body: My code is returning the value of c as null! What is wrong with it? I want the value of the index to be added to the string c, but it is not happening and even the first code of System.out.println("C: "+c+" A: "+a+" B: "+b); is returning all the variables as 0! public String getData(){ String c ; c = null; int a = cb1.getSelectedIndex(); int b = cb2.getSelectedIndex(); System.out.println("C: "+c+" A: "+a+" B: "+b); if (a == 1 &amp;&amp; b == 1) { c=""+a; } else if (a == 1 &amp;&amp; b == 2) { c=""+a; } else if (a == 2 &amp;&amp; b == 1) { c=""+a; } else if (a == 2 &amp;&amp; b == 2) { c=""+a; } else if (a == 3 &amp;&amp; b == 1) { c=""+a; } else if (a == 4 &amp;&amp; b == 1) { c=""+a; } else if (a == 4 &amp;&amp; b == 2) { c=""; } else if (a == 5 &amp;&amp; b == 1) { c=""+a+""+b; } else if (a == 5 &amp;&amp; b == 2) { c=""+a+""+b; } else if (a == 6 &amp;&amp; b == 1) { c=""+a+""+b; } else if (a == 7 &amp;&amp; b == 1) { c=""+a+""+b; } else if (a == 8 &amp;&amp; b == 1) { c=""+a+""+b; } else if (a == 8 &amp;&amp; b == 2) { c=""+a+""+b; } else if (a == 8 &amp;&amp; b == 3) { c=""+a+""+b; } System.out.println("C: "+c+" A: "+a+" B: "+b); return c; }
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/27444810
accepted answer: http://stackoverflow.com/a/27444635
has comment: http://stackoverflow.com/comment/43328507
tagged with: jcombobox
has answer: http://stackoverflow.com/a/27444783
possible better answer: http://stackoverflow.com/a/27444810
tagged with: java

http://stackoverflow.com/comment/43205259
type: QuestionComment
comment on: http://stackoverflow.com/q/27363052
has text: On jsp page in form tag modelAttribute will access as controller method parameter. Like you did in form u set modelAttribute as "userAccount" so in controller access that parameter.
score: 0
type: Comment

http://stackoverflow.com/comment/43230761
has text: check, how it is done in maven/ant/gradle/... it's basically a call to the compiler to make it going. but it needs all the source(jars) and might e.g. clash (e.g. java-validation 1.1 vs 1.0). so start it as a new process to be on the safe side?
comment on: http://stackoverflow.com/q/27386012
score: 0
type: QuestionComment
type: Comment

text-files
tags question: http://stackoverflow.com/q/27370489
tag name: text-files
tags question: http://stackoverflow.com/q/27394456
type: Tag
tags question: http://stackoverflow.com/q/27427225
tags question: http://stackoverflow.com/q/27387521
tags question: http://stackoverflow.com/q/27327011
tags question: http://stackoverflow.com/q/27420633

http://stackoverflow.com/q/27380093
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27515928
tagged with: dom
answer count: 3
downvote count: 0
has body: I have the following XML structure button java sample code eclipse jbutton java sample code <.....> Now, I want to retrieve all the Snippet from the above xml when i search using Tags. For instance, if search for "java" then all the nodes that contain tags as "java" must return the snippet. My search query is: //Code/Tags[contains(concat(' ',/text(),' '), ' "+ searchTags[0] +" ')]"; Here, searchTags[0] contains "java". My result set should contain the Snippets of the selected nodes i.e. code1 and code2 from above xml structure.
has answer: http://stackoverflow.com/a/27380755
has answer: http://stackoverflow.com/a/27380243
favorite count: 0
type: UnansweredQuestion
has title: How to search for child nodes in xml using DOM Java
tagged with: http://stackoverflow.com/tag/xml
tagged with: xpath
score: 1
tagged with: java

http://stackoverflow.com/a/27473104
score: 1
answers question: http://stackoverflow.com/q/27472955
has body: There is an example of extracting blobs, I think here. http://www.programcreek.com/java-api-examples/index.php?api=org.apache.commons.fileupload.FileUpload I'm not familiar with the datastore, but as far as I know, Blob types are 'just' wrappers for byte arrays.
type: Answer
accepted answer of: http://stackoverflow.com/q/27472955
upvote count: 1
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/43145592
score: 0
type: Comment
has text: In my opinion is a better approach since it doesn't depend on spring at all. It's the DataSource that does the trick for you. And it should work for JTA aggressive connection release.
comment on: http://stackoverflow.com/a/27343592
type: AnswerComment

http://stackoverflow.com/q/27320510
has title: How to make camera same speed as player
type: Question
tagged with: libgdx
score: 0
has comment: http://stackoverflow.com/comment/43109760
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43104411
has body: I'm making an endless runner on LibGDX with Box2d. I want to make the camera and player move at the same speed so while everything's fine, the player is in the center of the screen. I don't want it to just always make the player the center though, since I want the player to be left behind by the camera if the player gets stuck (ex. behind a crate). With that, I was thinking that I could translate the camera with the same default velocity that the player has. Doesn't work though. Help? render() (with the camera update): dx.gl.glClearColor(0, 0, 0, 1); Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); //stage.getCamera().translate(Constants.DEFAULT_VELOCITY / Constants.PIXELS_TO_BOX, 0, 0); //the commented function call above was what I was thinking; doesnt work stage.getCamera().position.x = player.getX(); batcher.begin(); batcher.draw(AssetLoader.background, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); batcher.end(); stage.draw(); batcher.begin(); debugRenderer.render(gameWorld.getWorld(), debugMatrix); batcher.end(); part of Player: public Player(Texture texture, float x, float y, World world) { this.texture = texture; setWidth(texture.getWidth()); //pixels setHeight(texture.getHeight()); //pixels setPosition((x + getWidth()/2), y + (getHeight()/2)); //pixels setName("player"); BodyDef bodyDef = new BodyDef(); bodyDef.type = BodyType.DynamicBody; bodyDef.position.set(x / Constants.PIXELS_TO_BOX, y / Constants.PIXELS_TO_BOX); //meters body = world.createBody(bodyDef); PolygonShape shape = new PolygonShape(); shape.setAsBox(texture.getWidth()/2 / Constants.PIXELS_TO_BOX , texture.getHeight()/2 / Constants.PIXELS_TO_BOX); //meters FixtureDef fixtureDef = new FixtureDef(); fixtureDef.shape = shape; fixtureDef.density = 1.0f; fixtureDef.friction = 0.0f; fixtureDef.restitution = 0.0f; body.createFixture(fixtureDef); body.setFixedRotation(true); shape.dispose(); body.setUserData(this); } @Override public void act(float delta) { body.setLinearVelocity(new Vector2(Cons…
answer count: 0
tagged with: java
tagged with: box2d

http://stackoverflow.com/comment/43210952
has text: So are you saying that at compile time, the call `itemC.equals(itemB)` is getting resolved and binded to `equals` method of `Object` class. At compile time, `itemC` is of `Object` type and it doesn't know which object it will be storing at runtime then how overloading is taking place here for `itemC.equals`
type: AnswerComment
comment on: http://stackoverflow.com/a/27380766
score: 0
type: Comment

http://stackoverflow.com/comment/43351090
comment on: http://stackoverflow.com/q/27456775
score: 1
has text: @gauravjain m.setHeight(Integer.parseInt(sp_height.getSelectedItem().toString()));
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27465948
accepted answer of: http://stackoverflow.com/q/27465478
answers question: http://stackoverflow.com/q/27465478
type: Answer
has comment: http://stackoverflow.com/comment/43368004
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43368142
has comment: http://stackoverflow.com/comment/43368952
has comment: http://stackoverflow.com/comment/43368210
upvote count: 2
has comment: http://stackoverflow.com/comment/43367978
has body: Your code works for me (after fixing the errors and some cleanup). import java.io.*; import java.util.*; public class FileTree { public static void main(String[] args) { System.err.println(listFiles(new File(args[0]), new FileFilter() { @Override public boolean accept(File pathname) { return true; } })); } public static ArrayList&lt;File&gt; listFiles(File dir, FileFilter filter) { ArrayList&lt;File&gt; files = new ArrayList&lt;File&gt;(); listFiles(dir, files, filter); return files; } private static void listFiles(File dir, ArrayList&lt;File&gt; files, FileFilter filter) { if (!dir.isDirectory()) { return; } for (File file : dir.listFiles()) { if (filter.accept(file)) { files.add(file); } listFiles(file, files, filter); } } }
type: AcceptedAnswer

http://stackoverflow.com/comment/43238399
comment on: http://stackoverflow.com/q/27394499
has text: it changes. but somehow the object cant detect it. if i give level variable a value directly, it is fine. but if i refer the level variable to any int outside its class. the object detect the level as null even if it has value when i check it
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27437021
type: Answer
accepted answer of: http://stackoverflow.com/q/27436972
upvote count: 37
score: 37
type: AcceptedAnswer
downvote count: 0
has body: You need to change permission of xyz.exe chmod u+x /Users/abc/xyz.exe
answers question: http://stackoverflow.com/q/27436972

http://stackoverflow.com/comment/43108309
type: Comment
comment on: http://stackoverflow.com/q/27323858
has text: Yep the server definitely supports ECDHE. When I use Java 7 the initial client hello is passing a variety of ECDHE cipher suites and the server is returning TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA. No sample code ATM, I may provide in the future.
score: 0
type: QuestionComment

http://stackoverflow.com/q/27448337
score: 2
tagged with: java
type: Question
downvote count: 0
has title: In ConcurrentHashMap, What is the benefit of using scanAndLockForPut insted of direct lock() method to aquire the lock on perticular segment?
favorite count: 0
has answer: http://stackoverflow.com/a/27449344
has body: In ConcurrentHashMap, I have below two queries? I have read javadoc comment written in Segment class's source, But could not understood it. What is the functionality of scanAndLockForPut method? What is the benefit of using scanAndLockForPut instead of using lock() method to acquire the lock on particular segment? from javadoc comment, I found that scanAndLockForPut is used to reduce cache misses..What is the cache misses and how this method reduce it ? Thanks..
answer count: 1
upvote count: 2
type: UnansweredQuestion
tagged with: collections

http://stackoverflow.com/q/27326847
type: UnansweredQuestion
upvote count: 1
has body: I'm using Java for this problem. Does anyone know how to randomly take 2 questions out of 3 question String array? Lets say I have a 3x5 string array like this: String TestBank[][] = {{"What color is grass?","A. Green","B. Red","C. Pink","A"}, {"Whats the first month called?","A. December","B. January","C. March","B"}, {"What shape is a soccer ball?","A. square","B. flat","C. round","C"}}; The first column is the question, 2nd-4th column is the answer choices, and the 5th column is the correct answer. I'm trying to figure out how to randomly get 2 questions from these 3 and store those 2 questions into a one dimensional array of 2 rows in which we use the JOptionPane, for outputting, in which takes those questions from the one dimensional array and shows each question separately one by one in different windows with the answer choices included. And after answering the 2 questions, it tells the user the score based off how many questions he/she missed. I'm relatively new to Java and it would be greatly appreciated if someone could help me with this.
has comment: http://stackoverflow.com/comment/43112734
has answer: http://stackoverflow.com/a/27326959
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27327216
has title: Random Generator from String Array
has comment: http://stackoverflow.com/comment/43113150
has comment: http://stackoverflow.com/comment/43112860
tagged with: arrays
downvote count: 0
score: 1
answer count: 3
has comment: http://stackoverflow.com/comment/43113335
has answer: http://stackoverflow.com/a/27327622
favorite count: 0

http://stackoverflow.com/comment/43158672
score: 1
comment on: http://stackoverflow.com/a/27346260
type: AnswerComment
type: Comment
has text: If I write use-expressions="true" then I see errors but if I register bean(as described in answer - works good)

http://stackoverflow.com/comment/43305816
has text: @GilbertoTorrezan As near as I can tell, the op isn't using full screen exclusive mode, even if they were, they should be using the size of the canvas itself
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27431190

http://stackoverflow.com/a/27326616
has comment: http://stackoverflow.com/comment/43112964
has comment: http://stackoverflow.com/comment/43112341
downvote count: 0
has comment: http://stackoverflow.com/comment/43112704
has comment: http://stackoverflow.com/comment/43112209
has comment: http://stackoverflow.com/comment/43112732
has comment: http://stackoverflow.com/comment/43112434
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43112592
has comment: http://stackoverflow.com/comment/43112524
score: 1
answers question: http://stackoverflow.com/q/27326387
has body: It seems like your algorithm is to assume any word that appears capitalized but does not appear uncapitalized is a proper noun. So if that's the case, then you can use the following algorithm to get the proper nouns. //Assume you have tokenized your whole file into a Collection called allWords. HashSet&lt;String&gt; lowercaseWords = new HashSet&lt;&gt;(); HashMap&lt;String,String&gt; lowerToCap = new HashMap&lt;&gt;(); for(String word: allWords) { if (Character.isUpperCase(word.charAt(0))){ lowerToCap.put(word.toLowerCase(),word); } else { lowercaseWords.add(word.toLowerCase); } } //remove all the words that we've found as capitalized, only proper nouns will be left lowercaseWords.removeAll(lowerToCap.keySet()); for(String properNounLower:lowercaseWords) { System.out.println("Proper Noun: "+ lowerToCap.get(properNounLower)); }

http://stackoverflow.com/a/27420003
has body: There are various design principles to solve this. For example: IoC (inversion of control). In software engineering, inversion of control (IoC) describes a design in which custom-written portions of a computer program receive the flow of control from a generic, reusable library. A software architecture with this design inverts control as compared to traditional procedural programming: in traditional programming, the custom code that expresses the purpose of the program calls into reusable libraries to take care of generic tasks, but with inversion of control, it is the reusable code that calls into the custom, or task-specific, code. The most popular framework for this (as far as I know) is Spring. During the instantiation of your objects you start using a factory method. This factory method will check an XML file for possible overruling. Here is an example: &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;beans ...&gt; &lt;bean id="myClass" class="package.my.MyClass" /&gt; &lt;/beans&gt; Alternatively if you don't like the Spring dependency. You can just create something yourself using some reflection: Class defaultClass = package.my.MyClass.class; String overruledClassName = System.getProperty(defaultClassName.getName + ".clazz"); Class clazz = (overruledClassName == null) ? defaultClass : Class.forName(overruledClassName); Object createdObject = clazz.newInstance(); In combination with a property file that contains the following property: package.my.MyClass.clazz = package.my.MyClassVersion2
answers question: http://stackoverflow.com/q/27418777
type: Answer
score: 0

http://stackoverflow.com/comment/43130115
has text: As my answer in the duplicated question says, the error message simply means that you didn't specify the truststore correctly. There is nothing in your question relating to that.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27327931

http://stackoverflow.com/q/27358037
answer count: 4
has body: I am getting the following exception: Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: hibernate.cfg.xml at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1491) at org.hibernate.cfg.Configuration.configure(Configuration.java:1425) at com.ClientForSave.main(ClientForSave.java:26) Caused by: org.dom4j.DocumentException: Connection timed out: connect Nested exception: Connection timed out: connect at org.dom4j.io.SAXReader.read(SAXReader.java:484) at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1481) ... 2 more Entire stack trace Here is my config file: <hibernate-configuration> oracle.jdbc.driver.OracleDriver jdbc:oracle:thin:@localhost:1521:devt2x scott tiger org.hibernate.dialect.Oracle9Dialect true </hibernate-configuration>
score: 0
has answer: http://stackoverflow.com/a/34656158
has answer: http://stackoverflow.com/a/29225494
type: Question
has comment: http://stackoverflow.com/comment/43168410
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/43168445
has title: Exception in thread "main" org.hibernate.HibernateException: Could not parse configuration: hibernate.cfg.xml
has answer: http://stackoverflow.com/a/27358468
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27394920

http://stackoverflow.com/a/27418662
has body: Be aware that there are devices without hardware buttons. If you hide the system bar the user can not navigate out of your activity. Nevertheless you can try to put this inside your Activity's onCreate(): getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LOW_PROFILE ); or this on older devices: getWindow().getDecorView().setSystemUiVisibility( View.STATUS_BAR_HIDDEN ) EDIT: If you in real are talking about the action bar, not the system bar: See this on SO: How to change action bar size
score: 0
has comment: http://stackoverflow.com/comment/43281647
type: Answer
answers question: http://stackoverflow.com/q/27418426
has comment: http://stackoverflow.com/comment/43280701

http://stackoverflow.com/a/27335840
has comment: http://stackoverflow.com/comment/43129895
type: Answer
has comment: http://stackoverflow.com/comment/43128881
has comment: http://stackoverflow.com/comment/43130082
answers question: http://stackoverflow.com/q/27335792
score: 0
has comment: http://stackoverflow.com/comment/43130131
has comment: http://stackoverflow.com/comment/43130756
has body: You need a try catch around that code. That's what "must be caught or declared to be thrown" means. Read this : doc oracle

http://stackoverflow.com/comment/43160786
has text: i edited my post. the exe file contains functions and our java program is suppose to call it rather than manually start the exe file and use its wizard to do things
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27353699

http://stackoverflow.com/q/27326807
has body: I'm using eclipse java and i'm a newbie programmer, lately I've been using different online resources to to try to make my own simple game. However I have run into the issue where DataBufferInt cannot be resolved to a type. public Main() { screen = new Screen(WIDTH, HEIGHT); img = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB); pixels = ((DataBufferInt) img.getRaster().getDataBuffer()).getData(); } ((DataBufferInt) img.getRaster().getDataBuffer()) is where the error is happening. I have tried restarting, and deleting and re-adding the JRE library.
has title: DataBufferInt cannot be resolved to a type
score: 0
answer count: 1
type: AnsweredQuestion
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/27327028
accepted answer: http://stackoverflow.com/a/27327028

http://stackoverflow.com/a/28368044
answers question: http://stackoverflow.com/q/27406712
type: Answer
downvote count: 0
score: 1
upvote count: 1
has body: Reading the documentation, the following seems relevant: Retrieve the default locale using the following method: public static Locale getDefault() The default locale of your application is determined in three ways. First, unless you have explicitly changed the default, the getDefault() method returns the locale that was initially determined by the Java Virtual Machine (JVM) when it first loaded. That is, the JVM determines the default locale from the host environment. The host environment's locale is determined by the host operating system and the user preferences established on that system. Second, on some Java runtime implementations, the application user can override the host's default locale by providing this information on the command line by setting the user.language, user.country, and user.variant system properties. &vellip; Third, your application can call the setDefault(Locale aLocale) method. The setDefault(Locale aLocale) method lets your application set a systemwide resource. After you set the default locale with this method, subsequent calls to Locale.getDefault() will return the newly set locale. So assuming there are no calls to Locale.setDefault(), I'd rule out anything overriding the "hosts default locale" by using something like the following: public class Default { public static void main(String[] args) { System.out.println(System.getProperty("user.language")); System.out.println(System.getProperty("user.country")); System.out.println(System.getProperty("user.variant")); } } And if that doesn't provide any suggestion as to why you're getting a US locale, I'd have to presume that somehow your computer doesn't have its locale set as you expect, or else it's failing to tell the JVM correctly.

http://stackoverflow.com/a/27377418
has body: It is advisable to synchronize as little piece of code as possible, because it generates contentions (other threads waiting). Therefore approach no 1 is preferable.
upvote count: 1
answers question: http://stackoverflow.com/q/27377351
score: 1
downvote count: 0
type: Answer

http://stackoverflow.com/comment/122830852
type: Comment
comment on: http://stackoverflow.com/a/27429646
score: 0
type: AnswerComment
has text: This does not change anything without a restart or reload.

http://stackoverflow.com/q/27389097
downvote count: 0
has comment: http://stackoverflow.com/comment/43251781
favorite count: 0
has body: I created websocket server using Netty 4.1.0.beta3 It is based on the example from Netty repository, but I use shared executor (scheduled single thread executor): EventLoopGroup bossGroup = new NioEventLoopGroup(1); EventLoopGroup workerGroup = new NioEventLoopGroup(1, executor); ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup).channel(NioServerSocketChannel.class) .handler(new LoggingHandler(LogLevel.INFO)) .childHandler(new WsServerInitializer(this)); b.bind(port); Also WsServerInitializer is similar to that from netty repo: public void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast(new HttpServerCodec()); pipeline.addLast(new HttpObjectAggregator(65536)); pipeline.addLast(serverHandler); } The main problem is that the sever often (not always) remains in connecting state. I checked that control goes to LoggingHandler.channelRead() and then my serverHandler is added to pipeline in ServerBootstrap.channelRead(). But after that any of channelRegisterd(), channelActive(), channelRead() in serverHandler are not called. Both netty threads are running and NioEventLoop.run() is processing some tasks. Problem disappears when worker loop group receives its own thread. My question is: how can I debug it? I just don't know where to start. Any suggestions?
type: UnansweredQuestion
tagged with: netty
has comment: http://stackoverflow.com/comment/43260765
answer count: 0
score: 1
tagged with: java
has title: Netty websocket server doesn't pass control to handler
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43250120
has comment: http://stackoverflow.com/comment/43252772

http://stackoverflow.com/a/27424422
has body: first of all : you should use Synchronization if you call class-methods from within listeners like keyPressed or keyReleased - thats because your listener-method can be called from multiple threads so your class-method (player.setDy()) can (and will) be called in parallel - you will need to make sure that each call to setDy happens before the next one. Also : keyTyped is much better in many cases : https://stackoverflow.com/a/7071810/351861 An example could look like this: public void keyTyped(KeyEvent arg0) { if(arg0.getKeyCode() == KeyEvent.VK_UP) { synchronized(player) { player.setDy(-5); } } } this will call setDy sequentially and reliably. Now all you need to do is to make sure that setDy works as intended, hence sets the position only once
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27423907
answers question: http://stackoverflow.com/q/27423907
type: Answer

http://stackoverflow.com/q/27358495
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/43169243
possible better answer: http://stackoverflow.com/a/27358636
has answer: http://stackoverflow.com/a/27358636
tagged with: jdbc
accepted answer: http://stackoverflow.com/a/27358546
has body: I am having problems running this code using PreparedStatement on my MySQL server. It has been doing np before, when I had a standart Statement included. Mind: this is a test program, I am only learning this stuff. The code is: PreparedStatement st = null; try { int id = registry.newID("ID"); if (id == 0) { out.println("Failed to generate a new ID. Terminating dialogue."); return; } String insert = "INSERT INTO registry (ID, NAME, SURNAME, DATE_OF_BIRTH, CITY, STREET) " + "VALUES (?, ?, ?, ?, ?, ?);"; st = registry.getConn().prepareStatement(insert); st.setInt(1, id); st.setString(2, name); st.setString(3, surname); st.setDate(4, date); st.setString(5, city); st.setString(6, street); st.executeUpdate(insert); registry.getConn().commit(); out.println("Added. Add a number? [y/n] "); char choice = in.next().charAt(0); if (choice == 'y') { addNumber(id, registry); } st.close(); } catch (SQLException ex) { out.println("SQL Exception: " + ex); } with params being the following: int id; String name, surname, city, street; java.sql.Date date; This gives me the following exception: SQL Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?, ?, ?, ?, ?, ?)' at line 1 Why aren't the values set in the st.setXXXX statements? Thanks
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/18285444
tagged with: java
tagged with: mysql
has answer: http://stackoverflow.com/a/27358546
duplicate of: http://stackoverflow.com/q/18285444
tagged with: prepared-statement
type: Question
has title: PreparedStatement not putting arguments

http://stackoverflow.com/q/27463831
has comment: http://stackoverflow.com/comment/43363922
has comment: http://stackoverflow.com/comment/43364011
favorite count: 0
has body: Im fairly new to android and java programming and I need help getting all the data with the same key so I can display it in a list view. (At the moment it gets all values no matter what the key is) Here is my code to add the data to SharedPreferences: public void onClick(View v) { // TODO Auto-generated method stub String checkListStringData = etItemName.getText().toString(); checkListData = getSharedPreferences(filename,0); SharedPreferences.Editor checkListEditor = checkListData.edit(); checkListEditor.putString(checkListStringData + "ItemName",checkListStringData); checkListEditor.commit(); String checkListDataReturned = checkListData.getString(currentList + "ItemName", ""); tvTitle.setText(checkListDataReturned); updateListView(); etItemName.setText(""); }; }); } And here is my code to Load the SharedPreferences: private void updateListView() { final ListView lvCheckList = (ListView) findViewById(R.id.lvCheckList); Map&lt;String,?&gt; keys = checkListData.getAll(); ArrayList&lt;String&gt; checkListStrings = new ArrayList&lt;String&gt;(); for(Map.Entry&lt;String,?&gt; entry : keys.entrySet()){ if (entry.getValue() instanceof String) { checkListStrings.add((String) entry.getValue()); } ArrayAdapter&lt;String&gt; checkListArrayAdapter = new ArrayAdapter&lt;String&gt;( this, android.R.layout.simple_list_item_1, checkListStrings ); lvCheckList.setAdapter(checkListArrayAdapter);
has answer: http://stackoverflow.com/a/27463936
type: UnansweredQuestion
tagged with: android
downvote count: 0
score: 1
tagged with: sharedpreferences
has comment: http://stackoverflow.com/comment/43364089
has answer: http://stackoverflow.com/a/27463928
has comment: http://stackoverflow.com/comment/43363966
type: Question
tagged with: java
answer count: 2
upvote count: 1
has title: Android SharedPreferences Get all strings with same key?

http://stackoverflow.com/q/27458973
has title: Shuffling multiple arrayList in the same order?
answer count: 1
accepted answer: http://stackoverflow.com/a/27459038
favorite count: 0
has comment: http://stackoverflow.com/comment/43354816
type: AnsweredQuestion
tagged with: shuffle
tagged with: java
tagged with: loops
downvote count: 1
has comment: http://stackoverflow.com/comment/43354874
type: Question
has answer: http://stackoverflow.com/a/27459038
upvote count: 0
tagged with: arrays
score: -1
has comment: http://stackoverflow.com/comment/43355152
has body: Hi i have 3 arrayList called trackNum, name and duration. The content of the arraylist are connected i.e. Index 1 for trackNum name and duration are linked. So i created a third array list that i populated with numbers that would get shuffled. The numbers would then be used as an index for the system output. I need to shuffle the list so the content of each array list are still connected. This is what i have tried. public void shuffleTracks(String tracks){ for(int i = 0; i &lt; name.size(); i++){ numbers.add(i); } Collections.shuffle(numbers); Iterator&lt;Integer&gt; itr = numbers.iterator(); while (itr.hasNext()){ System.out.println(itr.next()); } for(int a = 0; a &lt; name.size(); a++){ System.out.println(trackNum[numbers[a]] ": " + name[numbers[a]] " " + duration[numbers[a]]); } } I'm getting all my errors on the last system print line, the error says Any help would be greatful.
tagged with: arraylist

http://stackoverflow.com/q/27465393
has comment: http://stackoverflow.com/comment/43366961
has comment: http://stackoverflow.com/comment/43366991
type: AnsweredQuestion
upvote count: 1
tagged with: methods
has body: I'm supposed to write a program that calculate PI by simulating the throwing of darts on an inscribed circle in a square. It will generate random numbers for the x and y values (coordinate points), if x^2+y^ is less than or equal to one then the dart indeed hit the circle, else it didn't (miss). It then calculates pi using this formula: pi = 4 * (hit / total throws). This is something similar to Buffon's Needle Experimentation. As you can see below, I have written the code, however when I compile it, the values of pi aren't even close to 3.14 :( /** * This program is intended to calculate the value of pi by simulating throwing darts at a dart *board. * * @author Nataly Carbonell * @version 12/13/2014 */ import java.util.Scanner; import java.util.Random; public class Darts { public static double[] calcPi(int d, int t) { int hit = 0; int miss = 0; double [] posX = new double[d]; double [] posY = new double[d]; double[] pi = new double[t]; for(int i = 0; i &lt; t; i++) { for(int index = 0; index &lt; d; index++) { posX[index] = 2 * Math.random() + - 1; posY[index] = 2 * Math.random() + - 1; if((Math.pow(posX[index], 2) + Math.pow(posY[index], 2)) &lt;= 1) { hit++; } else if ((Math.pow(posX[index], 2) + Math.pow(posY[index], 2))&gt; 1) { miss++; } } pi[i] = (4 * (hit / d)); } return pi; } public static double calcPiAverage(double[] p, double t) { double average = 0; double sum = 0; for(int i = 0; i &lt; t; i++) { sum += p[i]; } average = sum / t; return average; } public static void printOutput(double [] p, double ave, int t) { for(int i = 0; i &lt; t; i++) { System.out.print("Trial [" + i + "]: pi = "); System.out.printf("%5.5f%n", p[i]); } System.out.printf("Estimate of pi = %5.5f", ave); } public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("How many darts per trial? "); int darts = in.nextInt(); System.out.println("How many trials? "); int trials = in.nextInt(); double [] pi = new double[trials]; pi = calcPi(darts, trials…
type: Question
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43366972
tagged with: random
has comment: http://stackoverflow.com/comment/43367015
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27465425
favorite count: 0
tagged with: static
has title: Is there an error in this program? Calculating PI simulating the throwing of darts JAVA
accepted answer: http://stackoverflow.com/a/27465425
has comment: http://stackoverflow.com/comment/43366979

http://stackoverflow.com/q/27402189
has body: I am using Apache OpenNLP library. I am working on a project that needs several NLP tasks performed in different languages and among those Russian is a very important one. However I do not know russian and cannot find any OpenNLP models for russian. So the only way I can reliably perform sentence detection is to train a sentence detector on a Russian text and produce a model that I will use later. The text I have to analyze is very specific and is not general enough to create a valid model. Therefore I am asking if anyone can provide me a russian reference text divided in sentences that is general enough (contains common idioms, abbreviations, etc...). I don't know how long it should be since the documentation doesn't specify a suggest size for training texts. However, I think that maybe a few hundred sentences would be enough.
has title: Sentence detection in russian
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/27442860
answer count: 1
has comment: http://stackoverflow.com/comment/43249617
tagged with: nlp
favorite count: 0
type: UnansweredQuestion
downvote count: 2
tagged with: opennlp
score: 2
tagged with: java
has comment: http://stackoverflow.com/comment/43249499

http://stackoverflow.com/comment/43273502
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27414569
type: AnswerComment
has text: Thank you so much. Sorry I'm new to Java and our teacher didn't really teach us much so we have to learn ourselves.

http://stackoverflow.com/comment/43167459
type: Comment
score: 1
has text: Check this out: http://stackoverflow.com/questions/4589951/parsing-an-arithmetic-expression-and-building-a-tree-from-it-in-java
comment on: http://stackoverflow.com/q/27357441
type: QuestionComment

http://stackoverflow.com/comment/43361214
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27462468
has text: http://stackoverflow.com/questions/24952312/ontouchlistener-warning-ontouch-should-call-viewperformclick-when-a-click-is-d , http://android-er.blogspot.fr/2014/09/warning-custom-view-overrides.html

http://stackoverflow.com/comment/43366585
score: 0
has text: If you update the code in your answer I'll help, but won't give you the answer.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27464434

http://stackoverflow.com/comment/101476928
type: Comment
comment on: http://stackoverflow.com/a/50081525
score: 2
has text: I'm glad you got it working, but your answer isn't particularly helpful. Saying "Add JVM flags to Maven/Gradle as suggested by IntelliJ" begs the question "What did IntelliJ suggest?" I wish I could use this answer, but I need more info.
type: AnswerComment

http://stackoverflow.com/a/27367810
answers question: http://stackoverflow.com/q/27367676
type: Answer
accepted answer of: http://stackoverflow.com/q/27367676
has body: You have a matrix you want to store. Thus you need a two dimensional Array String array[][]. The First index is the row, the second index is the column. While you read your data with scanner.hasNext() you need to increment the first index counter. Something like this // 'rows' means the count of your rows which you are going to read. // if you don't know the rows you need to use a List instead String[][] matrix = new String[rows][]; int row = 0; while(scanner.hasNext()) { matrix[row] = new String[5]; for(int i = 0; i &lt; 5;i++) { matrix[row][i] = "" + scan.nextInt(); } }
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/43217042
has text: Is it expected that your results are in exactly identical pairs?
comment on: http://stackoverflow.com/q/27383550
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27347706
favorite count: 0
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/27348072
upvote count: 1
downvote count: 1
type: Question
type: AnsweredQuestion
has body: I created an AsyncTaskLoader: public class MyAsyncLoader extends AsyncTaskLoader&lt;List&lt;MyObject&gt;&gt; { private MyDataSource myDb_source; public MyAsyncLoader(Context context) { super(context); myDb_source = new MyDataSource(context); myDb_source.open(); } @Override public List&lt;MyObject&gt; loadInBackground() { List&lt;MyObject&gt; my_records = myDb_source.getAllRecords(); return myObject_records; } @Override public void deliverResult(List&lt;MyObject&gt; data) { if(isStarted()){ super.deliverResult(data); } } } In my Activity class I have something like this: public class InActivity extends Activity implements LoaderCallbacks>{ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_in); . . . . @Override public Loader&lt;List&lt;MyObject&gt;&gt; onCreateLoader(int id, Bundle args) { MyAsyncLoader myAsyncLoader = new MyAsyncLoader(this); return myAsyncLoader; // Here i get the ERROR: Type mismatch: cannot convert from MyAsyncLoader to Loader&lt;List&lt;MyObject&gt;&gt; } return myAsyncLoader; // Here i get the ERROR: Type mismatch: cannot convert from MyAsyncLoader to Loader> How can i make this work? Thanks for help.
tagged with: java
has title: AsyncTaskLoader Type mismatch: cannot convert from MyAsyncLoader to Loader<List<MyObject>>
accepted answer: http://stackoverflow.com/a/27348072
answer count: 1

http://stackoverflow.com/q/27465253
has comment: http://stackoverflow.com/comment/43370247
answer count: 1
tagged with: one-to-one
has title: org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade when collection objecs have a one to one association
type: UnansweredQuestion
score: 0
tagged with: java
tagged with: hibernate
tagged with: hibernate-cascade
type: Question
has body: I run into the "deleted object would be re-saved by cascade" problem when I try to remove a TicketLine object from a collection that belongs to the Ticket class and TicketLine has a OneToOne association to class Reservation. Tickets defines a collection of TicketLines with the following getter class Tickets ... @OneToMany(targetEntity = TicketLine.class, fetch = FetchType.EAGER) @Fetch(org.hibernate.annotations.FetchMode.SUBSELECT) @Cascade({org.hibernate.annotations.CascadeType.ALL, org.hibernate.annotations.CascadeType.LOCK, org.hibernate.annotations.CascadeType.DELETE_ORPHAN,}) public List&lt;TicketLine&gt; getLines() { return ticketlines; } .... class Reservation defines a OneToOne relationship to TicketLines as follows: class Reservation ... @OneToOne() @Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE, org.hibernate.annotations.CascadeType.DELETE_ORPHAN}) @JoinColumn(name = "resource_id") public TicketLine getTicketLine() { return ticketLine; } Adding a TicketLine object to ticket and a Reservation object to the TicketLine object with ticket.getLines().add(line); session.save(ticket); Reservation res = new Reservation(); res.setTicketLine(m_ticketline); .... session.save(res); works as expected. A record in Reservations is being created with the tickets id the resource_id field. When I remove a line from the collection which has an associated Reservation object I get the following error: Save ticket failed: org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): [org.myapp.hibernate.TicketLine#ff8081814a45ebb5014a45ebe4540003] This error only comes up when there is a Reservation associated with the line. Interestingly, a second try in a new session does not throw an exception but the reservation is not deleted! Removing a line from the TicketLines collection can happen at many places, i.e. removing the reservation manually is not really an option. I hope this can be managed by Hiber…
has answer: http://stackoverflow.com/a/27470602
has comment: http://stackoverflow.com/comment/43376222

http://stackoverflow.com/q/27432453
tagged with: libgdx
tagged with: java
has answer: http://stackoverflow.com/a/27432988
score: 0
has answer: http://stackoverflow.com/a/27433630
answer count: 2
has comment: http://stackoverflow.com/comment/43306275
has comment: http://stackoverflow.com/comment/43306681
type: UnansweredQuestion
has body: I am developing a simple-ish game in LibGdx and when I finally got enough code written to test it, it threw this error: Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Couldn't load file: dirt.png at com.badlogic.gdx.graphics.Pixmap.&lt;init&gt;(Pixmap.java:140) at com.badlogic.gdx.graphics.glutils.FileTextureData.prepare(FileTextureData.java:64) at com.badlogic.gdx.graphics.Texture.load(Texture.java:130) at com.badlogic.gdx.graphics.Texture.&lt;init&gt;(Texture.java:121) at com.badlogic.gdx.graphics.Texture.&lt;init&gt;(Texture.java:100) at com.badlogic.gdx.graphics.Texture.&lt;init&gt;(Texture.java:92) at assossa.games.sandbox.blocks.Dirt.&lt;init&gt;(Dirt.java:10) at assossa.games.sandbox.blocks.BlockManager.&lt;init&gt;(BlockManager.java:13) at assossa.games.sandbox.Main.create(Main.java:25) 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: File not found: dirt.png (Internal) at com.badlogic.gdx.files.FileHandle.read(FileHandle.java:136) at com.badlogic.gdx.files.FileHandle.readBytes(FileHandle.java:222) at com.badlogic.gdx.graphics.Pixmap.&lt;init&gt;(Pixmap.java:137) ... 10 more Here is the code loading the image: new Texture(Gdx.files.internal("dirt.png")) and I have the dirt.png file in core->assets
has title: LibGdx won't load an image
type: Question
has comment: http://stackoverflow.com/comment/43306409

http://stackoverflow.com/q/27413794
tagged with: jsp
has body: I am using Eclipse with Web Tool Platform installed. I created a new .jsp page, and trying to use the JSTL core library. However, I can't seem to use it, even though it is valid. Here is the screenshot: The uri I placed is: "http://java.sun.com/jsp/jstl/core". Can someone please explain why is it giving me that error and how do I deal with it?
possible better answer: http://stackoverflow.com/a/30138182
score: 0
has answer: http://stackoverflow.com/a/30138182
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/13285826
linked to: http://stackoverflow.com/q/13285826
type: Question
has answer: http://stackoverflow.com/a/27413857
accepted answer: http://stackoverflow.com/a/27413857
tagged with: java
answer count: 2
tagged with: jstl
has title: JSP jstl core library - Can not find the tag library descriptor

http://stackoverflow.com/comment/43381694
comment on: http://stackoverflow.com/a/27473449
has text: getResourceAsStream works, but getResource gives me URL in form of jndi:/localhost/projectname/META-INF/xyz.txt which I don't know how to use really. I'm just curious, is there I way to have java.io.File object pointing to xyz.txt?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/27445304
tagged with: viewport
accepted answer: http://stackoverflow.com/a/27447529
answer count: 1
downvote count: 0
favorite count: 0
has body: When I start my game using the correct aspect ratio my game is made for everything scales very well when I resize the window but when I start my app using different aspect ratio's things go wrong. I have these globals set in the main game class: public static final int VirtualWidth = 720; public static final int VirtualHeight = 1280; In the screen class i make use of fitviewport. private Stage gameStage; private OrthographicCamera camera; private SpriteBatch batch; private Viewport vp = new FitViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); public GameScreen() { batch = new SpriteBatch(); camera = new OrthographicCamera(ShufflePuzzle.VirtualWidth, ShufflePuzzle.VirtualHeight); camera.setToOrtho(false, ShufflePuzzle.VirtualWidth, ShufflePuzzle.VirtualHeight); FitViewport vp = new FitViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), camera); vp.update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); gameStage = new Stage(vp, batch); Gdx.input.setInputProcessor(gameStage); } @Override public void render(float delta) { Gdx.gl.glClearColor(.2f, .2f, .3f, 1); Gdx.gl.glClear(GL30.GL_COLOR_BUFFER_BIT); gameStage.act(); gameStage.draw(); } @Override public void resize(int width, int height) { vp.update(width,height); gameStage.getViewport().update(width,height, false); } As far as I know i have to set the camera to the actual size of the screen and the viewport to my virtual values. I did try to switch this around with the exact same results. Here is my Desktop config: //The size i made my game for, here everything works like a charm. // If i resize my viewport manually to 1024x768 the screen gets fitted like it should. config.width=720 / 2; config.height=1280 / 2; //When I use below config my stage will not fit the screen. config.width = 1024 * 2; config.height = 768 * 2;
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27447529
upvote count: 1
type: Question
has title: Fitviewport not working properly
tagged with: libgdx
tagged with: scene2d
tagged with: scaling

http://stackoverflow.com/q/27347053
tagged with: jackson
upvote count: 1
favorite count: 0
has body: Can any one help me to know the right way to convert this POJO to json using Jackson ? how can i get the wright type of this class to pass it to readValue(content, valueType) ? thank you. public class GcmMessages&lt;T&gt; { int mType; int mEmpId; Date mDate; T[] mBody; public GcmMessages() { } }
has answer: http://stackoverflow.com/a/27347210
accepted answer: http://stackoverflow.com/a/27347210
tagged with: android
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has title: Jackson DeSerialize Class with <T> (Generic) Type
answer count: 1

http://stackoverflow.com/q/27443129
answer count: 4
has title: Cannot find symbol error in Java with args[]
type: AnsweredQuestion
upvote count: 0
possible better answer: http://stackoverflow.com/a/27443148
tagged with: java
has answer: http://stackoverflow.com/a/27443148
type: Question
has comment: http://stackoverflow.com/comment/43325422
tagged with: command-line-arguments
score: -1
accepted answer: http://stackoverflow.com/a/27443154
has comment: http://stackoverflow.com/comment/43325377
has answer: http://stackoverflow.com/a/27443160
has comment: http://stackoverflow.com/comment/43325412
downvote count: 1
has body: I am a beginner in Java. I am trying to write a program that takes two numbers and a string as a command line argument and it prints out the substring specified by the two numbers. For example: % java Substring hello 1 3 output: ell This is my code inside main: String a = args[1]; String b = args[2]; String d = args[0]; String c = d.subString(a, b); System.out.println(c); The compiler gives me an error saying: error: cannot find symbol symbol: method subString(String,String) location: variable d of type String
has answer: http://stackoverflow.com/a/27443159
has answer: http://stackoverflow.com/a/27443154
favorite count: 0
has comment: http://stackoverflow.com/comment/43325429

http://stackoverflow.com/a/27376367
answers question: http://stackoverflow.com/q/27376283
type: Answer
has body: It's because you trying to get title before it creates. You can try do it with delay in your onCreate method: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_sample); new Handler().postDelayed(new Runnable() { @Override public void run() { android.support.v7.app.ActionBar actionBar = getSupportActionBar(); pageTitle = actionBar.getTitle().toString(); } }, 500); } It works fine.
has comment: http://stackoverflow.com/comment/43202553
score: 0

http://stackoverflow.com/q/27329846
has title: How to read Google+ profile and email scope data with GoogleTokenResponse in Java?
tagged with: java
tagged with: google-oauth
type: Question
tagged with: google-api-java-client
has answer: http://stackoverflow.com/a/27341748
accepted answer: http://stackoverflow.com/a/27341748
answer count: 1
score: 0
tagged with: google-plus
tagged with: oauth-2.0
has body: My goal is to read the user's Google profile and email data (plain Gmail accounts, not a Google+ account, if the user does not have one) on my server with OAuth2. I have used the following guidelines: Google+ Sign-In for server-side apps Migrating to Google+ Sign-In Quick-start sample app for Java Finally, I now have a GoogleTokenResponse Java object on my server that I could use to read the profile and email data from the Google server... if I only knew how. What is the cleanest way of doing this in Java with the Google Java API(s)?
type: AnsweredQuestion

http://stackoverflow.com/comment/43353653
has text: @sol4me `mylist=[4,5,6]` but with its own reference
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27458251
type: QuestionComment

http://stackoverflow.com/comment/43388941
comment on: http://stackoverflow.com/a/27437340
score: 1
type: AnswerComment
has text: It really seems like something isn't setup properly. Surely I can't be the only person with this issue?
type: Comment

http://stackoverflow.com/a/27423423
has comment: http://stackoverflow.com/comment/43299024
upvote count: 2
answers question: http://stackoverflow.com/q/27423109
downvote count: 0
has comment: http://stackoverflow.com/comment/43290051
has body: As Martin points out, you need to select a node, and not the string value of it: DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setNamespaceAware(true); DocumentBuilder builder = domFactory.newDocumentBuilder(); Document doc = builder.parse("chart.xml"); XPath xpath = XPathFactory.newInstance().newXPath(); Node n = (Node) xpath.evaluate("row[@id='1']", doc.getDocumentElement(), XPathConstants.NODE); Then you can use the following serialization helper method (borrowed from Get a node&#39;s inner XML as String in Java DOM): public static String innerXml(Node node) { DOMImplementationLS lsImpl = (DOMImplementationLS)node.getOwnerDocument() .getImplementation() .getFeature("LS", "3.0"); LSSerializer lsSerializer = lsImpl.createLSSerializer(); lsSerializer.getDomConfig().setParameter("xml-declaration", false); NodeList childNodes = node.getChildNodes(); StringBuilder sb = new StringBuilder(); for (int i = 0; i &lt; childNodes.getLength(); i++) { sb.append(lsSerializer.writeToString(childNodes.item(i))); } return sb.toString(); } Like this: String xmlStr = ""; if (n != null) { xmlStr = innerXml(node); }
has comment: http://stackoverflow.com/comment/43314984
type: Answer
score: 2

http://stackoverflow.com/comment/43302314
score: 0
type: Comment
type: QuestionComment
has text: @JasonSperske Yes, but it also refers to fields as in this case.
comment on: http://stackoverflow.com/q/27430484

http://stackoverflow.com/q/27469761
has body: I'm having some issues with stopping my threads. I've tried calling both Thread.join() and Thread.interrupt(), alone and together, but I can't get it working. I have a while loop in each class, which runs as long as a boolean called running equals to true. I then stop the program by calling a method called stop. The stop method only sets running to false, so that the while loop exits. EDIT Code: public class Game implements Runnable { // The Thread private Thread thread; // The program's running state private boolean running = false; // Create the Thread and the rest of the application public void create() { // Create the Thread thread = new Thread(this, "Game"); // Start the Thread thread.start(); // Set the program's running state to true running = true; } public void run() { while(running) { // Render, update etc... } // When the while loop has exited // (when running is false (when the stop method has been called)) try { // Join the thread thread.join(); // Interrupt the thread thread.interrupt(); } catch(InterruptedException e) { // Print the exception message e.printStackTrace(); } // Exit the program System.exit(0); } // Stop the game public void stop() { // Set the program's running state to false running = false; } // The main method public static void main(String[] args) { // Create a new instance of Game and start it new Game().create(); }
answer count: 3
has comment: http://stackoverflow.com/comment/43374671
has comment: http://stackoverflow.com/comment/43374498
has comment: http://stackoverflow.com/comment/43376093
has comment: http://stackoverflow.com/comment/43376255
has title: Thread.join() and Thread.interrupt() doesn't stop the thread
has comment: http://stackoverflow.com/comment/43374583
has answer: http://stackoverflow.com/a/27484555
has comment: http://stackoverflow.com/comment/43374701
favorite count: 0
has answer: http://stackoverflow.com/a/27486938
tagged with: multithreading
possible better answer: http://stackoverflow.com/a/27484555
score: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27474675
has comment: http://stackoverflow.com/comment/43374634
tagged with: java
tagged with: loops
has comment: http://stackoverflow.com/comment/43376493
has comment: http://stackoverflow.com/comment/43376481
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/43376103
has comment: http://stackoverflow.com/comment/43374737
has comment: http://stackoverflow.com/comment/43376216
has comment: http://stackoverflow.com/comment/43374638
downvote count: 0
has comment: http://stackoverflow.com/comment/43376128
has comment: http://stackoverflow.com/comment/43375983
has comment: http://stackoverflow.com/comment/43375436
has comment: http://stackoverflow.com/comment/43374652
accepted answer: http://stackoverflow.com/a/27474675

http://stackoverflow.com/a/27340020
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43138535
accepted answer of: http://stackoverflow.com/q/27339950
type: Answer
has comment: http://stackoverflow.com/comment/43138819
answers question: http://stackoverflow.com/q/27339950
has body: before every connection and statements you need to close any privious connection and statement because sqlite does not support more than one active transactions, so before the first con1.prepareStatement (in the while loop ) in your code, close other previous connections and statements also, I mean pst, con, etc
score: 0

http://stackoverflow.com/comment/43273601
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27414766
has text: did you try to increase the stack size e.g. `-Xss=4m`

http://stackoverflow.com/q/27458526
upvote count: 2
type: UnansweredQuestion
tagged with: animation
type: Question
has comment: http://stackoverflow.com/comment/43487426
has comment: http://stackoverflow.com/comment/43494724
tagged with: java
tagged with: javafx
has body: As succinctly as I can manage: Given that I need the layout information of a node (the actual height/width of a node as rendered) to compute my animation, how can I get that information before javafx draws a frame with it? A little bit longer explanation: I've got a TreeItem that has child items appearing in it (at the front). What I'd like to have is an animation to cause all existing children to slide down to make room for the new item which would slide in. Each child tree-items contents are different and only known at run-time, meaning the height of each child tree item cannot be expressed as a constant. This got me writing code along these lines: groupController.groupTreeItem.getChildren().addListener( new ListChangeListener&lt;TreeItem&lt;Node&gt;&gt;() { @Override public void onChanged(Change&lt;? extends TreeItem&lt;Node&gt;&gt; c) { while(c.next()){ if ( ! c.wasAdded()){ continue; } TreeItem newItem = c.getAddedSublist().get(0) new Timeline( new KeyFrame( seconds(0), new KeyValue(view.translateYProperty(), -1 * newItem.getHeight()) ), new KeyFrame( seconds(1), new KeyValue(view.translateYProperty(), 0) ) ); } } } ); the issue here is that as when a treeItem is added to another, its components aren't laid out by the time the invalidation event is fired, meaning newItem.view.getHeight() returns 0. My next thought was to then have the animation performed as a reaction to both a change in the list content and a sequential change to the height property, (which got me to write some really hideous code that I'd rather not share --listeners adding listeners is not something I really want to write). This almost works, except that javaFX will draw a single frame with the height property set but without the animations translation applied. I could hack down this road further and try to work something out with opacity being toggled and jobs being enqueued for later, but I figured that this would be the path to madness. I'm wondering if there's some pseudo-class foo or so…
has comment: http://stackoverflow.com/comment/43545917
has title: computing JavaFX animation values without knowing layout
answer count: 1
downvote count: 0
favorite count: 0
tagged with: javafx-8
has answer: http://stackoverflow.com/a/31267135
tagged with: javafx-2
score: 2

http://stackoverflow.com/q/27396934
has comment: http://stackoverflow.com/comment/43253641
answer count: 1
downvote count: 0
tagged with: asynchronous
favorite count: 0
has answer: http://stackoverflow.com/a/27411049
type: AnsweredQuestion
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/43255178
accepted answer: http://stackoverflow.com/a/27411049
tagged with: integration-testing
has title: Camel : integration tests of asynchronous routes
type: Question
has body: I have an application using apache camel which has a full coverage of unit tests using the great camel testing support. These tests cover each parts of camel routes and work perfectly. I now want to write integration tests that do not mocks endpoints called by Camel. For example, I want to test a part of the application that behaves like this: Receive a request on a rest endpoint and reply 202 Transform the message and publish it on activemq Read the message from activemq, transform it and push it to a rest endpoint The test look like this // start activemq, applications, etc... WebTarget target = //initialize a JAX RS webtarget DTO data = // generate some datas Response r = target .path("url").request(MediaType.APPLICATION_JSON).post(Entity.json(data)); Assert.assertEquals(r.getStatus(), 202); // stop activemq, applications, etc... This part works great. Now the thing is : if the endpoint replies with a 500 code, I log the error in a mongo database. I want my integration test to check this. I tried this : // start activemq, applications, etc... WebTarget target = //initialize a JAX RS webtarget DTO data = // generate some datas that generate an error Response r = target .path("url").request(MediaType.APPLICATION_JSON).post(Entity.json(data)); Assert.assertEquals(r.getStatus(), 202); Thread.sleep(1000); assertErrors(1); // check in mongo if error is written // stop activemq, applications, etc... I don't like the Thread.sleep(1000). My questions are : Is there a way to know if Camel have finished processing all the messages ? Does it make sense to test the mongo result in this case as it is already covered by a unit test on the portion of the route ? Thanks for advice.
tagged with: testing
score: 3
tagged with: apache-camel

http://stackoverflow.com/comment/43160727
comment on: http://stackoverflow.com/q/27353699
score: 0
has text: do what? what is needed to do? run a command line in java? or just run the program?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43324061
has text: And by the way, to completely avoid leaking `this`, you also have to make `ep` static, move the `ep = new EventProducer()` line in the static initialization block, and change `exec.submit(INSTANCE.ep)` to `exec.submit(ep)`. Should i make the changes?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27441412
type: Comment

http://stackoverflow.com/comment/43371363
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27467944
has text: well but if I implement that and then run my application in eclipse and type in my terminal "info" (returning my current numbers array(standard: {1})) it is printing in 1 but if I know enter insert 3 it is still printing in a 1(like with my info command) if I now rerun it and start with insert 3 instead of info and then call info again it does nothing (Updated main thread)

http://stackoverflow.com/a/27365254
downvote count: 0
score: 6
has body: You're calling Double.parseDouble, which always uses a dot as the decimal separator - it doesn't use the default locale at all. Double.parseDouble is documented to behave like Double.valueOf(String), which has documentation including: To interpret localized string representations of a floating-point value, use subclasses of NumberFormat.
has comment: http://stackoverflow.com/comment/43182627
upvote count: 6
has comment: http://stackoverflow.com/comment/43182447
type: Answer
answers question: http://stackoverflow.com/q/27365133

http://stackoverflow.com/comment/43152061
comment on: http://stackoverflow.com/a/27347997
type: AnswerComment
score: 0
type: Comment
has text: Do you have Spring facet configured in Project Structure? If you don't have it configured, IntelliJ won't know that UserDao is actually used as Spring Bean (which is defined in your AppConfig class) and therefore it will show the warnings.

http://stackoverflow.com/q/27378546
has comment: http://stackoverflow.com/comment/43206749
has comment: http://stackoverflow.com/comment/43206819
tagged with: eclipse
has title: Load site in firefox when use selenium web driver
has body: My default browser is firefox. But when I trying to load a file using selenium web driver it automatically load through google Chrome. How can I change it to firefox? Eclipse preferences also has set to default browser. package com.selenium.example; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; public class ExampleSelenium { public static void main(String[] args) { FirefoxDriver driver = new FirefoxDriver(); driver.get("http://localhost:3030/fuseki.html"); }}
type: AnsweredQuestion
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/43206540
score: -1
tagged with: selenium-webdriver
has answer: http://stackoverflow.com/a/27379254
has comment: http://stackoverflow.com/comment/43206995
upvote count: 2
tagged with: java
downvote count: 3
tagged with: selenium
has comment: http://stackoverflow.com/comment/43206892
accepted answer: http://stackoverflow.com/a/27379254
answer count: 1
has comment: http://stackoverflow.com/comment/43207188

http://stackoverflow.com/comment/43111828
score: 2
has text: and also read this answer http://stackoverflow.com/a/5052359/3680684
comment on: http://stackoverflow.com/q/27325927
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43372919
type: QuestionComment
score: 2
has text: Routing is not up to the Java VM or even to the application running in it. When traffic is going through the wrong route the runing must be configured the wrong way on the machine.
comment on: http://stackoverflow.com/q/27468844
type: Comment

http://stackoverflow.com/comment/43165329
has text: What content is present on your Second Screen that you want to show partially ?
comment on: http://stackoverflow.com/q/27356053
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43346623
type: Comment
score: 0
has text: Thank you. Yes, the logic depends on the code as well as something is displayed to the user. The mechanism is being used for various types. Unfortunately the database design is out of my hands and several developers from several countries mess with it. So I rather prefer I can prove inconsistencies immediately. I didn't know that you could put constraints on the values of a databse columns. I'll look into it.
type: AnswerComment
comment on: http://stackoverflow.com/a/27454195

http://stackoverflow.com/comment/43168921
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27358380
type: Comment
has text: Late to the party & well, pretty sure that is not what he wants.. Truth is, we don't really know what he wants either!

http://stackoverflow.com/q/27348657
answer count: 2
has answer: http://stackoverflow.com/a/27348738
accepted answer: http://stackoverflow.com/a/27348738
upvote count: 1
downvote count: 1
tagged with: infinity
has comment: http://stackoverflow.com/comment/43152079
tagged with: exception
has title: Java Exception Handling for Infinity
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27348696
tagged with: java
has body: I am trying to write a program to equate the value of any number to any power, and I'm suppose to implement exception handling for exponents less than zero which i successfully did and also exception handle for when the value is too large to output i.e. infinity. heres my power class which contains the function Power : public class power { // instance variables - replace the example below with your own public static double Power(double base, int exp) throws IllegalArgumentException { if(exp &lt; 0){ throw new IllegalArgumentException("Exponent cannot be less than zero"); } else if(exp == 0){ return 1; } else{ return base * Power(base, exp-1); } } } Heres the Test class : public class powerTest { public static void main(String [] args) { double [] base = {2.0, 3.0, 2.0, 2.0, 4.0 }; int [] exponent = {10, 9, -8, 6400, 53}; for (int i = 0; i &lt; 5; i++) { try { double result = power.Power(base[i], exponent[i]); System.out.println("result " + result); } catch (IllegalArgumentException e) { System.out.println(e.getMessage()); } catch (ArithmeticException e) { System.out.println(e.getMessage()); } } } } heres the output of the test : result 1024.0 result 19683.0 Exponent cannot be less than zero result Infinity result 8.112963841460668E31 my question is how can i get "result infinity" to say something else through ArithmeticException handling something along the lines of "Floating point Overflow"? thanks in advance.
favorite count: 0
has answer: http://stackoverflow.com/a/27348696
has comment: http://stackoverflow.com/comment/43152090
type: Question
has comment: http://stackoverflow.com/comment/43152110
score: 0

http://stackoverflow.com/comment/43251903
type: Comment
type: QuestionComment
score: 1
has text: Why did you think the numbers here would be `long` ?
comment on: http://stackoverflow.com/q/27403638

http://stackoverflow.com/a/27445096
score: 2
upvote count: 2
has body: It is possible that they might share a connection pool (which is safe enough, because each application has its' own instance). If you run a long query from "a" then queries from "b" may well hang until the query from "a" completes, it depends on what the transaction isolation level is set to in the database (also, when you share a database - not a connection - what you do from one application can take resources from the other; which is what appears to have happened).
has comment: http://stackoverflow.com/comment/43335656
has comment: http://stackoverflow.com/comment/43335979
has comment: http://stackoverflow.com/comment/43350860
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27445045
accepted answer of: http://stackoverflow.com/q/27445045
type: Answer

http://stackoverflow.com/q/27329001
score: 0
accepted answer: http://stackoverflow.com/a/27329052
has comment: http://stackoverflow.com/comment/43116588
tagged with: android
has comment: http://stackoverflow.com/comment/43116643
tagged with: httpurlconnection
favorite count: 0
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/43117117
upvote count: 1
has body: I am trying to ping the server in asynk task but the i am getting sockettimeout exception when i enter a invalid port number so that causes app hang. Post method of the asynk task is never called &amp; app does not respond may i know why it happening. I am using the following code for this purpose. private class UrlDataProvider3 extends AsyncTask&lt;String, Void, String&gt; { String ret=""; int checkStatus; Boolean exception=false; @Override protected String doInBackground(String... url) { HttpURLConnection con = null; try { Log.i("RAE", "urlData"+url[0]); HttpURLConnection.setFollowRedirects(true); con = (HttpURLConnection) new URL(url[0]).openConnection(); con.setRequestMethod("POST"); con.setConnectTimeout(20000); } catch (IOException e) { if(e.toString().contains("java.net.SocketTimeoutException:")) { log.i("Hello","Exception Occurs"); return null; } } return ret; } @Override protected void onPostExecute(String result) { // TODO Auto-generated method stub super.onPostExecute(result); Log.i("RAE"," Asyc finished"); }
downvote count: 1
type: Question
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43116527
has comment: http://stackoverflow.com/comment/43117035
answer count: 1
has answer: http://stackoverflow.com/a/27329052
has comment: http://stackoverflow.com/comment/43117467
has comment: http://stackoverflow.com/comment/43117253
has title: sockettimeoutexception causing app hang

http://stackoverflow.com/comment/43400968
type: Comment
has text: It's a trade off, and it depends heavily on how your sending it. As for your comment about it being 48 and you want 49, well in that case you just need to add an extra bit in the output like so - UDH + x + Payload. You will need to shift everything after the extra bit left by 7 places though. Out of interest, exactly how are you sending your SMS?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27433800

http://stackoverflow.com/comment/43331277
score: 5
comment on: http://stackoverflow.com/q/27445848
type: Comment
type: QuestionComment
has text: This question appears to be off-topic because it is about a customer support issue, not a practical programming problem.

http://stackoverflow.com/comment/43220329
type: QuestionComment
type: Comment
has text: And by `index` do you mean array indices? Like `items` will contain an `index` for an item in the `children` array that should be removed?
comment on: http://stackoverflow.com/q/27385165
score: 0

http://stackoverflow.com/comment/65563521
score: 0
type: Comment
has text: This is a terrible solution. What if the date is in a different timezone such as Fri Oct 10 23:11:29 PDT 2014 or other? Is he suppose to string replace for every possible timezone possibility?
type: AnswerComment
comment on: http://stackoverflow.com/a/27375633

http://stackoverflow.com/a/27361043
has comment: http://stackoverflow.com/comment/43200970
score: 0
type: Answer
has body: Use this syntax to install jar to your local repo: mvn install:install-file -Dfile=pathToYpurJarFile -DgroupId=mavenGroupId -DartifactId=mavenAtrifactId -Dversion=yourVersion -Dpackaging=jar
answers question: http://stackoverflow.com/q/27360990

spring-mvc
tags question: http://stackoverflow.com/q/27364744
tags question: http://stackoverflow.com/q/27314243
tags question: http://stackoverflow.com/q/27467591
tags question: http://stackoverflow.com/q/27318336
tags question: http://stackoverflow.com/q/27320902
tags question: http://stackoverflow.com/q/27372739
tags question: http://stackoverflow.com/q/27316011
tags question: http://stackoverflow.com/q/27368877
tags question: http://stackoverflow.com/q/27466934
tags question: http://stackoverflow.com/q/27470387
tags question: http://stackoverflow.com/q/27444908
tags question: http://stackoverflow.com/q/27393321
tags question: http://stackoverflow.com/q/27470278
tags question: http://stackoverflow.com/q/27390591
tags question: http://stackoverflow.com/q/27409507
tags question: http://stackoverflow.com/q/27413999
tags question: http://stackoverflow.com/q/27438314
tags question: http://stackoverflow.com/q/27431206
tags question: http://stackoverflow.com/q/27438473
tags question: http://stackoverflow.com/q/27446023
tags question: http://stackoverflow.com/q/27316983
tags question: http://stackoverflow.com/q/27461043
tags question: http://stackoverflow.com/q/27332950
tags question: http://stackoverflow.com/q/27449611
tags question: http://stackoverflow.com/q/27394773
tags question: http://stackoverflow.com/q/27466170
tags question: http://stackoverflow.com/q/27315227
tags question: http://stackoverflow.com/q/27406178
tags question: http://stackoverflow.com/q/27324092
tags question: http://stackoverflow.com/q/27435617
tag name: spring-mvc
tags question: http://stackoverflow.com/q/27373042
tags question: http://stackoverflow.com/q/27442366
tags question: http://stackoverflow.com/q/27388045
tags question: http://stackoverflow.com/q/27340536
tags question: http://stackoverflow.com/q/27413505
tags question: http://stackoverflow.com/q/27337759
tags question: http://stackoverflow.com/q/27330318
tags question: http://stackoverflow.com/q/27427179
tags question: http://stackoverflow.com/q/27433931
tags question: http://stackoverflow.com/q/27349530
tags question: http://stackoverflow.com/q/27422220
tags question: http://stackoverflow.com/q/27451255
tags question: http://stackoverflow.com/q/27407834
tags question: http://stackoverflow.com/q/27334637
tags question: http://stackoverflow.com/q/27413201
tags question: http://stackoverflow.com/q/27411774
type: Tag
tags question: http://stackoverflow.com/q/27414922
tags question: http://stackoverflow.com/q/27419834
tags question: http://stackoverflow.com/q/27365960
tags question: http://stackoverflow.com/q/27356526
tags question: http://stackoverflow.com/q/27396478
tags question: http://stackoverflow.com/q/27347616
tags question: http://stackoverflow.com/q/27390413
tags question: http://stackoverflow.com/q/27471781
tags question: http://stackoverflow.com/q/27462811
tags question: http://stackoverflow.com/q/27392785
tags question: http://stackoverflow.com/q/27413202
tags question: http://stackoverflow.com/q/27457991
tags question: http://stackoverflow.com/q/27460556
tags question: http://stackoverflow.com/q/27402803
tags question: http://stackoverflow.com/q/27360966
tags question: http://stackoverflow.com/q/27465753
tags question: http://stackoverflow.com/q/27460699
tags question: http://stackoverflow.com/q/27440166
tags question: http://stackoverflow.com/q/27369032
tags question: http://stackoverflow.com/q/27339933
tags question: http://stackoverflow.com/q/27464343
tags question: http://stackoverflow.com/q/27447527
tags question: http://stackoverflow.com/q/27393599
tags question: http://stackoverflow.com/q/27419743
tags question: http://stackoverflow.com/q/27469104
tags question: http://stackoverflow.com/q/27455245
tags question: http://stackoverflow.com/q/27392915
tags question: http://stackoverflow.com/q/27426389
tags question: http://stackoverflow.com/q/27353741
tags question: http://stackoverflow.com/q/27399806
tags question: http://stackoverflow.com/q/27428610
tags question: http://stackoverflow.com/q/27399631

http://stackoverflow.com/q/27416408
has comment: http://stackoverflow.com/comment/43294236
type: Question
tagged with: casting
has title: Java: How to create a new instance from a TypeReference object?
tagged with: jackson
has answer: http://stackoverflow.com/a/50599525
score: 0
has comment: http://stackoverflow.com/comment/43276605
tagged with: types
answer count: 1
has body: I have a method that accepts a com.fasterxml.jackson.core.type.TypeReference and returns an object of the referenced type, but in a certain case I want to just return a new instance of that type. Example: public &lt;T&gt; T getProperty(String property, TypeReference&lt;T&gt; typeReference) { try { return someInstanceOfReferencedType(); } catch (IOException e) { return ???; } } How can I instantiate &lt;T&gt; using typeReference? I can get the Type from it, but not sure what to do from there...
has comment: http://stackoverflow.com/comment/43276766
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43276741
has comment: http://stackoverflow.com/comment/43276910
has comment: http://stackoverflow.com/comment/43276643
tagged with: instantiation
tagged with: java
linked to: http://stackoverflow.com/q/1090458

http://stackoverflow.com/a/27364526
accepted answer of: http://stackoverflow.com/q/27364098
upvote count: 4
has comment: http://stackoverflow.com/comment/43189119
answers question: http://stackoverflow.com/q/27364098
has comment: http://stackoverflow.com/comment/43185091
has comment: http://stackoverflow.com/comment/43206264
has comment: http://stackoverflow.com/comment/43189587
has comment: http://stackoverflow.com/comment/43223236
has comment: http://stackoverflow.com/comment/43181909
has comment: http://stackoverflow.com/comment/43189404
has comment: http://stackoverflow.com/comment/43182657
downvote count: 0
has comment: http://stackoverflow.com/comment/43182334
type: AcceptedAnswer
score: 4
has comment: http://stackoverflow.com/comment/43181838
has body: You are setting a layout for a frame to GridLayout in which all components are given equal size. You have two rows, add(panel) adds the panel to the first row of the grid. The second row is left empty. See How to Use GridLayout. Comment out setLayout(new GridLayout(2,1,1,1)); and the extra space should go away. When you comment this line the layout of frame's content pane will be BorderLayout. The default layout of the JFrame is BorderLayout. So add(panel); will add the panel to the center of the frame's content pane. As a result the panel should occupy all the available space. As a side note, avoid setPreferredSize(), usually it is not necessary, see Should I avoid the use of set(Preferred|Maximum|Minimum)Size methods in Java Swing for details. You can specify the number of rows and columns for a text area and wrap it in the scroll pane, ie: textArea = new JTextArea(5, 20); JScrollPane scrollPane = new JScrollPane(textArea); For more details see How to Use Text Areas EDIT: example of getPreferredSize() import java.awt.BorderLayout; import java.awt.Dimension; import javax.swing.*; public class Ex1 extends JPanel{ private JTextArea textarea = new JTextArea (); private JTextField field = new JTextField (); private JButton buton = new JButton ("Trimite"); public Ex1() { setLayout(new BorderLayout()); JPanel panel1 = new JPanel (new BorderLayout(2,2)); JPanel panel2 = new JPanel (new BorderLayout(2,2)); JLabel label1 = new JLabel ("Mesaje"); JLabel label2 = new JLabel ("Scrieti un mesaj"); panel1.add(label1, BorderLayout.NORTH); panel1.add(new JScrollPane(textarea), BorderLayout.CENTER); panel2.add(label2, BorderLayout.WEST); panel2.add(field, BorderLayout.CENTER); panel2.add(buton, BorderLayout.EAST); add(panel1, BorderLayout.CENTER); add(panel2, BorderLayout.SOUTH); } @Override public Dimension getPreferredSize() { return new Dimension(350, 300); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { JFrame frame = n…
type: Answer

http://stackoverflow.com/comment/43183276
has text: Well, thts one thing but still : destListModel.addElement(selected); givesj.lang.object@6346t7832678
comment on: http://stackoverflow.com/a/27365554
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43167477
type: Comment
has text: I understand what findClassesInDirectory is for but what it findClassesInArchive used for? Hope I've made it a bit clearer : )
comment on: http://stackoverflow.com/a/27355833
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43311596
score: 0
type: Comment
type: QuestionComment
has text: @BevynQ The OP states, `The problem is with the for loop, not the do while loop` and I am stating that I do not believe that this is the case. The value of `flag` does not affect the `for` loop
comment on: http://stackoverflow.com/q/27435243

http://stackoverflow.com/a/27327852
score: 0
answers question: http://stackoverflow.com/q/27327607
type: Answer
has body: Turns out I said what I was trying to do earlier wrong. I wanted to right justify the pattern but here is my solution. Sorry for any confusion. for (i=6;i&gt;0;i--) { x=6; for (j=i;j&lt;6;j++) { x--; System.out.print(" "); } for(k=1;k&lt;=i;k++) { System.out.print(x--); } System.out.println(" "); }

http://stackoverflow.com/comment/43159190
has text: you can also add some special functionality to your "key value" object if needed
type: AnswerComment
comment on: http://stackoverflow.com/a/27352789
score: 0
type: Comment

jenkins
tags question: http://stackoverflow.com/q/27361985
tag name: jenkins
tags question: http://stackoverflow.com/q/27361507
tags question: http://stackoverflow.com/q/27461385
tags question: http://stackoverflow.com/q/27466940
type: Tag

http://stackoverflow.com/a/27398644
type: Answer
has body: Well, for the polling, you can use cron4j: http://www.sauronsoftware.it/projects/cron4j/. cron4j is a scheduler for the Java platform which is very similar to the UNIX cron daemon. With cron4j you can launch, from within your Java applications, any task you need at the right time, according to some simple rules. To parse the value in the webpage, I don't think there's a better way of doing it than Jsoup: http://jsoup.org/ Using Jsoup you can access the DOM elements of the webpage very much like you would on jquery.
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43309121
answers question: http://stackoverflow.com/q/27398251
downvote count: 0
has comment: http://stackoverflow.com/comment/43353794

http://stackoverflow.com/comment/43301835
type: Comment
type: QuestionComment
has text: Welcome to Stack Overflow. You've provided a *lot* of code to work through. It would be a good idea to diagnose the problem as far as you can, and reduce this to a short but complete program which *just* demonstrates the problem. Have you debugged through the code and found the point at which it's not behaving as you expect?
score: 5
comment on: http://stackoverflow.com/q/27430305

http://stackoverflow.com/q/27440166
has body: I’ve made some abstraction of Controller using an interface. -- The problem is that @PathVariable doesn’t seem to work on implementation. -- Please help. Here Controller.java public interface Controller&lt;ENTITY extends Entity&gt; { @RequestMapping(value = "/", method = RequestMethod.GET) default public void process(final Model model) { throw new UnsupportedOperationException("Operation not yet supported !"); } @RequestMapping(value = "/new", method = RequestMethod.GET) default public void processNew(final Model model) { throw new UnsupportedOperationException("Operation not yet supported !"); } @RequestMapping(value = "/{id}/show", method = RequestMethod.GET) default public void processShow(final Model model, @PathVariable Long id) { throw new UnsupportedOperationException("Operation not yet supported !"); } @RequestMapping(value = "/{id}/edit", method = RequestMethod.GET) default public void processEdit(final Model model, @PathVariable Long id) { throw new UnsupportedOperationException("Operation not yet supported !"); } @RequestMapping(value = "/{id}/drop", method = RequestMethod.GET) default public void processDrop(final Model model, @PathVariable Long id) { throw new UnsupportedOperationException("Operation not yet supported !"); } @RequestMapping(value = "/create", method = RequestMethod.POST) default public void processCreate(@Valid @ModelAttribute ENTITY entity, BindingResult result, SessionStatus sessionStatus) { throw new UnsupportedOperationException("Operation not yet supported !"); } @RequestMapping(value = "/update", method = RequestMethod.PUT) default public void processUpdate(@Valid @ModelAttribute ENTITY entity, BindingResult result, SessionStatus sessionStatus) { throw new UnsupportedOperationException("Operation not yet supported !"); } @RequestMapping(value = "/delete", method = RequestMethod.DELETE) default public void processDelete(@Valid @ModelAttribute ENTITY entity, BindingResult result, SessionStatus sessionStatus) { throw new UnsupportedO…
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/27440539
tagged with: spring-mvc
tagged with: java
type: Question
score: 0
answer count: 1
has title: Does @PathVarible work even when declared in an interface?

http://stackoverflow.com/comment/43304048
type: QuestionComment
has text: My build.gradle file is already there (above the settings.gradle block). I have since removed the .jars causing the problem but I will try to replicate.
comment on: http://stackoverflow.com/q/27431225
score: 0
type: Comment

http://stackoverflow.com/q/27465449
tagged with: java
upvote count: 2
answer count: 3
has answer: http://stackoverflow.com/a/27466241
tagged with: arrays
linked to: http://stackoverflow.com/q/26318341
has title: How is a two-dimensional array represented in memory in java?
favorite count: 0
has answer: http://stackoverflow.com/a/27466264
accepted answer: http://stackoverflow.com/a/27466264
tagged with: multidimensional-array
possible better answer: http://stackoverflow.com/a/27466241
has comment: http://stackoverflow.com/comment/43368658
type: AnsweredQuestion
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27465471
has body: I am trying to implement a data structure with Key, Value pairs and was looking at array implementations. One way of achieving this is to declare seperate 1-D arrays for Key and Values. private int[] keys = new int[N]; private int[] values = new int[N]; But can the same be achieved by declaring a 2-D array as follows and not compromise on data locality? private int[][] keysAndValues = new int[2][N]; It seems important here that Java implements multidimensional arrays in row-major order? Are there any performance advantages in declaring the array this way, or does this make the code less readable?
type: Question
has comment: http://stackoverflow.com/comment/43367013

http://stackoverflow.com/q/27333998
has body: I have string that looks like the following, and I would like to go through and delete lines that don't contain the tags _JJ or _NN. input: Hello_NN and_CC Happy_JJ Birthday_NN to_TO me_NN !_! output: Hello_NN Happy_JJ Birthday_NN me_NN
has comment: http://stackoverflow.com/comment/43125130
has title: Remove entire line if it does not contain a phrase
tagged with: java
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/27334025
type: Question
has answer: http://stackoverflow.com/a/27334053
score: 0
answer count: 2
possible better answer: http://stackoverflow.com/a/27334053
accepted answer: http://stackoverflow.com/a/27334025
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/43125149
has comment: http://stackoverflow.com/comment/43136376
type: AnsweredQuestion

http://stackoverflow.com/comment/43178323
comment on: http://stackoverflow.com/q/27363047
type: QuestionComment
has text: why do you use `getRelativeTimeSpanString`?
score: 0
type: Comment

http://stackoverflow.com/q/27396690
has title: Groovy spring boot project with javascript
has body: I am following this guide's structure. I have added a script.js file (currently placed in the templates directory). This script.js is referenced from one of my html files, however when i start my application the script.js is not being found successfully. From what i'm seeing i think you need to @Grab it somehow? Not sure. How can i make it that my script.js file is discoverable? Edit: Here is a quicker view of my structure src My.java templates greeting.html script.js app.groovy greeting.html contains &lt;script src="script.js" /&gt; however it is not being loaded
has answer: http://stackoverflow.com/a/27398575
tagged with: spring
type: AnsweredQuestion
tagged with: spring-boot
tagged with: java
type: Question
score: 0
accepted answer: http://stackoverflow.com/a/27398575
answer count: 1
tagged with: javascript
tagged with: groovy

http://stackoverflow.com/a/27345978
upvote count: 1
answers question: http://stackoverflow.com/q/27345834
downvote count: 0
type: Answer
has body: A couple of problems: factor should be multiplied by 10 in every loop answer and factor should be re-initialized between the numbers you're parsing: String line = "1,21,333"; for (String retval : line.split(",")) { int answer = 0; int factor = 1; for (int j = retval.length() - 1; j &gt;= 0; j--) { answer = answer + (retval.charAt(j) - '0') * factor; factor *= 10; } System.out.println(answer); answer = (answer - answer); } OUTPUT 1 21 333
score: 1

http://stackoverflow.com/a/27329413
has comment: http://stackoverflow.com/comment/43117863
has body: You could use instanceOf operator as below: int countA = 0, countB=0; double pred; for (int i=0;i&lt;57;i++) { pred = classifyInstance(instances.instance(i)); System.out.println("===== Classified instance ====="); System.out.println("Class predicted:" + instances.classAttribute().value((int) pred)); if (instances.classAttribute().value((int) pred).toString().equals("bad")) { countB++; } else { countA++; } }
has comment: http://stackoverflow.com/comment/43117287
has comment: http://stackoverflow.com/comment/43117723
has comment: http://stackoverflow.com/comment/43117713
has comment: http://stackoverflow.com/comment/43117364
score: 0
has comment: http://stackoverflow.com/comment/43117281
type: Answer
answers question: http://stackoverflow.com/q/27329249
has comment: http://stackoverflow.com/comment/43117689
has comment: http://stackoverflow.com/comment/43117771
has comment: http://stackoverflow.com/comment/43117674
has comment: http://stackoverflow.com/comment/43117407
has comment: http://stackoverflow.com/comment/43117421
has comment: http://stackoverflow.com/comment/43117515
has comment: http://stackoverflow.com/comment/43117520
has comment: http://stackoverflow.com/comment/43117849

http://stackoverflow.com/comment/43190275
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27369102
has text: `student1.menu();` Well, does your `Student` class have a `menu()` method? We can't tell because we can't see that class. This also looks fishy `Student student1 = new Student(student1);` You want to create an object student1, but you are passing it as a parameter before you have made it?
score: 0

http://stackoverflow.com/a/27459779
accepted answer of: http://stackoverflow.com/q/27450601
answers question: http://stackoverflow.com/q/27450601
downvote count: 0
score: 7
has comment: http://stackoverflow.com/comment/61599061
upvote count: 7
type: AcceptedAnswer
has body: On any normal Oracle Java installation (before Java 9, this is an old answer), cacerts should be a proprietary, binary, JKS key store type. I've checked this against 1.8.0_20. From 9 onwards it is replaced by a binary PKCS#12 key store (or rather, trusted certificate store). To be sure you may use file cacerts on GNU systems (Linux). If you have something different you may have a different JRE or the cacerts file is replaced. You can manage the contents of cacerts using the keytool command delivered with the JDK. Note that the key store that contains the private key(s) for authentication usually is a PKCS#12 key store.
type: Answer
has comment: http://stackoverflow.com/comment/132284084

http://stackoverflow.com/comment/43305279
type: QuestionComment
comment on: http://stackoverflow.com/q/27430919
type: Comment
has text: Thank you very much @moskito-x! I tried 1) first but it did not work. I got the error message `variable fileA may not have been initialized`, so I went on to 2) which worked perfectly. Again, thank you! Still new to this site - how can I make your comment the "Answer"?
score: 0

http://stackoverflow.com/a/27345994
has comment: http://stackoverflow.com/comment/43147402
score: 5
type: Answer
has body: aren't s and s2 two different objects No. s and s2 refer to the same Object that has been interned in the String pool
has comment: http://stackoverflow.com/comment/43147200
accepted answer of: http://stackoverflow.com/q/27345979
answers question: http://stackoverflow.com/q/27345979
upvote count: 5
downvote count: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/89805977
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27489048
has text: this example is not working. I'm add prefix file: do not work.
score: 0

http://stackoverflow.com/q/27375423
score: 0
tagged with: netty
has answer: http://stackoverflow.com/a/27467432
tagged with: asynchronous
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43200985
has answer: http://stackoverflow.com/a/27391219
tagged with: zeromq
tagged with: java
type: Question
answer count: 2
tagged with: distributed-system
has body: I am implementing a distributed system that runs a consensus protocol. The algorithm that I am using does not matter for my question. What I am concerned with is the communication between nodes in the system. I need a way to allow for asynchronous messaging between nodes. There are certain types of messages that should trigger an event in listening nodes. For example (node_1) sendMessageA() ---&gt; (node_2, ..., node_n) recvMessageA() (node_2, ..., node_n) sendMessageB() ---&gt; (node_1) recvMessageB() (node_1) sendMessageC() ---&gt; (node_2, ..., node_n) recvMessageC() ... Basically, I have a function that might be called from a given node_i, and this should send a message to the other nodes in the system and trigger the appropriate function in the other nodes. These messages need to be asynchronous in this distributed system. What are some good frameworks or tools to help allow for this type of communication? I am aware of Netty, and ZeroMQ, which both seem relevant for this type of problem, but I don't have experience with either. Which one of these is better suited to this type of problem? Are there any better alternatives? I would prefer a framework that uses java, but I would consider technologies that use other languages as well.
has title: Asynchronous event triggers in a distributed system? (java)

http://stackoverflow.com/q/27317795
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/38767433
accepted answer: http://stackoverflow.com/a/38767433
tagged with: java
has answer: http://stackoverflow.com/a/27318023
has title: How to print an email to pdf programmatically
type: Question
possible better answer: http://stackoverflow.com/a/27320521
answer count: 6
has comment: http://stackoverflow.com/comment/43095192
has answer: http://stackoverflow.com/a/27317971
has comment: http://stackoverflow.com/comment/43095235
has body: I want to generate a PDF document from a "raw" email. This email could containt html or just text. I don't care for attachments. The resulting pdf should contain the proper formatting (from css and html) and also embedded images. My first idea was to render the email using an email client like thunderbird and then print it to pdf. Does thunderbird offer such an API or are there java libraries available to print an email to pdf?
tagged with: thunderbird
has answer: http://stackoverflow.com/a/27318012
upvote count: 7
has answer: http://stackoverflow.com/a/27318174
tagged with: http://stackoverflow.com/tag/pdf
tagged with: email
downvote count: 1
favorite count: 0
score: 6
has answer: http://stackoverflow.com/a/27320521

http://stackoverflow.com/comment/43139946
has text: this solved the problem! but how about if i wanted to append a text to it instead of changing the whole text?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27341961

http://stackoverflow.com/comment/43152753
has text: How about [this](http://stackoverflow.com/questions/19324918/how-to-disable-all-components-in-a-jpanel/19328368#19328368) or [this](http://stackoverflow.com/questions/12169662/how-would-i-disable-a-text-box/12169692#12169692) or [this](http://stackoverflow.com/questions/20799814/how-to-disable-enable-jframe-component-when-jinternalframe-isvisible-inside-jfra/20813257#20813257) or [this](http://stackoverflow.com/questions/19799451/java-blocking-focus-from-jcomponent/19801009#19801009)
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27349044
type: QuestionComment

http://stackoverflow.com/comment/43334256
has text: You might consult the developer pages for [storage options](http://developer.android.com/guide/topics/data/data-storage.html).
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27447542
type: QuestionComment

http://stackoverflow.com/comment/43118133
type: Comment
comment on: http://stackoverflow.com/a/27329409
has text: I've just tried and it does not seem to work. The gui of the server comes up, and no error is printed, i can run a client no probs, but the GUI of the client doesnt come up. And nothing is printed in the log.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/58335616
type: Comment
type: QuestionComment
has text: @mmx73 It would be helpful to critique the accepted answer on that other question as well, so that others who find it will know which answer actually works. Thanks for trying.
comment on: http://stackoverflow.com/q/27402825
score: 0

http://stackoverflow.com/q/27339664
type: Question
score: 0
has comment: http://stackoverflow.com/comment/43135769
favorite count: 0
has answer: http://stackoverflow.com/a/27339681
has answer: http://stackoverflow.com/a/27339699
accepted answer: http://stackoverflow.com/a/27339698
answer count: 3
has title: Accessing methods of extended class from inner class
possible better answer: http://stackoverflow.com/a/27339681
tagged with: inner-classes
upvote count: 1
has comment: http://stackoverflow.com/comment/43135760
downvote count: 1
has body: public class ABC extends XYZ { public static class InnerClass1 { ... } public static class InnerClass2 { ... } public static class InnerClass3 { ... } public static class InnerClass4 { ... } } In the above code, I cannot access the methods of the class XYZ inside the inner classes1,2,3 and 4. How can i modify the above structure so that the inner classes can access the methods within the class XYZ ? Thanks in advance !
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27339698

http://stackoverflow.com/q/27330358
type: Question
has comment: http://stackoverflow.com/comment/43118756
tagged with: java
has title: Get short days of week in android
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43120071
has comment: http://stackoverflow.com/comment/43119425
score: 0
has comment: http://stackoverflow.com/comment/43119878
answer count: 2
has comment: http://stackoverflow.com/comment/43119864
has comment: http://stackoverflow.com/comment/43119949
has comment: http://stackoverflow.com/comment/43118748
upvote count: 1
has answer: http://stackoverflow.com/a/27330991
accepted answer: http://stackoverflow.com/a/27330991
linked to: http://stackoverflow.com/q/7651221
downvote count: 1
has comment: http://stackoverflow.com/comment/43119430
favorite count: 0
tagged with: get
duplicate of: http://stackoverflow.com/q/7651221
has comment: http://stackoverflow.com/comment/43119459
tagged with: android
has comment: http://stackoverflow.com/comment/43118773
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27330504
has body: How i get days of week (SUNDAY, MONDAY, TUESDAY etc.) as short format(SUN,MON,TUE etc.) for system locale in Android? String mondayshort --&gt; output:"MON"(for English) or "LUN"(for French) String tuesdatshort --&gt; output:"TUE"(for English) or "MAR"(for French) String wednesdayshort --&gt; output:"WED"(for English) or "MER"(for French)
has comment: http://stackoverflow.com/comment/43119249
has comment: http://stackoverflow.com/comment/43119403
has comment: http://stackoverflow.com/comment/43119526
has comment: http://stackoverflow.com/comment/43119389
has comment: http://stackoverflow.com/comment/43119824
has answer: http://stackoverflow.com/a/27330504

http://stackoverflow.com/comment/43147890
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27346430
has text: please, its a very easy answer if you search a little on google... try an hello world before starting coding...immagine if all people ask for this...no research was made here sorry
score: 0

http://stackoverflow.com/a/27442309
downvote count: 0
score: 1
upvote count: 1
has body: I suspect this might be a locale issue. The Scanner.hasNextDouble and nextDouble methods are documented to use the locale-specific "LocalDecimalSeparator" character as the decimal "point". The OP's language appears to be Dutch. (That's what Google translate thinks ...) The locale-specific "LocalDecimalSeparator" character in the "nl-NL" locale is "," ... according to this page: http://www.localeplanet.com/java/nl-NL/ However, the input file is using the "." character as the decimal point. This could cause the numbers in the file to not be accepted by the scanner. Try changing the "." decimal points to "," characters. If this is the problem AND you need to read the file as given, then the solution is to change the locale that is in effect when you read the file: You can do this external to the application; e.g. by changing environment variables (on Unix / Linux). You can do this within the application by changing the default Locale; e.g. using Locale.setDefault(...). You can do this just for a specific Scanner; e.g. using Scanner.useLocale(...). (See also: How to specify decimal delimiter.)
type: Answer
answers question: http://stackoverflow.com/q/27441425

http://stackoverflow.com/comment/43273136
score: 0
type: Comment
has text: Is it possible with this solution to not get a null error when looking back at the ViewStudents. How would I add it to the next empty space?
type: AnswerComment
comment on: http://stackoverflow.com/a/27414241

http://stackoverflow.com/a/27333508
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27333385
has body: Your comparator contract is wrong. the compare method contract says: Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. Your code is only doing 1 and -1 what about the 0?

http://stackoverflow.com/comment/43256391
type: Comment
comment on: http://stackoverflow.com/a/27405797
has text: Why don't you return str(num*100)?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43118863
type: Comment
has text: very useful, it didnt solve my problem but with your link and some searching i found out how to exactly do it, thank you very much for this useful info +1
score: 0
comment on: http://stackoverflow.com/a/27327088
type: AnswerComment

http://stackoverflow.com/comment/82241760
has text: Remember to set/create/register in `onCreateView` what you remove/destroy/unregister in `onDestroyView`... Gotta follow those lifecycles!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27416834

http://stackoverflow.com/q/27382205
tagged with: eclipse
type: Question
has body: I am trying to add a command to a toolbar(as a contribution) in an eclipse RCP application that has a lot of perspectives, and i want that command to be seen only in a certain perspective(and remain hidden for other perspectives while i switch through them). I have tried using visibleWhen but no luck. &lt;command commandId="com.example.command.id" icon="icons/myIcon.gif" label="Test Command" &gt; &lt;visibleWhen checkEnabled="false"&gt; &lt;with variable="activeWorkbenchWindow.activePerspective"&gt; &lt;equals value="com.example.myPerspective"/&gt; //the id of the perspective in which my command should be seen &lt;/with&gt; &lt;/visibleWhen&gt; &lt;/command&gt; When i tried using this, my command would only show after switching from com.example.myPerspective to another perspective.(maybe it gets the perspective i am switching from as active). Another thing that i would like to specify is that i would not like to do this programatically(unless it's something fast). It would not be very productive to do the same thing all over again for every command that needs to behave like this. Thank you very much in advance!
has comment: http://stackoverflow.com/comment/43329847
downvote count: 0
tagged with: eclipse-plugin
favorite count: 0
tagged with: eclipse-rcp
has title: How can i add a command to a specific perspective
has comment: http://stackoverflow.com/comment/43214727
has comment: http://stackoverflow.com/comment/43342820
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/10191373
upvote count: 1
tagged with: plugins
has comment: http://stackoverflow.com/comment/43216550
score: 1
tagged with: java

http://stackoverflow.com/q/27417412
has comment: http://stackoverflow.com/comment/43278331
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/43279920
tagged with: spring
has answer: http://stackoverflow.com/a/28272385
tagged with: java
accepted answer: http://stackoverflow.com/a/28272385
has body: Since I migrated from Spring 3.2.6 to Spring 4.1.2 my tests are not working. I found out that AnnotationTransactionAspect (TransactionAspectSupport) now caches the PlatformTransactionManager in transactionManagerCache field. I use MockHttpServletRequest to emulate end-to-end tests. My tests are not transactional and they don't rollback. My tests use @DirtiesContext. After Spring closes the old context and creates a new one all beans are recreated except AnnotationTransactionAspect. AnnotationTransactionAspect is not recreated and contains cache from the previous test. That means that it contains cached PlatformTransactionManager. So when @Transactional method is called inside a service layer it tries to get a Database Connection from cached Transaction Manager, but cached Transaction Manager has a datasource that was already closed. It was closed when Spring was shutting down Application context after the first test. So my question is why AnnotationTransactionAspect is not recreated? UPDATED add exception org.hibernate.exception.GenericJDBCException: Cannot open connection at org.springframework.orm.jpa.JpaTransactionManager.doBegin(JpaTransactionManager.java:431) ~[spring-orm-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:373) ~[spring-tx-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionAspectSupport.java:439) ~[spring-tx-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:262) ~[spring-tx-4.1.2.RELEASE.jar:4.1.2.RELEASE] at org.springframework.transaction.aspectj.AbstractTransactionAspect.ajc$around$org_springframework_transaction_aspectj_AbstractTransactionAspect$1$2a73e96c(AbstractTransactionAspect.aj:64) ~[spring-aspects-4.1.2.RELEASE.jar:4.1.2.…
has title: AnnotationTransactionAspect is not recreated for @DirtiesContext
tagged with: spring-transactions
score: 2
type: AnsweredQuestion
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/43281793
score: 0
has text: yes @chiastic-security: this is nothing to do with java.. i am asking what is the purpose?..
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27419358

http://stackoverflow.com/q/27322787
tagged with: java
downvote count: 1
accepted answer: http://stackoverflow.com/a/27322942
has comment: http://stackoverflow.com/comment/43104988
has title: Java Reverse a linked list pairwise
has body: I am trying to reverse a linked list pairwise i.e as follows 1-&gt;2-&gt;3-&gt;4-&gt;5 changed to 2-&gt;1-&gt;4-&gt;3-&gt;5 I have been able to do that recursively. However, I am getting confused while doing it iteratively. public class FastList&lt;Item&gt; { private Node&lt;Item&gt; first; private static class Node&lt;Item&gt; { Item item; Node&lt;Item&gt; next; } public void swapPairwiseIterative() // not working { if(first == null || first.next==null) return; Node one = first, two; first= first.next; while ( one != null || one.next != null ) { two = one.next; one.next = two.next; two.next = one; one = one.next.next; } } } On debugging, I noticed that I am able to swap the two nodes correctly, but am not able to assign it back to the first instance variable, which points to the first element of the list. How do I do that ? Also, the line first= first.next; looks a bit hacky. Please suggest a more natural way of doing it.
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27323225
favorite count: 0
has answer: http://stackoverflow.com/a/27323225
has answer: http://stackoverflow.com/a/27322942
has comment: http://stackoverflow.com/comment/43104971
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43104908
upvote count: 3

http://stackoverflow.com/q/27337544
tagged with: java
type: Question
answer count: 2
tagged with: intellij-idea
linked to: http://stackoverflow.com/q/38922754
linked to: http://stackoverflow.com/q/269486
downvote count: 0
has answer: http://stackoverflow.com/a/27345127
tagged with: android
has title: Different behaviour of java.util.Calendar in Android
score: 1
has answer: http://stackoverflow.com/a/46271733
has body: so I wanted to implement a method that gives me the dates of the workdays, and if it's Saturday or Sunday those of the next week. To achieve this I used Calendar and the setFirstDayOfWeek method. This is how my code looks: Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("Europe/Berlin")); calendar.setFirstDayOfWeek(Calendar.SATURDAY); calendar.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); //write to array calendar.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY);//write calendar.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY); // and so on... If I compile this in IntelliJ on Sat. Dec 6, I get the following dates: Mon Dec 08 23:44:32 CET 2014 Tue Dec 09 23:44:32 CET 2014 ... Sat Dec 06 23:44:32 CET 2014 Sun Dec 07 23:44:32 CET 2014 ..just as it was intended. w/o setting the first day of week to Saturday the Monday date would be Dec 01. Now I use the exact same code under Android Studio. The dates look like they do in IntelliJ if I don't set the first day of week to Saturday. Can anybody tell me why the same code provides different results?
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43131782
upvote count: 1
has comment: http://stackoverflow.com/comment/43142313

http://stackoverflow.com/comment/43134238
has text: i tried it but the programm is not reading the borrower data now. i guess i cannot change the scnr.hasNext() in the while loop
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27338767
type: AnswerComment

http://stackoverflow.com/q/27375381
tagged with: sockets
has answer: http://stackoverflow.com/a/27401195
tagged with: tcp
tagged with: java
has comment: http://stackoverflow.com/comment/43205479
tagged with: apache-camel
type: Question
has title: Apache Camel Mina2 not receiving data using Socket
has comment: http://stackoverflow.com/comment/46358018
has comment: http://stackoverflow.com/comment/43203573
score: 0
tagged with: mina
has body: I have been trying to send data through socket programming to Apache Camel and I am trying to use Apache Mina2. The idea is to send the data over TCP to Camel. For TCP, I am using socket programing. This is what my code is for Mina2: public void configure() throws Exception { from("mina2:tcp://localhost:6789?sync=false") .process(new LogProcessor()); } LogProcessor only prints the body of the received message using exchange.getIn().getBody(String.class) This piece of code works fine with Apache Mina as below: from("mina:tcp://localhost:6789?textline=true&amp;sync=true") .process(new LogProcessor()); The socket programming client code that I am using is as below: try { Socket client = new Socket(); client.connect(new InetSocketAddress("localhost", 6789)); OutputStream outToServer = client.getOutputStream(); DataOutputStream out = new DataOutputStream(outToServer); System.out.println("After Dataoutput stream"); out.writeBytes("Content gets received in server\n"); client.close(); } The same piece of code works fine for Mina but does not work with Mina2. I am unable to figure out what is causing the problem. Do I need to add some parameters in the from clause of Camel. Kindly help..
answer count: 1
has comment: http://stackoverflow.com/comment/46357627
type: UnansweredQuestion

http://stackoverflow.com/comment/43338164
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27427775
has text: BLuej is just an IDE for java, so yes it has swing, but I'n not sure if it provides any specific support for swing. Not sure if you need it though. Eclipse doesn't provide support either.
score: 0

http://stackoverflow.com/q/27392683
has title: How to determine where Java thread interrupts are coming from?
has body: I've got a UI automation framework that launches tests using TestNG and runs through pages using Selenium/WebDriver. Oftentimes the pages I'm testing make AJAX calls that modify the DOM upon returning. In these cases I use Selenium explicit waits to declare a DOM condition that I want to be met before the automation can proceed (IE: some button gets enabled). Internally Selenium's FluentWait.until method handles this by polling the DOM for my ExpectedCondition every 500ms and calling Thread.sleep() in-between these checks. When I run two tests back to back in a TestNG suite this works perfectly fine for the first test, but starts to fail with an InterruptedException about halfway through each subsequent test. This is consistent. The exceptions look like this: Associated Throwable Type: class org.openqa.selenium.WebDriverException Associated Throwable Message: java.lang.InterruptedException: sleep interrupted The strange thing is that there's no multi-threading going on here. I've disabled Selenium Grid, BrowserMob Proxy, and every other bit of code that could be conflicting. I've read both of these questions: https://stackoverflow.com/questions/24495176/why-is-thread-sleep-being-interrupted - Closed for not providing enough detail, but one of the proposed answers states that one should override the Thread.interrupt method for debugging. Who interrupts my thread? - Accepted answer also states that one should override the Thread.interrupt method for debugging. My problem with this solution is that placing a breakpoint inside the existing Thread.interrupt method does not reveal any calls around the time that the thread is interrupted. This includes calls from all of my third party dependencies (IE: TestNG and Selenium). Whatever is calling this thread interrupt appears to be external to my framework. I've also tried calling Thread.currentThread.isInterrupted() at every point prior to the FluentWait.until call and it consistently returns false. I've even used IntelliJ's…
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/41692705
tagged with: java
has answer: http://stackoverflow.com/a/41692705
linked to: http://stackoverflow.com/q/2476002
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27419682
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43269804
has comment: http://stackoverflow.com/comment/43250562
tagged with: testng
tagged with: selenium-webdriver
score: 2
accepted answer: http://stackoverflow.com/a/27419682
upvote count: 2

http://stackoverflow.com/comment/43264886
has text: `which are held on the heap until the program ends, or you overwrite them.` I know what you mean, but this is not strictly accurate. Any object on the heap becomes eligible for mark and sweep when there are no longer any references to it. You do not have to overwrite them for this to happen.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27409735
type: AnswerComment

http://stackoverflow.com/q/27375623
type: Question
has body: Getting Receiving java.lang.RuntimeException: Unable to destroy activity {com.android.systemui/com.android.systemui.usb.UsbPermissionActivity} This is my Code after onClickListener: login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String User_Name; User_Name=username.getText().toString(); Device_Found=0; if(User_Name.toLowerCase().equals("medequip") && password.getText().toString().equals("medequip")) { Communication_Ok=0; Permission_Error=0; checkdeviceconnection(); if(Device_Found==1) { Data_Rx_Index=Data_Index=setTotal_Frame_Received(0); if(Permission_Error==1) checkdeviceconnection(); Receive.start(); long i,j; for(i=0;i<1000;i++) for(j=0;j<1000;j++); if(Communication_Ok==1) Toast.makeText(Medequiplogin.this, "Communication_Ok", 10000).show(); else Toast.makeText(Medequiplogin.this, "Communication Failure", 10000).show(); Intent i3 = new Intent(Medequiplogin.this,Modes.class); startActivity(i3); } else { Toast.makeText(Medequiplogin.this, "Device Connection Problem", 10000).show(); return;} } else { Toast.makeText(Medequiplogin.this, "Plesae Enter valid Username and Password", 10000).show(); } } }); clear.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { username.setText(""); password.setText(""); } }); } protected void checkdeviceconnection() { int i,j; String as[]; UsbManager manager = (UsbManager) getSystemService(Context.USB_SERVICE); HashMap<String, UsbDevice> deviceList = manager.getDeviceList(); i = deviceList.size(); if(i==0) { return; } as = new String[i]; deviceList.keySet().toArray(as); for(j=0;j<i;j++) { Device_Detials = (UsbDevice)deviceList.get(as[j]); if((Device_Detials.getVendorId()==targetVendorID) && (Device_Detials.getProductId()==targetProductID)) { break; } } if(Device_Detials!=null) { usbManager = (UsbManager)getSystemService(Context.USB_SERVICE); if(usbManager.hasPermission(Device_Detials)==true) { // Toast.makeText(Medequiplogin.this, "Permission Granted", …
tagged with: usb
has comment: http://stackoverflow.com/comment/43201383
downvote count: 0
score: 1
favorite count: 0
has title: Getting Receiving java.lang.RuntimeException: Unable to destroy activity {com.android.systemui/com.android.systemui.usb.UsbPermissionActivity}
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/43201650
answer count: 0
has comment: http://stackoverflow.com/comment/43202662
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/43148692
type: Comment
type: QuestionComment
has text: I also have a few linear layouts inside the main linear layout. And each of those linear layouts contains my buttons. Do I need to include them in the code?
score: 0
comment on: http://stackoverflow.com/q/27345455

joptionpane
tags question: http://stackoverflow.com/q/27381621
tags question: http://stackoverflow.com/q/27318280
tags question: http://stackoverflow.com/q/27386626
tags question: http://stackoverflow.com/q/27339988
tags question: http://stackoverflow.com/q/27353136
type: Tag
tags question: http://stackoverflow.com/q/27404362
tags question: http://stackoverflow.com/q/27344268
tags question: http://stackoverflow.com/q/27379663
tags question: http://stackoverflow.com/q/27364562
tag name: joptionpane

http://stackoverflow.com/comment/43178388
comment on: http://stackoverflow.com/q/27363235
score: 0
type: QuestionComment
type: Comment
has text: in short, though this won't be valid code: `if (loopquery == "Y") { loopagain = true } else { loopagain = false}`

http://stackoverflow.com/comment/43347031
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27454366
type: Comment
has text: try putting getWriteableDatabase() in your constructor DatabaseHandler. Come back if that doesn't solve it ;)

http://stackoverflow.com/comment/43210325
comment on: http://stackoverflow.com/a/27380243
type: Comment
has text: Don't use all those `text()` selectors, simply select the element nodes: `//Code[Tags[contains(., 'Java')]]/Snippet`. If you select `text()` nodes then you have to go up two levels e.g. `//Code/Tags/text()[contains(., 'Java')]/../../Snippet`.
score: 0
type: AnswerComment

http://stackoverflow.com/a/27359671
answers question: http://stackoverflow.com/q/27318254
has comment: http://stackoverflow.com/comment/54121123
has comment: http://stackoverflow.com/comment/53978802
score: 5
has body: After some study I finally understood that things were much simpler. That I was missing to understand is that I was using the wrong Gradle plug-in. I had to replace eclipse plug-in by eclipse-wtp and then specify which facets and runtime I wanted to use in my application. The final build.gradle file is below: apply plugin: 'java' apply plugin: 'eclipse-wtp' // The correct plug-in! apply plugin: 'application' apply plugin: 'war' sourceCompatibility = 1.7 targetCompatibility = 1.7 tasks.withType(JavaCompile) { options.encoding = "UTF-8" } def hibernateVersion = "4.3.7.Final" def weldVersion = "1.1.27.Final"//"2.2.7.Final" Demoiselle 2.4.1 não é compatível com Weld 2 def demoiselleVersion = "2.4.1" def arquillianVersion = "1.1.5.Final" repositories { mavenLocal() mavenCentral() } dependencies { runtime 'javax.servlet:javax.servlet-api:3.1.0' runtime 'javax.enterprise:cdi-api:1.0-SP1' runtime 'org.jboss:jandex:1.2.2.Final' } eclipse { wtp { facet { facet name: "java", version: "1.7" // Java version facet name: "jst.web", version: "3.0" // Dynamic Web Application facet name: "jst.jsf", version: "2.2" // Java Server Faces facet name: "wst.jsdt.web", version: "1.0" // JavaScript } } } task wrapper(type: Wrapper) { gradleVersion = '2.2.1' } I hope this may help some other people!
type: AcceptedAnswer
upvote count: 5
type: Answer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27318254

http://stackoverflow.com/comment/43127657
type: QuestionComment
has text: See *How to Write a Custom Swing Component*, cited [here](http://stackoverflow.com/q/11454506/230513).
comment on: http://stackoverflow.com/q/27334155
score: 0
type: Comment

http://stackoverflow.com/comment/43090013
comment on: http://stackoverflow.com/q/27314281
has text: *"..screenshot of the window. Would that be more helpful?"* No, not really. What @MadProgrammer asked you to post is well described in the link. One way to get images for an example, is to hot link to images seen in [this Q&A](http://stackoverflow.com/q/19209650/418556).
score: 1
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27345152
score: 1
tagged with: java
type: Question
answer count: 2
upvote count: 1
has body: I had been through this query but did not get proper answer. I have conf.txt in Windows folder c:\winapp\Game\core\conf.txt I have conf.txt in Linux folder /usr/Game/core/conf.txt So, I know the relative path that starts from Game folder Without using OS specific code like System.getProperty(""), Do we have an approach to write a portable Java program?
favorite count: 0
has answer: http://stackoverflow.com/a/27345349
linked to: http://stackoverflow.com/q/25307720
has answer: http://stackoverflow.com/a/27345859
type: UnansweredQuestion
has title: Read file from Linux and windows using Java
downvote count: 0

http://stackoverflow.com/comment/43208606
comment on: http://stackoverflow.com/a/27379311
type: AnswerComment
has text: It seems so. I don't know why the SQL select statement shows differences in minutes and seconds.
score: 0
type: Comment

http://stackoverflow.com/q/27367324
type: Question
upvote count: 2
has body: So the company I work at has firewalls on our build servers, which means they can only access our internal Archiva maven server. To my knowledge, this server is also firewalled off and cannot retrieve content from maven central directly either. So what people do if they need a certain library is, they go get the pom.xml, jar and other dependencies from maven central, and upload them to our Archiva server through the web interface. This is sufficient for relatively small libraries with one or two dependencies at most, but very tedious for something large, such as Eclipse Aether, which I need at the moment. So my question is, is there a way to pull down all the stuff from maven central to my local machine and then push it back up to my company's Archiva server? I'm sorry if this is a rather stupid question; I'm not very familiar with uploading stuff to Maven and none of my coworkers understand what I'm talking about at all (many like to commit jars directly to our repo sigh). Thanks!
answer count: 1
has title: How can I push a large dependency tree from maven central to a local Archiva server?
has comment: http://stackoverflow.com/comment/43186808
linked to: http://stackoverflow.com/q/1776496
favorite count: 0
tagged with: archiva
tagged with: maven
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/27376059
accepted answer: http://stackoverflow.com/a/27376059
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43202244
tagged with: eclipse

http://stackoverflow.com/a/27595733
accepted answer of: http://stackoverflow.com/q/27446315
has body: Parse is a database and the API will send you the records as they are in the database. You could create a Parse.com cloud function if you want to compute the "other party" of your transactions on the Parse.com side of the line. The function will be provided with the current user and has the entire JavaScript API at its disposal so that should work. But it seems overkill to me. Their example aggregates information of many review rows into a single rating which should speed up the transmission of the result. In your case, you compute a new column which you can just as well compute on the client, just like you do. So I don't see anything wrong with your current approach. I think it's not weird that it's your adapter's job to show the "other party". I'd call it view logic, a choice in how to display the data to the user. So if the adapter needs to show the "other party", then the adapter needs to know which of the two users to filter out. To separate things a bit more, you could create a currentUser field in the adapter class and fill it in the constructor or use a setter. Then the adapter need not call ParseUser.getCurrentUser() itself. This may for example help you create unit tests for the adapter. If you want the rest of your code to be more independent of Parse.com, you can create some kind of Data Access Object that computes the "other party" column and also transforms the data to non-Parse.com objects. Seems like a different kind of overkill to me though.
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27446315
type: Answer
has comment: http://stackoverflow.com/comment/43633381

http://stackoverflow.com/a/27444486
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27444425
has body: you can do it like this: for(int i=0; i&lt;Userwords.length;i++){ for(j=0; j&lt;split.length;j++){ if(Userwords[i].equals(split[j]){ //THEY COMPARE TO EACH OTHER RETURN SOMETHING } } } Its a pseudo code example EDITED: You can make something like this than: for(int i=0; i&lt;Userwords.length;i++){ for(j=0; j&lt;split.length;j++){ try{ if(Userwords[i].equals(split[j]){ //THEY COMPARE TO EACH OTHER RETURN SOMETHING } }catch(Exception ex){} } }
has comment: http://stackoverflow.com/comment/43328149
type: Answer
has comment: http://stackoverflow.com/comment/43328191
downvote count: 1
has comment: http://stackoverflow.com/comment/43328420
has comment: http://stackoverflow.com/comment/43330636
answers question: http://stackoverflow.com/q/27444425
score: -1
upvote count: 0

http://stackoverflow.com/q/27409223
has body: As the title underlines it, I am having trouble with the Java compiler for Ubuntu. I did a fresh install of the OS. Before uninstalling Ubuntu, a few months ago, Eclipse's Java compiler worked like a charm. I followed the exact same steps...: Install OpenJDK Java 7 Runtime (lastest official JDK on Ubuntu that worked for me before); Install the lastest version of Eclipse; Run it from my main folder, My documents, Desktop, separate HDD and separate partition... all failed; I think it has something to do with the compiler... I use Java 1.8 (the same as my Windows 8.1 compiler that works very well too). I remember exactly also that it was the same as the one I had a few months ago. I am getting compiler errors in a main method (System.out.println(), String, double, etc.) and I would like to resolve this a fast as possible. Here is an exhaustive list of the errors I am getting: import java.util.*; public class StackOverFlow {(...code...)} [Implicit super constructor Object() is undefined for defaults constructor. Must define a apecific constructor] S String(...); [String cannot be resolved to a type] Scanner (...); [Scanner cannot be revolved to a type] System.out.println(...); [System cannot be resolved] System.in ; [System cannot be resolved to a variable] Do I need to enable/disable some settings? Do I need to install or copy/create additional files? Anything else? All help is highly appreciated. Thank you!
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43267756
has answer: http://stackoverflow.com/a/27413596
type: Question
has comment: http://stackoverflow.com/comment/43270690
tagged with: ubuntu
score: 0
has title: Java compiler errors in Ubuntu
answer count: 1
accepted answer: http://stackoverflow.com/a/27413596
has comment: http://stackoverflow.com/comment/43262842
has comment: http://stackoverflow.com/comment/43270660
tagged with: compiler-errors
has comment: http://stackoverflow.com/comment/43262903
type: AnsweredQuestion

http://stackoverflow.com/comment/43375362
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27470229
type: QuestionComment
has text: What are you trying to do by comparing integer and double? Double will always be floating point number hence you dont need to check. if you are after decimal point then clarify

http://stackoverflow.com/q/27451179
type: AnsweredQuestion
tagged with: java.util.scanner
possible better answer: http://stackoverflow.com/a/27451211
has answer: http://stackoverflow.com/a/27451429
type: Question
score: 1
tagged with: java
has title: In Cannot be resolved and MasterMind
upvote count: 2
accepted answer: http://stackoverflow.com/a/27451358
answer count: 3
has body: Ok, I am having a problem receiving a value... I have been researching for several days, but nothing has hit the topic I need. It is a mastermind game. I am creating this for a Final project in my High School programming class. The Eclipse Compiler is telling me that in cannot be resolved. How do I fix this and Accomplish my goal. This is not being run in an applet. package masterMind; import java.util.Scanner; public class MasterMind { public static void main(String[] args) { System.out.println("This is MasterMind, a logic game"); System.out.println("To win you must guess correctly where each number is"); System.out.println("You will be told if you get one correct"); System.out.println("You will only get 10 tries, then you lose"); System.out.println("Lets begin"); //Change this value to change the game int m1=2; int m2 =3; int m3=2; int m4=1; //Create Board System.out.println("__ __ __ __"); Scanner UserGuess = new Scanner(System.in); int num = in.nextInt(); I have very limited Coding knowledge, so please keep it simple and explain
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27451358
has answer: http://stackoverflow.com/a/27451211

http://stackoverflow.com/a/27371261
type: Answer
answers question: http://stackoverflow.com/q/27370081
has body: I would suggest you use the Collection class and its subclass such as ArrayList. Their sizes are dynamically allocated and you don't have to allocate just-enough array size every time. E.g.: Vector&lt;Integer&gt; list=new Vector&lt;Integer&gt;(); adding element to it list.add(123); list.add(133); export to an array Integer out[]=list.toArray(new Integer[list.size()]);
score: 0

http://stackoverflow.com/comment/43249086
type: QuestionComment
has text: Please provide html and exception
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27385274

http://stackoverflow.com/q/27384872
has answer: http://stackoverflow.com/a/27385061
type: AnsweredQuestion
has body: no, this is not the general question about threadsafety and adding of keylisteners :) I encountered a strange problem when switching a boolean on and off by using a keylistener in swing: I turn the boolean on and off when the key is pressed and released. In another thread, I read the value of the boolean and want to do something with it. But somehow the if block is not being accessed though the value of the boolean must be true because I am holding the key. If I add breakpoints to this section, the breakpoint does get accessed, or if I add a sleep inside the if block. Why is this happening? Can someone explain? EDIT: Strange. Using an AtomicBoolean solves the issue. Could this be a live lock? package de.osipovan.rccontroller.gui; import java.awt.BorderLayout; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; public class Test extends JFrame implements KeyListener { private static final long serialVersionUID = -8395585938567486151L; private JPanel contentPane; private boolean doIt = false; private Thread t = new Thread(new Runnable() { @Override public void run() { while(true){ if(doIt){ System.out.println("done"); // try { // Thread.sleep(10); // } catch (InterruptedException e) { // // TODO Auto-generated catch block // e.printStackTrace(); // } } } } }); public Test (){ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); t.start(); addKeyListener(this); contentPane.addKeyListener(this); setVisible(true); } @Override public void keyTyped(KeyEvent e) {} @Override public void keyPressed(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_UP){ doIt = true; } } @Override public void keyReleased(KeyEvent e) { if(e.getKeyCode() == KeyEvent.VK_UP){ doIt = false; } } public static void main…
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43226710
type: Question
tagged with: boolean
downvote count: 0
has title: java swing keylistener and threads
possible better answer: http://stackoverflow.com/a/27385061
favorite count: 0
has answer: http://stackoverflow.com/a/27385260
answer count: 3
has answer: http://stackoverflow.com/a/27385576
tagged with: multithreading
accepted answer: http://stackoverflow.com/a/27385576
upvote count: 1
tagged with: swing

http://stackoverflow.com/q/27424307
accepted answer: http://stackoverflow.com/a/27424813
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27424546
tagged with: asynchronous
has title: Collect result of few Futures (i.e. join) at once
has body: I have a thread pool that creates futures for various tasks. Sometimes, I need to join e.g. 3 such futures at one place. For example: Future f1 = asyncRun("one"); Future f2 = asyncRun("two"); Future f3 = asyncRun("three"); Later in the code I have a point where I must have all 3 results. I was thinking to make a util method and the best I can think of is: public static &lt;V&gt; V[] get(Class&lt;V&gt; type, Future&lt;V&gt;... futures) throws ExecutionException, InterruptedException { V[] values = (V[]) Array.newInstance(type, futures.length); for (int i = 0; i &lt; futures.length; i++) { Future&lt;V&gt; future = futures[i]; values[i] = future.get(); } return values; } which is ugly, as I need to provide class name for the future value. Any better idea?
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/27424546
type: Question
has answer: http://stackoverflow.com/a/27424813

http://stackoverflow.com/a/27325761
answers question: http://stackoverflow.com/q/27325720
type: Answer
has comment: http://stackoverflow.com/comment/43112610
has comment: http://stackoverflow.com/comment/43112570
has body: Remember, a pixel is a whole number, so unless you're doing high resolution printing, you don't really need a double value. Having said that, you could use a Rectangle2D.Double shape and use Graphics2D#fill if your really feel you need it Have a look at Working with gemoetry for more details
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27325720
has comment: http://stackoverflow.com/comment/89370369

http://stackoverflow.com/comment/43271452
score: 0
type: Comment
type: QuestionComment
has text: ..then why are you posting the `charAt` method?
comment on: http://stackoverflow.com/q/27413313

http://stackoverflow.com/comment/43168179
has text: Sorry all. Since the hostname is confidential, I cant share.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27356803
score: 0

http://stackoverflow.com/comment/43555389
type: AnswerComment
has text: Thanks @Harold L (+1)! A few followups: (1) Please confirm: I would *not* need to implement `UserTransaction`, because this would be provided by the Transaction Manager, yes?
type: Comment
comment on: http://stackoverflow.com/a/27561083
score: 0

http://stackoverflow.com/a/27410345
answers question: http://stackoverflow.com/q/27410241
type: Answer
score: 0
has body: Implement Comparable in your Person class. Your compareTo() method would then be something like: public int compareTo(Person other) { return name.compareTo(other.getName()) } Then use Collections.sort(&lt;your list of Person&gt;);

http://stackoverflow.com/q/27371956
answer count: 2
downvote count: 0
tagged with: layout-manager
has comment: http://stackoverflow.com/comment/43195920
possible better answer: http://stackoverflow.com/a/27372438
favorite count: 0
has answer: http://stackoverflow.com/a/27372438
linked to: http://stackoverflow.com/q/27348688
has comment: http://stackoverflow.com/comment/43195127
has title: Why does this GridBagLayout not appear as planned?
score: 4
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/24622279
has body: I was trying to achieve the end result required in Setting an arbitrary width in GridBagLayout. For easy reference, here it is: This is the current result: Button number and row is shown in the form 1,1, followed by the number of columns (2) declared for this cell. As you can see, it starts with buttons 1,1 (3) and below it 1,2 (4) being the same width, while declaring different numbers of columns. Can anyone determine how to correct the code? The current code: import java.awt.*; import javax.swing.*; import javax.swing.border.EmptyBorder; public class KeyBoardLayout { private JComponent ui = null; KeyBoardLayout() { initUI(); } public void initUI() { if (ui!=null) return; ui = new JPanel(new GridBagLayout()); ui.setBorder(new EmptyBorder(4,4,4,4)); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 0; gbc.gridy = 0; gbc.gridwidth = 3; gbc.fill = GridBagConstraints.HORIZONTAL; ui.add(new JButton("1,1 (3)"), gbc); gbc.gridx = 3; gbc.gridwidth = 2; ui.add(new JButton("2,1 (2)"), gbc); gbc.gridx = 5; ui.add(new JButton("3,1 (2)"), gbc); gbc.gridx = 7; ui.add(new JButton("4,1 (2)"), gbc); gbc.gridx = 9; ui.add(new JButton("5,1 (2)"), gbc); gbc.gridx = 11; ui.add(new JButton("6,1 (2)"), gbc); gbc.gridx = 13; ui.add(new JButton("7,1 (2)"), gbc); gbc.gridx = 15; gbc.gridwidth = 3; ui.add(new JButton("8,1 (3)"), gbc); gbc.gridx = 18; gbc.gridwidth = 4; ui.add(new JButton("9,1 (4)"), gbc); gbc.gridx = 0; gbc.gridy = 1; ui.add(new JButton("1,2 (4)"), gbc); gbc.gridx = 4; gbc.gridwidth = 2; ui.add(new JButton("2,2 (2)"), gbc); gbc.gridx = 6; ui.add(new JButton("3,2 (2)"), gbc); gbc.gridx = 8; ui.add(new JButton("4,2 (2)"), gbc); gbc.gridx = 10; ui.add(new JButton("5,2 (2)"), gbc); gbc.gridx = 12; ui.add(new JButton("6,2 (2)"), gbc); gbc.gridx = 14; ui.add(new JButton("7,2 (2)"), gbc); gbc.gridx = 16; ui.add(new JButton("8,2 (2)"), gbc); gbc.gridx = 18; gbc.gridwidth = 4; ui.add(new JButton("9,2 (4)"), gbc); gbc.gridx = 0; gbc.gridy = 2; gbc.gridwidth = 5; ui.add(ne…
has comment: http://stackoverflow.com/comment/43195363
has answer: http://stackoverflow.com/a/57463596
has comment: http://stackoverflow.com/comment/43195350
tagged with: swing
has comment: http://stackoverflow.com/comment/43195574
type: Question
accepted answer: http://stackoverflow.com/a/57463596
tagged with: java
upvote count: 4
tagged with: gridbaglayout

http://stackoverflow.com/comment/43343780
has text: No cast is needed and the code should compile and run with no problems.
comment on: http://stackoverflow.com/q/27452697
type: QuestionComment
type: Comment
score: 6

http://stackoverflow.com/a/27464089
has comment: http://stackoverflow.com/comment/43364637
answers question: http://stackoverflow.com/q/27463989
score: 0
has comment: http://stackoverflow.com/comment/43364469
type: Answer
has body: If I understand your question correctly, you want that one JLabel should be moved every second time the timer is run, and a different one should be moved every other time the timer is run. If this is the case, you can use the count variable you already have to decide which one to move. For example: public void MoveForPlayer(JLabel PlayerCard1, JLabel PlayerCard2) { and then... if (count%2==0) { // It's even PlayerCard1.setLocation((PlayerCard1.getLocation().x-5), PlayerCard1.getLocation().y+5); } else { PlayerCard2.setLocation((PlayerCard2.getLocation().x-5), PlayerCard2.getLocation().y+5); }

http://stackoverflow.com/comment/43223608
type: Comment
has text: Because it is set by a call to `setElement` after the page has been constructed.
score: 1
comment on: http://stackoverflow.com/a/27387824
type: AnswerComment

http://stackoverflow.com/q/27360633
has answer: http://stackoverflow.com/a/27360689
has body: I am reading in a string, as an entire line of numbers, separated by spaces, ie ie 1 2 3 4 5. I want to convert them into an array of integers, so that I can manipulate them. But this code doesn't work. It says incompatible types. String str = br.readLine(); int[] array = new int[4]; StringTokenizer tok = new StringTokenizer(str," ", true); boolean expectDelim = false; int i = 0; while (tok.hasMoreTokens()) { String token = tok.nextToken(); ar[i] = Integer.parseInt(token); i++; }
accepted answer: http://stackoverflow.com/a/27360689
has title: Converting string into array of ints ex String st = "1 2 3 4 5" into ar=[1,2,3,4,5]
has comment: http://stackoverflow.com/comment/43173399
answer count: 4
type: AnsweredQuestion
tagged with: java
tagged with: stringtokenizer
possible better answer: http://stackoverflow.com/a/27360694
has comment: http://stackoverflow.com/comment/43173423
type: Question
has comment: http://stackoverflow.com/comment/43173318
has answer: http://stackoverflow.com/a/27360694
tagged with: arrays
has answer: http://stackoverflow.com/a/27360786
score: 0
has comment: http://stackoverflow.com/comment/43173330
has answer: http://stackoverflow.com/a/27360812
tagged with: parseint
tagged with: string
has comment: http://stackoverflow.com/comment/43173277

http://stackoverflow.com/comment/43366897
has text: In the unlikely event that anyone else needs an answer to this question, though it is not explicitly stated by the spec, I *think* the algorithm is such that S cannot be a wildcard type in this context, though it may be an intersection type. Wildcards should be dealt with by containment constraints, and not encountered by subtype constraints.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27464708
type: Comment

http://stackoverflow.com/q/27373152
has comment: http://stackoverflow.com/comment/43197642
has comment: http://stackoverflow.com/comment/43197667
has answer: http://stackoverflow.com/a/28059188
has comment: http://stackoverflow.com/comment/43196989
has comment: http://stackoverflow.com/comment/43197402
score: 1
has comment: http://stackoverflow.com/comment/43197272
has comment: http://stackoverflow.com/comment/43197299
tagged with: java
has comment: http://stackoverflow.com/comment/43197197
has comment: http://stackoverflow.com/comment/43197455
has comment: http://stackoverflow.com/comment/43197074
type: Question
downvote count: 0
answer count: 1
has title: Receiving java.lang.RuntimeException: Unable to destroy activity {com.android.systemui/com.android.systemui.usb.UsbPermissionActivity}
has comment: http://stackoverflow.com/comment/43197084
favorite count: 0
has comment: http://stackoverflow.com/comment/43197977
has comment: http://stackoverflow.com/comment/43197137
has comment: http://stackoverflow.com/comment/43197684
has comment: http://stackoverflow.com/comment/43197476
tagged with: android
has body: Receiving java.lang.RuntimeException: Unable to destroy activity {com.android.systemui/com.android.systemui.usb.UsbPermissionActivity}: java.lang.NullPointerException This is my log cat: FATAL EXCEPTION: main java.lang.RuntimeException: Unable to destroy activity {com.android.systemui/com.android.systemui.usb.UsbPermissionActivity}: java.lang.NullPointerException at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3499) at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3517) at android.app.ActivityThread.access$1200(ActivityThread.java:141) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1309) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5103) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:525) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at com.android.systemui.usb.UsbPermissionActivity.onDestroy(UsbPermissionActivity.java:148) at android.app.Activity.performDestroy(Activity.java:5302) at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1117) at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3486) My Code After onClickListener: login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String User_Name; User_Name=username.getText().toString(); Device_Found=0; if(User_Name.toLowerCase().equals("medequip") &amp;&amp; password.getText().toString().equals("medequip")) { Communication_Ok=0; Permission_Error=0; checkdeviceconnection(); if(Device_Found==1) { Data_Rx_Index=Data_Index=setTotal_Frame_Received(0); if(Permission_Error==1) checkdeviceconnection(); Receive.start(); long i,j…
has comment: http://stackoverflow.com/comment/43197164
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/43197435
has comment: http://stackoverflow.com/comment/43197113
has comment: http://stackoverflow.com/comment/43197312
has comment: http://stackoverflow.com/comment/43197251

http://stackoverflow.com/q/27412096
favorite count: 0
has comment: http://stackoverflow.com/comment/43268819
type: Question
duplicate of: http://stackoverflow.com/q/22737535
has comment: http://stackoverflow.com/comment/43268772
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/43269276
answer count: 1
has comment: http://stackoverflow.com/comment/43269007
has comment: http://stackoverflow.com/comment/43269674
has answer: http://stackoverflow.com/a/27413394
tagged with: java
has body: I created a GUI with one JButton in it but it just shows a blurry button. Here you see what I mean. This is the code of my main class: Gui gui = new Gui(); gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); gui.setSize(300, 300); gui.setVisible(true); Code of gui class: import javax.swing.JFrame; import javax.swing.JOptionPane; import java.awt.FlowLayout; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class Gui extends JFrame { public Gui() { super("testing buttons"); getContentPane().setLayout(new FlowLayout()); JButton btnClickMe = new JButton("Click me"); getContentPane().add(btnClickMe); } } Does anyone know how to fix this?
tagged with: eclipse
has title: How to fix blurry Swing elements in Eclipse
has comment: http://stackoverflow.com/comment/43269134
has comment: http://stackoverflow.com/comment/43268987
has comment: http://stackoverflow.com/comment/43269878
has comment: http://stackoverflow.com/comment/43268935
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43268863
has comment: http://stackoverflow.com/comment/43269115
score: 1
linked to: http://stackoverflow.com/q/22737535

http://stackoverflow.com/q/27363365
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27363470
score: 0
answer count: 1
tagged with: string
favorite count: 0
has body: I'm creating a program which makes the given input string into number so that input will be coded. But I'm running into a NumberFormatException as soon as the input string gets too long. I can't see how I can fix this. Note that I have to get substrings from the given string input, turn them into numericValues then get the sum of these two strings as an answer. Code: public class Puzzle { private static char[] letters = {'a','b','c','d','e','f','g','h','i', 'j','k','l','m','n','o','p','q','r','s', 't','u','v','w','x','y','z'}; private static String input; private static String delimiters = "\\s+|\\+|//+|="; public static void main(String[]args) { input = "youuu + are = gay"; //as soon as the substrings before = sign are //longer than 5 characters the exception occurs System.out.println(putValues(input)); } //method to put numeric values for substring from input @SuppressWarnings("static-access") public static long putValues(String input) { Integer count = 0; long answer = 0; String first=""; String second = ""; StringBuffer sb = new StringBuffer(input); int wordCounter = Countwords(); String[] words = countLetters(); System.out.println(input); if(input.isEmpty()) { System.out.println("Sisestage mingi s6na"); } if(wordCounter == -1 ||countLetters().length &lt; 1){ return -1; } for(Character s : input.toCharArray()) { for(Character c : letters) { if(s.equals(c)) { count = c.getNumericValue(c); System.out.print(s.toUpperCase(s) +"="+ count + ", "); } } if(words[0].contains(s.toString())) { count = count - 1; count = s.getNumericValue(s); //System.out.println(count); first += count.toString(); } if(words[3].contains(s.toString())){ count = s.getNumericValue(s); second += count.toString(); } } try { answer = Integer.parseInt(first) + Integer.parseInt(second); } catch(NumberFormatException ex) { System.out.println(ex); } System.out.println("\n" + first + " + " + second + " = " + answer); return answer; } public static int Countwords() { String[] countWords = input.split("…
accepted answer: http://stackoverflow.com/a/27363470
has title: java.lang.NumberFormatException for input string
type: AnsweredQuestion
tagged with: java
upvote count: 1

http://stackoverflow.com/a/27419025
downvote count: 0
has body: You can replace Math.Max functions by if statements and update start and end index of the best subarray. Pascal version: if X[i] &gt; sum + X[i] then begin sum := X[i]; start := i; end else sum := sum + X[i]; if max &lt; sum then begin max := sum; finish := i; end;
type: Answer
has comment: http://stackoverflow.com/comment/43296060
answers question: http://stackoverflow.com/q/27418320
upvote count: 5
score: 5

http://stackoverflow.com/comment/43273807
has text: I just realized my problem - I am so used to using the navigation rule feature of JSF that I completely overlooked the fact that a return value is unnecessary if not going to use navigation rules! The simple fix was for me to have the commandButton action set to a method that had no return value and was not tied to any navigation rules.
score: 0
comment on: http://stackoverflow.com/q/27414781
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27399769
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
has body: If you allocate something on the heap, and throw away the reference to it, the memory will be deallocated by the garbage collector. while(true) { // Allocate a new ArrayList, throw away the return value (a no-op) Class1.method1(this); }
has comment: http://stackoverflow.com/comment/43245057
score: 1
answers question: http://stackoverflow.com/q/27399706
has comment: http://stackoverflow.com/comment/43245001
accepted answer of: http://stackoverflow.com/q/27399706

http://stackoverflow.com/comment/43262625
comment on: http://stackoverflow.com/a/27353959
type: Comment
score: 1
type: AnswerComment
has text: Also, the to address probably needs a resource, depending on what you're trying to accomplish.

http://stackoverflow.com/comment/43134384
has text: Your paintComponent method breaks the painting chain.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27338808
type: Comment

http://stackoverflow.com/q/27329156
has title: How set priority to intellij idea process?
has body: I want to set the priority to "Below Normal" for idea64.exe process and all it descendants. I also want this setting to be retained permanently and I do not want to set it every time I run idea. Is there an IntelliJ IDEA settings for doing this?
tagged with: intellij-idea
upvote count: 2
answer count: 1
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27330566
score: 1
tagged with: java
downvote count: 1
type: Question

http://stackoverflow.com/comment/91750827
comment on: http://stackoverflow.com/a/49181233
score: 1
type: AnswerComment
has text: interestingly this is throwing error "_Activity manager is not in lockTaskMode_" but working.
type: Comment

http://stackoverflow.com/a/27434372
type: Answer
has body: Since tomcat always define catalina home you can use: log4j.appender.R.File=${catalina.home}/logs/foo.log You can also use some other system property or create your own custom property and pass it like this export JAVA_OPTS="-Dfoo.logging.root=/foo/bar/" and use it like this log4j.appender.R.File=${foo.logging.root}/logs/foo.log
answers question: http://stackoverflow.com/q/27434192
score: 0

android-intent
tags question: http://stackoverflow.com/q/27333292
tags question: http://stackoverflow.com/q/27427700
tags question: http://stackoverflow.com/q/27347731
tags question: http://stackoverflow.com/q/27449127
tags question: http://stackoverflow.com/q/27471110
tags question: http://stackoverflow.com/q/27380797
tags question: http://stackoverflow.com/q/27345657
tags question: http://stackoverflow.com/q/27347381
tags question: http://stackoverflow.com/q/27399318
tags question: http://stackoverflow.com/q/27387542
tags question: http://stackoverflow.com/q/27449198
tags question: http://stackoverflow.com/q/27338901
tags question: http://stackoverflow.com/q/27320056
type: Tag
tags question: http://stackoverflow.com/q/27474736
tags question: http://stackoverflow.com/q/27341329
tag name: android-intent
tags question: http://stackoverflow.com/q/27334324
tags question: http://stackoverflow.com/q/27389690
tags question: http://stackoverflow.com/q/27345249
tags question: http://stackoverflow.com/q/27333341
tags question: http://stackoverflow.com/q/27423641
tags question: http://stackoverflow.com/q/27314459
tags question: http://stackoverflow.com/q/27334406
tags question: http://stackoverflow.com/q/27337345

http://stackoverflow.com/comment/43099004
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27319441
has text: That worked! I just had to close Netbeans. Thank you. I can tell from here on out using this program is going to be a pain. That's why I am more of a Visual Studios guy.

http://stackoverflow.com/comment/89684204
comment on: http://stackoverflow.com/a/27363306
type: Comment
has text: Provided link is broken, check [this one](https://javaee.github.io/jaxb-v2/doc/user-guide/ch03.html#compiling-xml-schema-adding-behaviors)
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43140533
comment on: http://stackoverflow.com/a/27341874
type: AnswerComment
score: 0
type: Comment
has text: Great, it definitely works! I have exported the project to a .war and put it on the Tomcat server, now I can see it. So we can say that **ClassResource** looks for a resource located **at the same path where the UI.class** file which uses it is located and it is available **only when the application is finally deployed to the server as a .war file**. The Book doesn't explain that, anyway.

http://stackoverflow.com/q/27343244
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43142112
has comment: http://stackoverflow.com/comment/43142028
has title: TreeSet sorts correctly for int but fails for a String?
answer count: 0
tagged with: string
type: Question
has body: I want to create a 2 TreeSets to hold sorted Employee Objects,one based on Employee id(int) and other based on Employee name(String). I have overridden equals() and hashcode() and toString() in the Employee class shown below. public class Employee { private int id; private String name; @Override public String toString() { return "\nEmployee [id=" + id + ", name=" + name + "]"; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + id; result = prime * result + ((name == null) ? 0 : name.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Employee other = (Employee) obj; if (id != other.id) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; return true; } public Employee(int id, String name) { super(); this.id = id; this.name = name; } public int getId() { return id; } public String getName() { return name; } } I made 2 Comparators for the 2 TreeSets, public class EmployeeNameComparator implements Comparator&lt;Employee&gt; { @Override public int compare(Employee o1, Employee o2) { return o1.getName().compareTo(o2.getName()); } } public class EmployeeIdComparator implements Comparator&lt;Employee&gt;{ @Override public int compare(Employee o1, Employee o2) { if(o1.getId()&lt;o2.getId())return -1; else if(o1.getId()&gt;o2.getId())return 1; else return 0; } } The Problem is the TreeSet which stores elements based on Id prints the output correctly ,but the one which stores the elements based on name does not print it as expected, public class TreeSetTest { public static void main(String[] args) { //Employee Objects Employee e1=new Employee(24, " bJohn"); Employee e2=new Employee(14, "aJonathan"); Employee e3=new Employee(4, "cJobs"); //put into a List and Print as it is ArrayList&lt;Employee&gt; employees=new ArrayList&lt;Emp…
has comment: http://stackoverflow.com/comment/43141975
score: 0
tagged with: collections
tagged with: treeset
tagged with: compareto

http://stackoverflow.com/a/27474338
downvote count: 0
has comment: http://stackoverflow.com/comment/43383263
has comment: http://stackoverflow.com/comment/43395429
has comment: http://stackoverflow.com/comment/43384546
score: 3
has comment: http://stackoverflow.com/comment/43383164
has comment: http://stackoverflow.com/comment/43383134
has comment: http://stackoverflow.com/comment/43384430
has comment: http://stackoverflow.com/comment/43384492
has comment: http://stackoverflow.com/comment/43384579
has body: You must call the Visitor's constructor on the first like of the constructor that extends the Visitor's class, using super(): public User(String UName,String Ufname){ super(); setName(UName); setFname(Ufname); } and if you want Admin to have a custom constructor too, you must call: super(uname, ufname) // String, String - pass the params of the superclass cunstructor So: public Admin() { super(someString, someString); }
has comment: http://stackoverflow.com/comment/43383400
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27474326
has comment: http://stackoverflow.com/comment/43383888
has comment: http://stackoverflow.com/comment/43383791
has comment: http://stackoverflow.com/comment/43383819
has comment: http://stackoverflow.com/comment/43384449
answers question: http://stackoverflow.com/q/27474326
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43383724
has comment: http://stackoverflow.com/comment/43383871
has comment: http://stackoverflow.com/comment/43385699
has comment: http://stackoverflow.com/comment/43383315
type: Answer
has comment: http://stackoverflow.com/comment/43384715
has comment: http://stackoverflow.com/comment/43383709

http://stackoverflow.com/comment/43206606
comment on: http://stackoverflow.com/a/27378283
score: 0
type: AnswerComment
type: Comment
has text: This is good thanks. But I need a loop so that the computer asks the user whether they want to add or delete names until they are done. Thanks

http://stackoverflow.com/comment/43189735
type: Comment
type: QuestionComment
has text: Thats what I have, its just not in the snippets I posted
comment on: http://stackoverflow.com/q/27368560
score: 0

http://stackoverflow.com/comment/43134785
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27339024
type: AnswerComment
has text: figure of speech. is StringProperty kind of bucket? i can't changed the bucket because of 'final' but i can change content(someString) in bucket. is it right thought?

http://stackoverflow.com/comment/43224507
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27388202
has text: Is it because the file is still open ( I see you did one close)? On Microsoft's windows you can not rename a file that is open.

http://stackoverflow.com/a/27324222
answers question: http://stackoverflow.com/q/27316734
type: Answer
has comment: http://stackoverflow.com/comment/43108962
has body: You can call a method from the point where the user has selected a file to open (in the if part of the actionPerformed method). So if your reading method is called openFile and accepts a File parameter, you can call 'openFile(file)` as the second statement in your if block: if (fileChooser.showOpenDialog(modalToComponent) == JFileChooser.APPROVE_OPTION) { File file = fileChooser.getSelectedFile(); openFile(file); } A simple example of an openFile method to handle opening a file (in this case by only printing the contents) could look like this: private void openFile(final File inputFile) { try (final BufferedReader reader = new BufferedReader(new FileReader(inputFile))) { String line; while ((line = reader.readLine()) != null) { System.out.println("line: " + line); // todo: handle line. } } catch (final IOException e) { e.printStackTrace(); // todo: handle exception. } }
score: 0

http://stackoverflow.com/a/27451513
downvote count: 1
has comment: http://stackoverflow.com/comment/43341715
has comment: http://stackoverflow.com/comment/43341941
score: 0
upvote count: 1
has body: To limit values to minimum or maximum values, use Math.min() or Math.max(). int valueA = -50; valueA = Math.max(valueA, 0); //valueA is now 0; int valueB = 200; valueB = Math.min(valueB, 150); //valueB is now 150; If you want to limit it to upper and lower bounds, just use both methods int valueC = -50; valueC = Math.min(Math.max(valueC, 0), 150); //valueC is now 0 int valueD = 200; valueD = Math.min(Math.max(valueC, 0), 150); //valueD is now 150 edit: so for your example, use public void loadMoney(double amount) { this.balance = Math.min(this.balance + amount, 150); }
has comment: http://stackoverflow.com/comment/43342236
type: Answer
has comment: http://stackoverflow.com/comment/43341877
answers question: http://stackoverflow.com/q/27451435

http://stackoverflow.com/a/27400452
has body: Wrong : (The view isn't created yet) TextView title = (TextView) findViewById(R.id.event_title); TextView time_date = (TextView) findViewById(R.id.event_time_date); TextView description = (TextView) findViewById(R.id.event_description); Correct way : Private TextView title ; Private TextView time_date ; Private TextView description ; Then on your OnCreate after the setContentView() title = (TextView) findViewById(R.id.event_title); time_date = (TextView) findViewById(R.id.event_time_date); description = (TextView) findViewById(R.id.event_description); I would suggest you to use ButterKnife for view Injection : https://jakewharton.github.io/butterknife/
answers question: http://stackoverflow.com/q/27400274
score: 0
type: Answer

http://stackoverflow.com/a/27411605
has comment: http://stackoverflow.com/comment/43267854
has comment: http://stackoverflow.com/comment/43267566
has comment: http://stackoverflow.com/comment/43267554
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27411543
has body: When I set defaultAutoCommit to false my transactions don't get saved to the database This is the purpose of setting defaultAutoCommit to false. Set it to true and it would be auto-commited. Set it to false and you need to manually commit it, or it will be rollbacked.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27411543
type: Answer

http://stackoverflow.com/a/27363561
type: AcceptedAnswer
downvote count: 0
has body: You are not calling your method correctly. Your method's signature is void printline(int i, char ch) which means you must pass it an int and a char. Right now you are only calling it with an int. Change printline(i); to printline(i, ch);
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/27363392
accepted answer of: http://stackoverflow.com/q/27363392

rest
tags question: http://stackoverflow.com/q/27437447
tags question: http://stackoverflow.com/q/27340780
tags question: http://stackoverflow.com/q/27314049
tags question: http://stackoverflow.com/q/27432575
tags question: http://stackoverflow.com/q/27327018
tags question: http://stackoverflow.com/q/27408510
tags question: http://stackoverflow.com/q/27362328
tags question: http://stackoverflow.com/q/27372551
tags question: http://stackoverflow.com/q/27397925
tags question: http://stackoverflow.com/q/27402639
tags question: http://stackoverflow.com/q/27379431
tags question: http://stackoverflow.com/q/27472303
tags question: http://stackoverflow.com/q/27401834
tags question: http://stackoverflow.com/q/27460190
tags question: http://stackoverflow.com/q/27341572
tags question: http://stackoverflow.com/q/27323432
tags question: http://stackoverflow.com/q/27355864
tags question: http://stackoverflow.com/q/27437566
tags question: http://stackoverflow.com/q/27457969
tags question: http://stackoverflow.com/q/27419834
tags question: http://stackoverflow.com/q/27372940
tags question: http://stackoverflow.com/q/27377709
tags question: http://stackoverflow.com/q/27427654
tags question: http://stackoverflow.com/q/27363376
tags question: http://stackoverflow.com/q/27470930
tags question: http://stackoverflow.com/q/27340536
tags question: http://stackoverflow.com/q/27361590
tags question: http://stackoverflow.com/q/27413505
tags question: http://stackoverflow.com/q/27335002
tags question: http://stackoverflow.com/q/27375203
tags question: http://stackoverflow.com/q/27454696
tags question: http://stackoverflow.com/q/27321970
tags question: http://stackoverflow.com/q/27441363
type: Tag
tags question: http://stackoverflow.com/q/27373313
tags question: http://stackoverflow.com/q/27419743
tags question: http://stackoverflow.com/q/27425522
tags question: http://stackoverflow.com/q/27338693
tags question: http://stackoverflow.com/q/27443958
tags question: http://stackoverflow.com/q/27472559
tags question: http://stackoverflow.com/q/27364922
tags question: http://stackoverflow.com/q/27412889
tags question: http://stackoverflow.com/q/27337477
tags question: http://stackoverflow.com/q/27471292
tags question: http://stackoverflow.com/q/27422793
tags question: http://stackoverflow.com/q/27380858
tag name: rest
tags question: http://stackoverflow.com/q/27382286
tags question: http://stackoverflow.com/q/27431979
tags question: http://stackoverflow.com/q/27377791
tags question: http://stackoverflow.com/q/27455070
tags question: http://stackoverflow.com/q/27369032
tags question: http://stackoverflow.com/q/27403960
tags question: http://stackoverflow.com/q/27396477
tags question: http://stackoverflow.com/q/27427188
tags question: http://stackoverflow.com/q/27422036

http://stackoverflow.com/a/27373724
has comment: http://stackoverflow.com/comment/43297665
has comment: http://stackoverflow.com/comment/43359320
type: Answer
accepted answer of: http://stackoverflow.com/q/27372571
has body: No, you would have to look at the log file for analyzing errors. The log file is written to [installation directory]/.install4j/installation.log. If the installer exits with a fatal error before the "Install files" action has run, you can find the log file in the %TEMP% directory (Mac OS X: $TMPDIR, Linux/Unix: $TMP). The name of the log file starts with "i4jlog..." in that case.
answers question: http://stackoverflow.com/q/27372571
has comment: http://stackoverflow.com/comment/43318572
has comment: http://stackoverflow.com/comment/43381684
has comment: http://stackoverflow.com/comment/43202876
score: 0
has comment: http://stackoverflow.com/comment/43297401
has comment: http://stackoverflow.com/comment/43313824
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43198513
has comment: http://stackoverflow.com/comment/43203666

http://stackoverflow.com/q/27396097
upvote count: 11
favorite count: 0
has comment: http://stackoverflow.com/comment/43240540
type: UnansweredQuestion
has title: Performance degradation after moving to jersey 2
score: 11
tagged with: spring
tagged with: java
has comment: http://stackoverflow.com/comment/43239684
has comment: http://stackoverflow.com/comment/49816259
type: Question
has answer: http://stackoverflow.com/a/31362336
has comment: http://stackoverflow.com/comment/50698665
downvote count: 0
answer count: 1
tagged with: jersey-2.0
has body: We're working on a server using spring 4, embedded jetty 9 and jersey. Recently, we moved to jersey 2.13 and we noticed a degradation in performance. I performed some investigations using YourKit. I saw that there is a massive CPU usage in reflection done by jersey. Also, there are many NoSuchMethodExceptions and ClassNotFoundExceptions in Yourkit snapshot. Are there any jersey configuration or a best practice to avoid this issue, or to optimize jersey? Or maybe it is a known issue in jersey 2? Here are two screenshots from YourKit, showing the hot-spots, after excluding the socket read (java.net.SocketInputStream.socketRead0). The first one is with Merged Callees: And the second one is with Back Trace: Thanks.
has comment: http://stackoverflow.com/comment/48340314

http://stackoverflow.com/a/27348671
has comment: http://stackoverflow.com/comment/43152229
has comment: http://stackoverflow.com/comment/43152636
has comment: http://stackoverflow.com/comment/43152433
has body: You have single dimensional array as parameter. So you have to pass one at a time probably in loop.
score: 0
has comment: http://stackoverflow.com/comment/43152876
has comment: http://stackoverflow.com/comment/43152728
type: Answer
answers question: http://stackoverflow.com/q/27348551
has comment: http://stackoverflow.com/comment/43152122
has comment: http://stackoverflow.com/comment/43152669
has comment: http://stackoverflow.com/comment/43153094

http://stackoverflow.com/comment/43212206
type: AnswerComment
score: 0
type: Comment
has text: You forgot to close class foo
comment on: http://stackoverflow.com/a/27381757

http://stackoverflow.com/a/27684639
score: 0
has body: You have to make sure that lo is less than hi so that recursiveSort keeps sorting the different array recursively and doesn't try to sort an array of length &lt;= 1. And more importantly mid must be set inside of this if statement every time the if statement is called Here is the fix: private static void recursiveSort(int lo, int hi) { if(lo &lt; hi){ int mid =(hi + lo) / 2; recursiveSort(lo, mid); recursiveSort(mid + 1, hi); merge(lo, mid + 1, hi); } }
type: Answer
answers question: http://stackoverflow.com/q/27407958

http://stackoverflow.com/q/27431454
tagged with: java
type: Question
has title: How to exclude some fields on TreeSet.contains but sort on all fields
answer count: 2
has body: Have some problem with TreeSet or I just realize that it doesn't work as I expected. I need to exclude some fields when I check if the value already exists, but on sort it should use all the fields. It looks like TreeSet.contains() use compare or compareTo (comparator, comparable) and not equals(). Here is some example: import java.util.Comparator; import java.util.TreeSet; public class sorter { static class A { String name; int counter; public A(String a, int counter) { this.name = a; this.counter = counter; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((name == null) ? 0 : name.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; A other = (A)obj; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; return true; } } public static class MyComparator implements Comparator&lt;A&gt; { @Override public int compare(A a, A b) { int c = b.counter - a.counter; if (c == 0) { return a.name.compareTo(b.name); }; return c; } } public static void main(String[] args) { TreeSet&lt;A&gt; set = new TreeSet&lt;&gt;(new MyComparator()); set.add(new A("a", 1)); if (set.contains(new A("a", 2))) { System.out.println("'a' already exists, do count + count"); } } Feels like I breaking some law here, and should re-design it in some way? Is it possible to achieve what I try to do with a TreeSet or should I go for a simple list? In someway I have unique items and a list doesn't feel perfect either. Any ideas?
has answer: http://stackoverflow.com/a/27431647
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43304472
has comment: http://stackoverflow.com/comment/43308275
has answer: http://stackoverflow.com/a/27431585
score: 0

http://stackoverflow.com/q/27467590
tagged with: java
accepted answer: http://stackoverflow.com/a/27467705
type: Question
has body: I have a multi-thread chatroom that connects to one server. They all connect, login, and message independently of each other just fine, but when I log off with one of the clients (and the server does a socket.close() for that instance of the client) all clients are logged off. I looked at a bunch of other questions on stackoverflow before posting this, but none of them had the same issue as mine (that I found). Note: All the clients were running locally on my computer, 2+ of them, and that's how I encountered the bug. Could them being on the same IP (though everything is done on my localhost..) cause this to happen? Any help or insight as to what is causing this issue and how I could resolve it would be great. When the issue occurs it also outputs this to the console: Socket: Socket[addr=localhost/127.0.0.1,port=4000,localport=55650] Here is the code (how to recreate the bug is at the bottom): Server class: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.PrintWriter; import java.net.ServerSocket; import java.net.Socket; import java.util.HashSet; public class ChatServer { private static final int PORT = 4000; private static HashSet&lt;String&gt; names = new HashSet&lt;String&gt;(); private static HashSet&lt;ObjectOutputStream&gt; outputs = new HashSet&lt;ObjectOutputStream&gt;(); public static void main(String[] args) throws IOException{ System.out.println("The chat server is running..."); ServerSocket listener = new ServerSocket(PORT); while(true){ new Handler(listener.accept()).start(); } } private static class Handler extends Thread{ private String name; private Socket socket; private ObjectInputStream in; private ObjectOutputStream out; private boolean loggedOut; public Handler(Socket socket){ this.socket = socket; } public void run(){ try { out = new ObjectOutputStream(socket.getOutputStream()); in = new ObjectInputStream(socket.getInp…
answer count: 1
has title: Closing one socket closes all of them, Java
tagged with: sockets
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27467705
score: 0

http://stackoverflow.com/q/27342697
upvote count: 13
has answer: http://stackoverflow.com/a/27342755
favorite count: 0
tagged with: oracle-database
tagged with: sql
answer count: 1
score: 13
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: oracle11g
accepted answer: http://stackoverflow.com/a/27342755
type: Question
has title: Missing IN or OUT parameter at index:: 1 error in Java, Oracle
has body: Hi I coded a Library Management System in JSF 2.2 with using Netbeans 8.0.2 and Oracle 11g Express Edition. I have several pages named Books, Borrowers etc. and some tables named same in database. My problem is this: in Borrowers screen book ids are displayed. But I want to reach book's titles that have same id. Here is my code. public List&lt;Borrower&gt; getBorrowers()throws ClassNotFoundException,SQLException, InstantiationException, IllegalAccessException{ Class.forName("oracle.jdbc.driver.OracleDriver"); con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","Alparslan-PC","123456"); ps=con.prepareStatement("SELECT * FROM BORROWER"); BookidPs = con.prepareStatement("SELECT TITLE FROM BOOK AND BORROWER WHERE ISBN=?"); ResultSet rs=ps.executeQuery(); ResultSet Rs2=BookidPs.executeQuery(); List&lt;Borrower&gt; liste = new ArrayList&lt;Borrower&gt;(); while(rs.next()){ Borrower borrow = new Borrower(); borrow.setId(rs.getBigDecimal("ID")); borrow.setName(rs.getString("NAME")); borrow.setSurname(rs.getString("SURNAME")); borrow.setAddress(rs.getString("ADDRESS")); borrow.setPhonenumber(rs.getString("PHONENUMBER")); borrow.setBorrowdate(rs.getString("BORROWDATE")); //book.setIsbn(rs.getString("BOOKID")) borrow.setBookid(Rs2.getString("BOOKID")); //borrow.setBookid(((Book) rs.getObject("BOOKID")).getIsbn()); liste.add(borrow); } System.out.print(liste); return liste; } if line 22 changed with borrow.setBookid(rs.getString("BOOKID")); The bookids are shown. I wrote another query named BookidPs. if I run this program I get Missing IN or OUT parameter at index:: 1 error. If you help I will appretiate. Thanks

http://stackoverflow.com/a/27409038
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27402734
type: Answer
has body: Instead of using <foreach>, use the newer task. You need to point to antlib.xml and not antcontrib.properties in : <include name="ant-contrib*.jar"/> Now, you can do this: <include name="*.wsdl" /> <echo message="@{wsdl.file}" /> Note that this is @{wsdl.file} and not ${wsdl.file}. That's a parameter that can have a different value each time.
upvote count: 1
answers question: http://stackoverflow.com/q/27402734
score: 1
type: AcceptedAnswer

http://stackoverflow.com/q/27414271
has body: Rather than using "split" method, is there any easy way to get all the index values of double quote character ("") on following String. Thanks. String command = "-u User -P Password mkdir \"temp dir\" rmdir \"host dir\""; int[] indexAll = command.indexOf ("\""); // This line of code is not compile, only I expect this kind of expression
answer count: 2
has answer: http://stackoverflow.com/a/27414541
tagged with: indexof
tagged with: string
has answer: http://stackoverflow.com/a/27414324
accepted answer: http://stackoverflow.com/a/27414324
score: 0
possible better answer: http://stackoverflow.com/a/27414541
has title: Java String get multiple index values
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/a/27439709
upvote count: 2
has body: Obviously, an array is the fastest solution. Something like private final static ReferenceTargetType TYPES = ReferenceTargetType.values(); public ReferenceTargetType byteToType(byte b) { int index = b - 1; if (0&lt;=index &amp;&amp; index&lt;TYPES.length) return TYPES[index]; ... throw SomeException or return null; } can't be beaten by anything, except maybe a hardcoded switch or if (though I strongly doubt it). As this is most probably way faster then other operations (somehow you must get the byte and the result gets somehow used), I'd stop here. No need to optimize beyond this. If your byte values were different, you'd need to initialize the array differently and possibly also make it longer, but otherwise nothing changes. Using JNI for something as simple as an array access is about as efficient as using an airplane to get to the bathroom. It's complicated, it has a huge overhead, but maybe a coolness factor, too.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27436619
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/27436619

http://stackoverflow.com/q/27398225
has answer: http://stackoverflow.com/a/27399514
downvote count: 1
tagged with: xslt
type: Question
has title: not able to read the parameter from a xml after doing xslt transformation
tagged with: java
score: -1
has body: I have the below xml.. <?xml version="1.0" encoding="UTF-8"?> CAG RP202 ory Report XYZ Germany XY 2013-07-18T23:59:00 2013-07-18 <reportNameGrp> Now I am writing xslt with respect to xslt 1.0 i have developed the below xslt now from the above xml I want tit read the parameter exchNam which value is CAG , my xslt is shown below <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:java="http://xml.apache.org/xslt/java" exclude-result-prefixes="java"> <xsl:template match="/Report"> <xsl:choose> <xsl:when test="/Report/rptHdr/rptNam='ory Report'"> <xsl:call-template name="rexReportHeader_template"> <xsl:with-param name="reportheader" select="/Report/rptHdr" /> </xsl:call-template> </xsl:when> </xsl:choose> </EurexMessageObject> </xsl:template> <xsl:template name="rexReportHeader_template"> <xsl:param name="reportheader" /> <rexMessageObject> <xsl:value-of select="$reportheader/exchNam"/> </xsl:template> </xsl:stylesheet> but after transformation i am still not able to view the value of exchNam parameter please advise what went wrong in my xslt folks please advise
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43242976
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43242609
tagged with: xslt-1.0

http://stackoverflow.com/q/27340816
score: 0
has comment: http://stackoverflow.com/comment/43352486
has title: JFrame either won't show up or it's just one line or cannot be closed
has body: I'm writing a game and when I collide with a computer and press E it should open a little JFrame with a question. But sometimes the frame opens but it cannot be seen or closed when right click on it. Or when it shows it just one little line and nothing more like this: http://postimg.org/image/7upz61cjl. There's source code: public class Computer() extends AbstractActor { public Computer() throws IOException { super("computer", 0, 0, 80, 48, 100, "resources/sprites/computer.png"); question = new JLabel(); input = new JTextField(); confirm = new Button("Confirm"); getQuestion(new InputStreamReader(new DataInputStream(new FileInputStream("resources/questions.txt")))); confirm.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (input.getText().equals(password) &amp;&amp; net != null) { getWorld().removeActor(net); } window.dispose(); window = null; } }); } public void use(Ripley ripley) { if (window == null &amp;&amp; !(input.getText().equals(password))) { window = new JFrame("Answer this to shut lasers."); window.setLayout(new BoxLayout(window.getContentPane(), BoxLayout.Y_AXIS)); window.add(question); window.add(input); window.add(confirm); window.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); window.setVisible(true); window.setResizable(false); window.setAlwaysOnTop(true); window.pack(); window.setLocationRelativeTo(null); window.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { window = null; } }); } } public void act() { if (net == null) { net = (LaserNet)getActorByName("laser net"); } } public void getQuestion(InputStreamReader file) throws IOException { Random rand = new Random(); int num = -1; while (num % 2 != 0) num = rand.nextInt(10); try (BufferedReader br = new BufferedReader(file)) { String line; int i = 0; while ((line = br.readLine()) != null) { if (i == num) { question.setText(line); line = br.readLine(); password = line; } i++; } } catch (Exception e) { System.err.println("Error…
has comment: http://stackoverflow.com/comment/43148653
tagged with: jframe
type: UnansweredQuestion
answer count: 0
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/43137650
type: Question
has comment: http://stackoverflow.com/comment/43138022
has comment: http://stackoverflow.com/comment/43137845
has comment: http://stackoverflow.com/comment/43138162

http://stackoverflow.com/q/27348300
favorite count: 0
has answer: http://stackoverflow.com/a/27348408
answer count: 5
has answer: http://stackoverflow.com/a/27348344
has answer: http://stackoverflow.com/a/27348374
has comment: http://stackoverflow.com/comment/43151271
upvote count: 2
type: UnansweredQuestion
score: 1
tagged with: java
downvote count: 1
has answer: http://stackoverflow.com/a/27348403
type: Question
has body: If you declare an array of strings in java like this String[] words; That just gives you a reference correct? now, I am coming from a background in C, so I know that an array of "strings" in C are pointers to pointers, or an array of arrays. However, I am wondering how JVM uses this declaration... Is it just a single reference? Then when you give it sufficient memory, it will give the strings different lengths as well? It's kind of hard for me to describe but I know that Strings are just arrays of characters, so how does the JVM determine how long the strings are before allocating it? Does it reallocate a whole new array of strings with a new updated string length. char array[6][6]; //in C this is necessary because it needs to know the column and row length similar to this char* array[5]; // you still need to malloc the slots in the array for a two dimensional length to be achieved but in java I dont get how this can work String line = null; try { while ((line = bfr.readLine()) != null) { if (StringUtils.isBlank(line)) continue; System.out.println(line); String[] chunks = line.split(","); //this line right here, how does JVM allocate proper memory MindsparkPartnerCode record = new MindsparkPartnerCode(); record.setIEFFCode(chunks[0]); records.add(record);
has title: How does JVM allocate this memory
linked to: http://stackoverflow.com/q/1552301
tagged with: arrays
has answer: http://stackoverflow.com/a/27348359
tagged with: string

http://stackoverflow.com/comment/43297187
score: 2
has text: this is what enums are for.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27427834

http://stackoverflow.com/comment/43259392
has text: I don't believe the question was Java specific. In C++, the unary plus can be used as a way to do what Java calls "unboxing". But it does more. Because you get to define its return type, it's more than an explicit cast. It's unboxing to a fixed type. So that you can have cast operators overloaded to (let's say) char and const char, but have the unary + overloaded to return an int. This will make a difference when you try to print the value of the class. printf() is only aware of primitive types, but at least you know the type. Can also be useful with operator<<()
comment on: http://stackoverflow.com/a/27371089
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27473860
has body: Well, I found the solution, although I am not very satisfied with it... Since I can know the file size which I try to open an inputstream on, I just pick the size and decrease it by the amount of bytes read -- unless the size reaches 0, in this case all read methods return -1.
answers question: http://stackoverflow.com/q/27454899
type: Answer
score: 0

http://stackoverflow.com/comment/43329625
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27445344
has text: Do you mean; how do I see what formatting class is used in my logging configuration file? Hint: its the pattern setting.

http://stackoverflow.com/a/27398441
accepted answer of: http://stackoverflow.com/q/27398324
answers question: http://stackoverflow.com/q/27398324
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 2
has body: I believe this is fine. There's even an example in the javadoc documentation here @see Java Spec You run the risk of ending up with stale links of course, especially if bundle your docs in a download. You may want to consider pointing at a redirect page which you control, so that you can update the target page after you've published your docs.
upvote count: 2

http://stackoverflow.com/q/27422319
has answer: http://stackoverflow.com/a/27423288
has title: How to check if a thread was born?
tagged with: java.util.concurrent
has comment: http://stackoverflow.com/comment/43287292
type: UnansweredQuestion
has body: I created a utility class for getting info about the running threads. one thread called MQTT_THREAD starts when a button is pressed. and i have another button named play, when pressed it should check first if the thread MQTT_THREAD exists or not or ,in other words, was born or not. At run time, i press the button that starts the MQTT_THREAD, and when I press the play button, it displas that the thread MQTT_THREAD is not existing. I believe its mostl because my ack of understaning threads or a small bug in the logic. Below is my code. Kindly please have a lok at it and let me know what i am missin. Code_utitlity methods used public static Thread[] getAllRunninthreads() { Set&lt;Thread&gt; threadSet = Thread.getAllStackTraces().keySet(); Thread[] threadArray = threadSet.toArray(new Thread[threadSet.size()]); return threadArray; } public static boolean isThreadExist(String threadName) { boolean isExist = false; for (int i = 0; i &lt; ThreadsUtility.getAllRunninthreads().length; i++) { if (ThreadsUtility.getAllRunninthreads()[i].getName().equals(threadName)) { return (isExist = true); } } return isExist; } Code_at the main thread: if (e.getSource() == Bplay) { if (!ThreadsUtility.isThreadExist(MQTT_THREAD)) { System.out.println(MQTT_THREAD + " is not existing."); }else { System.out.println(MQTT_THREAD + " exists."); if (!ThreadsUtility.isThreadExist(FILE_THREAD)) { System.out.println(FILE_THREAD + " is not existing."); }else { System.out.println(FILE_THREAD + " exists."); } }
type: Question
tagged with: android
has answer: http://stackoverflow.com/a/27422612
score: 0
answer count: 2
tagged with: multithreading
tagged with: java

http://stackoverflow.com/q/27341788
favorite count: 0
has answer: http://stackoverflow.com/a/27343068
tagged with: jersey-client
has body: I got a problem to deserialize using jeresy ClientRespone.getEntity I've tried to follow some tutorials and questions, include this: http://jersey.576304.n2.nabble.com/How-can-I-parse-a-java-util-List-lt-gt-Is-it-supported-by-the-Jersey-client-td2300852.html https://jersey.java.net/nonav/documentation/1.5/json.html http://www.programcreek.com/java-api-examples/index.php?api=com.sun.jersey.api.client.GenericType and i still got the same exception over and over again.. My goal is: instead of: response.getEntity(String.class); --&gt; {"name":"Ben","type":"The man","id":0} and then parse it (using Jackson for example), I want to get the entity into my POJO object. this is my tryings so far: ServerSide: @POST @Path("/account") // route to a specific method.re @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response saveDataIntoHash(Account account) { Account createdAccount = new Account(account.getName(), account.getType()); accountHash.put(createdAccount.getID(), createdAccount); return Response.status(201).entity(new AccountResponse(createdAccount.getID())).build(); } Server side Account Class: private String name; private String type; private int ID; private static int classID = 0; public Account(String name, String type) { this.name = name; this.type = type; this.ID = classID++; } public Account() { } public void setName(String name) { this.name = name; } public String getName() { return name; } public void setType(String type) { this.type = type; } public String getType() { return type; } public int getID() { return ID; } public void setID(int ID) { this.ID = ID; } public static int getClassID() { return classID; } public static void setClassID(int classID) { Account.classID = classID; } ClientSide private static void getToRestPartner(Client client) { WebResource webResource = client.resource("http://localhost:8080/RESTfulExample/rest/account/0"); ClientResponse response = webResource.type("application/json").get(ClientResponse.cla…
has title: Jersey ClientResponse.getEntity of generic type
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
accepted answer: http://stackoverflow.com/a/27343068
type: Question
upvote count: 15
tagged with: jersey
downvote count: 0
score: 15
answer count: 1
tagged with: jax-rs

http://stackoverflow.com/comment/43367849
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27459938
type: Comment
has text: Ok, so you need some kind of search criteria when searching programmatically. You can search for it by name, key, or a variety of combinations of category and Tmodel instance info. Most use cases use some kind of configurable key or name pattern that can be set or overridden via configuration. There's a number of examples in the juddi-examples/more-uddi-samples project.

http://stackoverflow.com/comment/43376302
type: QuestionComment
has text: @abl Yes its up and running
score: 0
comment on: http://stackoverflow.com/q/27470037
type: Comment

http://stackoverflow.com/q/27348322
type: Question
score: -1
has answer: http://stackoverflow.com/a/27348334
accepted answer: http://stackoverflow.com/a/27348334
tagged with: while-loop
upvote count: 0
answer count: 1
tagged with: arguments
has body: I need to write a simple Java program so as to step through a given string (given from args[]), and receive a println once a certain character (e.g. '^') is encountered. However, I cannot find why I cannot receive such println. Could you please check what is the stem of the error? public class JavaApplication15 { public static void main(String[] args) { StringBuffer copyFromMe = null; for (int j = args.length; --j&lt;=0; ) { copyFromMe = new StringBuffer(); copyFromMe.append(args[j]); } StringBuffer copyToMe = new StringBuffer(); int i = 0; char c = copyFromMe.charAt(i); while (c != 'g') { copyToMe.append(c); c = copyFromMe.charAt(++i); } System.out.println(copyToMe); } private static String String(String[] args) { throw new UnsupportedOperationException("Not supported yet."); } }
favorite count: 0
type: AnsweredQuestion
tagged with: stringbuilder
has comment: http://stackoverflow.com/comment/109372371
tagged with: java
has title: appending arguments to a String
tagged with: loops
downvote count: 1

http://stackoverflow.com/q/27346418
has title: Need help on a simple Java assignment prompt
has comment: http://stackoverflow.com/comment/43147985
upvote count: 2
downvote count: 2
has comment: http://stackoverflow.com/comment/43148018
has comment: http://stackoverflow.com/comment/43147992
has answer: http://stackoverflow.com/a/27346689
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27346753
tagged with: java
has body: I've done multiple assignments for intro Java so far, but I need some help understanding what this prompt is asking me to do. Minimum requirements: Create a separate class that contains the following methods (4 points) Note: this class should be separate and apart from the public class that holds the main method. You can either make a class that is not a public class or you could put it in a separate .java file: A method that will accept a parameter as an integer array for the phone number and a parameter for the security code (you choose the data type for the security code). Use one (or more) repatriation structures to replace each number in the array with its encrypted version using C = (P + key) mod 10 with the appropriate digit in the security code as described above. Note: You should make the replacement *in the original array. (5 points) Create a method that will accept an encrypted phone number as an integer array and decoding key. Use one (or more) reputation structures to return it to its plain text (decrypted) version using P = (C - key) mod 10 and the conditional if (P &lt; 0) P = P + 10 Note: You should make the replacement *in the original array. (5 points) call the method in the main method with at least one sample phone number. Display the phone number in the main before and after calling each method (5 points). Important Note: You can get the phone number from the user at the console or with a GUI if you prefer to do that, but it is not required. You can put the phone number in the code when you create the array instead if you would rather do it that way. Regardless of how you get the phone number, it must be put in an array and the array must be passed to another method that accepts an array as a parameter. You should not get the phone number and prices it in the same method. Also, I need some tips on how to go about on this. I started with: public class Encrypt { public static void main(String[] args) { int[] a = {6, 5, 0, 7, 8, 7, 9, 9, 0, 9}; cip…
type: Question
answer count: 3
has comment: http://stackoverflow.com/comment/43148416
favorite count: 0
accepted answer: http://stackoverflow.com/a/27346753
score: 0
possible better answer: http://stackoverflow.com/a/27346580
has answer: http://stackoverflow.com/a/27346580

http://stackoverflow.com/a/27380766
has comment: http://stackoverflow.com/comment/43211968
has comment: http://stackoverflow.com/comment/43211235
has comment: http://stackoverflow.com/comment/43212672
has comment: http://stackoverflow.com/comment/43211030
type: Answer
has comment: http://stackoverflow.com/comment/43212455
has comment: http://stackoverflow.com/comment/43213113
has comment: http://stackoverflow.com/comment/43211171
has body: Question: In the call itemC.equals(itemB), why the equals method of Object class is getting called. Because the compile-time type of itemC is Object. Overriding is performed at execution time based on the actual type of the target object, but overloading is performed at compile time based on the compile-time type of the target expression. If you use javap -c -v Test you'll see the two method calls involved: Constant pool: ... #6 = Methodref #2.#32 // Item.equals:(LItem;)Z #7 = Methodref #16.#33 // java/lang/Object.equals:(Ljava/lang/Object;)Z ... Then the main method: 33: invokevirtual #6 // Method Item.equals:(LItem;)Z ... 40: invokevirtual #7 // Method java/lang/Object.equals:(Ljava/lang/Object;)Z So that shows the signatures for the methods that are being called. Which implementation of that signature is executed depends on the execution-time type. So if you override equals(Object) in Item, then that override will be called for itemC.equals(itemA).
answers question: http://stackoverflow.com/q/27380688
has comment: http://stackoverflow.com/comment/43211931
has comment: http://stackoverflow.com/comment/43213366
has comment: http://stackoverflow.com/comment/43212225
score: 0
has comment: http://stackoverflow.com/comment/43210952
has comment: http://stackoverflow.com/comment/43212318
has comment: http://stackoverflow.com/comment/43211780
has comment: http://stackoverflow.com/comment/43213283
has comment: http://stackoverflow.com/comment/43212771

http://stackoverflow.com/a/27432916
has body: I don't think this log comes OOTB with CQ. Which version of CQ are you using ? If it is custom log then you can go to felix console and check for logger in configuration. Or check HOST:PORT/system/console/slinglog and configure your log files there. If it is getting deployed though code then you need to remove custom logger from code. Yogesh
has comment: http://stackoverflow.com/comment/43316516
answers question: http://stackoverflow.com/q/27426183
score: 0
type: Answer

http://stackoverflow.com/comment/43396514
has text: @Yani: I use `type_` all the time; but to extend it to standard library names when naming attributes is just not required at all, just like you can safely use custom globals (that do not mask libraries) and class or instance attributes that have the same name. And again, you'll never remember them all. Do you do the same for `user`, `site`, `new`, `copy`, `code` and `test` for example? Note that the stdlib *itself* certainly doesn't; there are examples there that use these same names as attributes or function arguments.
comment on: http://stackoverflow.com/a/27465761
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/27325528
has comment: http://stackoverflow.com/comment/43110272
has body: I have this code down below. I want if there is no other person in the row my getMother Method to create a new String or Person with the first name "Eva" and return this. With my code it doesn't work. I always get "null". How can i do this? pls help public Person getMother() { if (mother == null) { Person p = new Person("Eva"); } return mother; }
favorite count: 0
has answer: http://stackoverflow.com/a/27325551
accepted answer: http://stackoverflow.com/a/27325551
type: AnsweredQuestion
tagged with: java
has title: how can i create a new String in a get Method?(Java)
type: Question
answer count: 1
score: -1
downvote count: 2
has comment: http://stackoverflow.com/comment/43110377
upvote count: 1

http://stackoverflow.com/comment/43195721
type: QuestionComment
has text: What was the exact command line you entered? Also, are you running on Windows, Linux, Mac, or something else?
type: Comment
comment on: http://stackoverflow.com/q/27372314
score: 0

http://stackoverflow.com/q/27400878
score: 4
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27401647
type: AnsweredQuestion
tagged with: java
has title: docx4j - Why is the text truncated of spaces?
has body: Here is the code: P para = factory.createP(); R run = factory.createR(); Text text = factory.createText(); text.setValue( " abc " ); run.getContent().add( text ); para.getContent().add( run ); wordMLPack.getMainDocumentPart().add( para ); Here is the docx generated: The heading and trailing spaces are all missing.
type: Question
upvote count: 4
tagged with: docx4j
accepted answer: http://stackoverflow.com/a/27401647

http://stackoverflow.com/q/27428830
has title: Typed arrays not supported : LibGDX + GWT
answer count: 1
has body: I am using LibGDX to deploy a HTML5 game thanks to GWT. Currently I am having some issues with a random error that just appeared: uncaught exception: java.lang.UnsupportedOperationException: typed arrays not supported It works on Chrome, Safari but not on Firefox. It was working a couple versions ago so I went back on GIT and recompiled and I still get this error. It works on all three browsers while debugging in SuperDev mode but when it comes to compiled version in the server Firefox won't load due to this problem. Since it works on debug it might be some compile configuration that is out of my version control, but I have no clue.
has answer: http://stackoverflow.com/a/27429004
type: UnansweredQuestion
tagged with: typed-arrays
tagged with: gwt
tagged with: java
type: Question
tagged with: libgdx
score: 0

arrays
tags question: http://stackoverflow.com/q/27320961
tags question: http://stackoverflow.com/q/27473497
tags question: http://stackoverflow.com/q/27445806
tags question: http://stackoverflow.com/q/27412367
tags question: http://stackoverflow.com/q/27424100
tags question: http://stackoverflow.com/q/27372674
tags question: http://stackoverflow.com/q/27345460
tags question: http://stackoverflow.com/q/27369013
tags question: http://stackoverflow.com/q/27445292
tags question: http://stackoverflow.com/q/27362129
tags question: http://stackoverflow.com/q/27393511
tags question: http://stackoverflow.com/q/27360633
tags question: http://stackoverflow.com/q/27325065
tags question: http://stackoverflow.com/q/27372028
tags question: http://stackoverflow.com/q/27327008
tags question: http://stackoverflow.com/q/27325427
tags question: http://stackoverflow.com/q/27414799
tags question: http://stackoverflow.com/q/27390883
type: Tag
tags question: http://stackoverflow.com/q/27415807
tags question: http://stackoverflow.com/q/27319776
tags question: http://stackoverflow.com/q/27391777
tags question: http://stackoverflow.com/q/27467401
tags question: http://stackoverflow.com/q/27449906
tags question: http://stackoverflow.com/q/27335855
tags question: http://stackoverflow.com/q/27436491
tags question: http://stackoverflow.com/q/27415463
tags question: http://stackoverflow.com/q/27416872
tags question: http://stackoverflow.com/q/27432958
tags question: http://stackoverflow.com/q/27427981
tags question: http://stackoverflow.com/q/27427225
tags question: http://stackoverflow.com/q/27471301
tags question: http://stackoverflow.com/q/27369663
tags question: http://stackoverflow.com/q/27325968
tags question: http://stackoverflow.com/q/27345226
tags question: http://stackoverflow.com/q/27341802
tags question: http://stackoverflow.com/q/27413461
tags question: http://stackoverflow.com/q/27324596
tags question: http://stackoverflow.com/q/27410244
tags question: http://stackoverflow.com/q/27347018
tags question: http://stackoverflow.com/q/27321179
tags question: http://stackoverflow.com/q/27374923
tags question: http://stackoverflow.com/q/27343663
tags question: http://stackoverflow.com/q/27323303
tags question: http://stackoverflow.com/q/27325542
tags question: http://stackoverflow.com/q/27458916
tags question: http://stackoverflow.com/q/27335512
tags question: http://stackoverflow.com/q/27421800
tags question: http://stackoverflow.com/q/27321456
tags question: http://stackoverflow.com/q/27396065
tags question: http://stackoverflow.com/q/27316109
tags question: http://stackoverflow.com/q/27443169
tags question: http://stackoverflow.com/q/27453820
tags question: http://stackoverflow.com/q/27471328
tags question: http://stackoverflow.com/q/27363343
tags question: http://stackoverflow.com/q/27369771
tags question: http://stackoverflow.com/q/27451193
tags question: http://stackoverflow.com/q/27463237
tags question: http://stackoverflow.com/q/27389040
tags question: http://stackoverflow.com/q/27387635
tags question: http://stackoverflow.com/q/27344418
tags question: http://stackoverflow.com/q/27408125
tags question: http://stackoverflow.com/q/27341530
tags question: http://stackoverflow.com/q/27430305
tags question: http://stackoverflow.com/q/27388201
tags question: http://stackoverflow.com/q/27389018
tags question: http://stackoverflow.com/q/27469768
tags question: http://stackoverflow.com/q/27329903
tags question: http://stackoverflow.com/q/27365642
tags question: http://stackoverflow.com/q/27407063
tags question: http://stackoverflow.com/q/27439089
tags question: http://stackoverflow.com/q/27381069
tags question: http://stackoverflow.com/q/27323563
tags question: http://stackoverflow.com/q/27435779
tags question: http://stackoverflow.com/q/27414176
tags question: http://stackoverflow.com/q/27352797
tags question: http://stackoverflow.com/q/27418378
tags question: http://stackoverflow.com/q/27370394
tags question: http://stackoverflow.com/q/27338962
tags question: http://stackoverflow.com/q/27369952

http://stackoverflow.com/comment/43367345
type: AnswerComment
comment on: http://stackoverflow.com/a/27465425
score: 0
type: Comment
has text: If I try 1000000 and more than one trial I get the first trial 3.14321 but the other trials are bigger numbers...weird.

http://stackoverflow.com/comment/43423959
score: 0
type: Comment
has text: Thank you for the answer, I will read the links you have given.
type: AnswerComment
comment on: http://stackoverflow.com/a/27489600

http://stackoverflow.com/comment/43130279
score: 1
type: Comment
type: QuestionComment
has text: there is also an outerHtml() method
comment on: http://stackoverflow.com/q/27335575

http://stackoverflow.com/comment/43190168
type: Comment
has text: The error with the code above is a cannot find symbol for the student1.menu(); in line 9. The error states that it can't find symbol
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27369102

http://stackoverflow.com/comment/43517228
type: Comment
has text: https://android-review.googlesource.com/#/c/119386/ seems to be the relevant change in 24.0.2 - it includes a snapshot of old 23.x templates while android studio gets independent new templates. I guess that also means that one should prefer to use studio to create projects from templates since the eclipse ones are stuck with what we have today.
comment on: http://stackoverflow.com/a/27520559
score: 1
type: AnswerComment

http://stackoverflow.com/comment/43381257
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27469344
has text: I fully understand the last code. But confused about where the other code should go.
type: AnswerComment

http://stackoverflow.com/q/27342121
type: AnsweredQuestion
score: -1
favorite count: 0
has body: I've typed up a Java program that calculates arrays of grades for students. The problem is that only one of the data sets is printed to screen, namely the grades for student 10. I'm looking to print all the grades for all the students. Any idea what would remedy this? Here's the code: public class SummariseGrades { public static void main (String[]args) { //2d array of student grades int [][] gradesArray = { { 87,96,70 }, { 68,87,90 }, { 94,100,90 }, { 100,81,82}, { 83,65,85}, { 78,87,85}, { 85,75,83}, { 91,94,100}, { 76,72,84}, { 87,93,73} }; //output grades array outputGrades ( gradesArray ); //call methods getMinimum and getMaximum System.out.printf ("\n %s %d \n %s %d \n \n", "Lowest grade is", getMinimum ( gradesArray ), "Highest grade is", getMaximum (gradesArray ) ) ; //output grade distribution chart of all grades on all tests outputBarChart (gradesArray); } //end main //find minimum grade public static int getMinimum (int grades [][]) { //assume first element of grades array is the minumum int lowGrade = grades [0][0]; //loop through rows of grades array for (int [] studentGrades : grades ) { //loop throught the columns of current row for (int grade : studentGrades ) { //if grade less than lowGrade, assign it to lowGrade if (grade &lt; lowGrade) lowGrade = grade ; } //end inner }//end outer return lowGrade; // returns lowest grade } //end method getMinimum //find maximum grade public static int getMaximum (int grades [][]) { //assume first element is the largest in array int highGrade = grades [0][0]; //loop through rows of the grades array for (int[] studentGrades : grades) { //loop through columns of the current row for (int grade: studentGrades) { //if grade greater than highGrade then assign it to highGrade if (grade &gt; highGrade) highGrade = grade; } //end inner } //end outer return highGrade; // return highest grade } //end method getMaximum //determine average grade for particular set of grades public static double getAverage (int[] setOfGrades ) {…
has answer: http://stackoverflow.com/a/27342222
type: Question
has comment: http://stackoverflow.com/comment/43140042
answer count: 2
has comment: http://stackoverflow.com/comment/43140338
has comment: http://stackoverflow.com/comment/43139980
downvote count: 1
has comment: http://stackoverflow.com/comment/43139941
possible better answer: http://stackoverflow.com/a/27342222
has answer: http://stackoverflow.com/a/27342918
has comment: http://stackoverflow.com/comment/43139957
tagged with: java
has comment: http://stackoverflow.com/comment/43140092
has comment: http://stackoverflow.com/comment/43140152
has comment: http://stackoverflow.com/comment/43140081
tagged with: output
has title: Java array display is cut short
has comment: http://stackoverflow.com/comment/43140074
has comment: http://stackoverflow.com/comment/43140005
upvote count: 0
tagged with: arrays
has comment: http://stackoverflow.com/comment/43140112
accepted answer: http://stackoverflow.com/a/27342918

http://stackoverflow.com/comment/43277902
comment on: http://stackoverflow.com/a/27417232
type: Comment
has text: That's got it! Thanks heaps for your help. :)
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43302346
score: 1
has text: Not sure on your Java issue but as a suggestion for SQL you should use `JOIN` instead of old syntax. `SELECT ShowTime FROM Movie M JOIN screens s ON M.MovieID = s.MovieID WHERE M.MovieID = 01`
comment on: http://stackoverflow.com/q/27430551
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27412336
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27412647
has comment: http://stackoverflow.com/comment/43269380
has title: Ant using wrong Java version
tagged with: ant
upvote count: 2
answer count: 1
downvote count: 0
tagged with: macos
favorite count: 0
has body: Ant is using Java 1.5, even though I don't have Java 1.5 installed. I have to use ant 1.6.5. It's not a choice to upgrade. diagnostics has interesting output: java -version java version "1.6.0_37" ./apache-ant-1.6.5/bin/ant -v | grep -i java Detected Java version: 1.5 in: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home It seems that there is a configuration that forces ant to run java in 1.5 compatibility. I cannot find this configuration anywhere. Any ideas what is going on?
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27412647
score: 2

http://stackoverflow.com/comment/43224855
type: QuestionComment
comment on: http://stackoverflow.com/q/27388463
has text: "Would this allow two different threads to put two different keys simultaneously into the hash map?" <-- well, if your map is only accessed from within this method, the answer is no
score: 0
type: Comment

http://stackoverflow.com/a/27371947
score: 1
accepted answer of: http://stackoverflow.com/q/27367636
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27367636
has body: Try myListView.setItemChecked(-1, true); right after referencing/initializing your list view. try requestFocus on any other view if that didn't work.

http://stackoverflow.com/comment/43306593
type: Comment
comment on: http://stackoverflow.com/a/27432500
score: 0
type: AnswerComment
has text: I see what your saying there, still wont recognize the win though. **bands head off wall**

http://stackoverflow.com/q/27438602
has answer: http://stackoverflow.com/a/27438880
upvote count: 2
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27439162
answer count: 2
score: 2
downvote count: 0
favorite count: 0
has title: Is it possible to modify the existing id in elasticsearch document?
type: UnansweredQuestion
has body: I've to change the format of elasticseach document id, I was wondering if its possible without deleting and re-indexing all the documents.
tagged with: elasticsearch

http://stackoverflow.com/comment/63500325
score: 0
type: AnswerComment
has text: Letting `this` escape before the object has been fully initialized is a terrible idea, regardless if it's done from the constructor or from an init method, and regardless if there are multiple threads or not.
type: Comment
comment on: http://stackoverflow.com/a/27453164

http://stackoverflow.com/comment/43371301
comment on: http://stackoverflow.com/a/27467362
score: 0
type: AnswerComment
type: Comment
has text: there is no catch anywhere except this.

minimax
type: Tag
tag name: minimax
tags question: http://stackoverflow.com/q/27471746

http://stackoverflow.com/comment/43259444
comment on: http://stackoverflow.com/q/27371075
score: 0
type: Comment
type: QuestionComment
has text: Why is this a "duplicate"? The question doesn't mention java. In C++, where the unary + can be overloaded, this is a valid question.

http://stackoverflow.com/q/27455672
answer count: 1
downvote count: 0
favorite count: 0
duplicate of: http://stackoverflow.com/q/513832
has body: I'm trying to create a program in Java which allows the user to pick from a list of coffees contained in a String array and continues on, but it fails the check and prints out the else statement. Here is the relevant code: Scanner scan = new Scanner(System.in); String[] flavors = {"Black", "French Vanilla", "Hazelnut", "Mango", "Cherokee", "anarcho-syndicalism", "Otis" }; ... System.out.println("Today we have " + Arrays.toString(flavors)); System.out.println("Please enter the name of the coffee you would like exactly as shown above: "); String coffee = scan.next(); ... for (int i = 0; i &lt; flavors.length; i++) { if (coffee == flavors[i]) { String selection = flavors[i]; Though not shown here, I believe everything's properly formatted later on in the program. Any ideas?
tagged with: java.util.scanner
has answer: http://stackoverflow.com/a/27455693
upvote count: 1
type: AnsweredQuestion
has title: 'If' Statement Failing Check Involving String Array
score: 1
tagged with: java
tagged with: eclipse
type: Question
accepted answer: http://stackoverflow.com/a/27455693
tagged with: if-statement
tagged with: arrays
linked to: http://stackoverflow.com/q/513832

http://stackoverflow.com/q/27433837
answer count: 1
has comment: http://stackoverflow.com/comment/43309062
favorite count: 0
upvote count: 3
tagged with: static
tagged with: android
downvote count: 0
tagged with: transactions
has title: Android - executePendingTransactions cannot be referenced from static context
tagged with: java
has answer: http://stackoverflow.com/a/27434123
accepted answer: http://stackoverflow.com/a/27434123
type: Question
type: AnsweredQuestion
score: 3
tagged with: execution
has comment: http://stackoverflow.com/comment/43308819
has body: I know from this answer that If you want to immediately executing any such pending operations, you can call this function (only from the main thread) to do so. But, if I call it from the static main thread, I get an error that says executePendingTransactions() is non-static and cannot be referenced from static context. How do I fix this? Thank you!

http://stackoverflow.com/comment/43387764
type: Comment
has text: i just did ../PurchaseCheckout since I did ../PurchaseCreate for previous and it works. Both are in the same folder and both JSP are in the same folder. My purchaseCheckOut are under source packages -> model and my jsp files are under web pages -> Member Access
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27473734

http://stackoverflow.com/q/27451933
has comment: http://stackoverflow.com/comment/43342617
has comment: http://stackoverflow.com/comment/43342507
has comment: http://stackoverflow.com/comment/43342471
upvote count: 2
tagged with: arraylist
has answer: http://stackoverflow.com/a/27452061
score: 0
downvote count: 2
has body: im having some issues when using the method isEmpty() with ArrayList. I have two ArrayLists initialized with the values of two Arrays: getDrivers() and getCars(). ArrayList&lt;Driver&gt; drivers = new ArrayList&lt;&gt;(Arrays.asList(getDrivers())); ArrayList&lt;Car&gt; cars = new ArrayList&lt;&gt;(Arrays.asList(getCars())); I know both arrays are empty cause I havent written anything in them, so the ArrayLists should be emptied too, but when i execute these sentences: drivers.isEmpty()) cars.isEmpty() The result is: false false for both sentences How is it possible?
answer count: 1
has comment: http://stackoverflow.com/comment/43342376
favorite count: 0
has comment: http://stackoverflow.com/comment/43342372
has comment: http://stackoverflow.com/comment/43342369
has comment: http://stackoverflow.com/comment/43342368
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43345760
tagged with: java
type: Question
has title: ArrayList isEmpty() always returning true
accepted answer: http://stackoverflow.com/a/27452061

http://stackoverflow.com/a/27319843
upvote count: 1
type: Answer
downvote count: 0
has body: Just run over the list and save the smallest element: int min = uInpunt.get(0); for (int i = 1; i &lt; uInput.size(); i++) { int curr = uInput.get(i); if (curr &lt; min) { min = curr; } } System.out.println ("The smallest number is: " + min);
score: 1
answers question: http://stackoverflow.com/q/27319776

http://stackoverflow.com/q/27408649
score: 0
answer count: 3
tagged with: user-interface
has comment: http://stackoverflow.com/comment/43269114
has answer: http://stackoverflow.com/a/27410140
has answer: http://stackoverflow.com/a/27408870
type: AnsweredQuestion
tagged with: java
has body: I am current writing if statements to check if the swing components (JtextField &amp; JcomboBox (x2)) within my GUI are empty or not. I initially just made an if statement for the scenario that the JTextField and two JComboBox's are empty, therefore dispay error dialog: if (NameOfCruise.equals("") &amp;&amp; startLValue.equals("") &amp;&amp; endLValue.equals("")) { JOptionPane.showMessageDialog(Frame2, "Please Complete Form.", "Error", JOptionPane.ERROR_MESSAGE); System.out.print("Please Complete Form."); Frame2.setVisible(true); } However, upon further thinking, I have realized that there are more scenario's I have not considered. I realized I need error messages for the following scenario's: 1. Cruise Name, startL or endL values are all left empty. 2. If Cruise Name left empty but StartL and EndL are both selected. 3. If Cruise Name &amp; StartL left empty but EndL selected. 4. If Cruise Name &amp; EndL left empty but StartL selected. &amp; probably more which I haven't realized yet. I started to implement if statements for the above but have came across a problem. Here is my code so far: // 2. Error message CruiseName left empty but StartL and EndL are both selected. if(NameOfCruise.equals("") &amp;&amp; !startLValue.equals("") || !endLValue.equals("")){ JOptionPane.showMessageDialog(Frame2, "Please enter Cruise Name.", "Error", JOptionPane.ERROR_MESSAGE); System.out.print("Name of Cruise not entered. Please enter Cruise Name.\n"); Frame2.setVisible(true); } // 3. Error message if Name of Cruise &amp; StartL left empty but EndL is selected. if(startLValue.equals("") &amp;&amp; NameOfCruise.equals("") || !endLValue.equals("")){ JOptionPane.showMessageDialog(Frame2, "Please Select a Start Location.", "Error", JOptionPane.ERROR_MESSAGE); System.out.print("Select a start location.\n"); Frame2.setVisible(true); } The Problem: If you look at the code above, the way I tested (3) is by leaving the Cruise name and StartL location empty and by entering the EndL value. Howe…
tagged with: swing
accepted answer: http://stackoverflow.com/a/27410140
type: Question
possible better answer: http://stackoverflow.com/a/27408869
tagged with: if-statement
has title: if statements to check if Swing components are empty or not
has answer: http://stackoverflow.com/a/27408869

http://stackoverflow.com/a/27411886
answers question: http://stackoverflow.com/q/27411639
has comment: http://stackoverflow.com/comment/43268941
has comment: http://stackoverflow.com/comment/43268389
type: Answer
score: 2
downvote count: 0
has body: You're not using or checking the map correctly. First, you need to map the username to the password: usersMap.put(registerUser.getText(), registerPassword.getPassword()); Now whenever you have a login attempt, you try to find the username in the map, if a user is found, you compare the stored password with the login password: if (usersMap.containsKey(loginUser.getText())) { String storedPassword = usersMap.get(loginUser.getText()); if (storedPassword.equals(loginPassword.getPassword())) { // valid login } else { // invalid login } } else { // invalid login }
upvote count: 2
has comment: http://stackoverflow.com/comment/43268726
has comment: http://stackoverflow.com/comment/43268767

http://stackoverflow.com/comment/43393064
type: Comment
comment on: http://stackoverflow.com/a/27475155
has text: And pravin if i have 5 string so is it i have append each string and then in controller i have to use requestparm of all these string can i use here model ?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43310579
type: Comment
has text: what do you mean by discount the image?
comment on: http://stackoverflow.com/a/27434707
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43344130
type: Comment
has text: Eclipse is what I used. What error message do you get?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27452735

http://stackoverflow.com/comment/124345735
has text: It's easy to make the intuitive mistake that the last entry would be easily accessible at the "end" of the data structure. I had to remind myself that the "easily accessible" entry for a red-black tree is actually the _median_ element (i.e., the element at the root of the tree).
comment on: http://stackoverflow.com/a/27364997
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43287569
comment on: http://stackoverflow.com/q/27421911
has text: Note that a server receives the requests, not the framework you use. The framework may do some request processing as the result of the server receiving the requests and if you write code that eats up 50% CPU time for no reason, things won't work well. The point being that this is more related to what server software you use and what hardware you run it on - it is going to work fine on a decent computer with proper network configuration, its going to work considerably less fine on a Raspberry PI.
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/27338582
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27338538
type: Answer
answers question: http://stackoverflow.com/q/27338538
has body: You probably want to enable depth testing. Without depth testing, polygons always overwrite polygons that were previously rendered. So if the back square happened to be drawn after the front square, you'll see the back square "on top of" the front square, exactly as in your picture. With depth testing, the graphics system will only overwrite pixels that are farther away from the camera. As far as I know, all LWJGL display modes include a depth buffer already (which is required for depth testing to work). So all you need to do is add: GL11.glEnable(GL11.GL_DEPTH_TEST); to your initialization code.
upvote count: 1
score: 1

http://stackoverflow.com/comment/43357036
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27460053
has text: The path of my jar file is `D:\Workplace\SRS2ER\Stanford\edu\nlp\LexicalizedParser.jar`. The `SRS2ER` is another eclipse project which does some work. How do I include it in the plugin project? That is exactly where I am getting stumped.
type: Comment

http://stackoverflow.com/a/27424762
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27410048
type: Answer
has body: As of Kettle 5.0, it is possible to create a plugin to provide new Value types: http://jira.pentaho.com/browse/PDI-191 I have a plugin to add a key/value type (like java.util.Map): https://github.com/mattyb149/pdi-valuemeta-map and another to represent a Graph (using a property graph model): https://github.com/mattyb149/pdi-graph-computing/tree/master/pdi-valuemeta-graphSON Both of these are in the PDI Marketplace if you'd like to try them out :)
score: 4
has comment: http://stackoverflow.com/comment/43498663
upvote count: 4
has comment: http://stackoverflow.com/comment/55504802
accepted answer of: http://stackoverflow.com/q/27410048

http://stackoverflow.com/comment/43372275
type: QuestionComment
has text: Wy do you want a lambda reference? You can always use an instance to access `public` fields. Like `new A().id`. And I hope you have a really `STRONG` reason to create a public field. But since it is `final`, I don't think thats gonna create a problem.
comment on: http://stackoverflow.com/q/27467946
score: 0
type: Comment

http://stackoverflow.com/comment/43240448
type: AnswerComment
comment on: http://stackoverflow.com/a/27397181
has text: I think this will result in `4BIC`?
type: Comment
score: 0

http://stackoverflow.com/comment/43152426
has text: Element link = values.get(0);
comment on: http://stackoverflow.com/a/27346408
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/27370631
has comment: http://stackoverflow.com/comment/43192835
has body: getSpecificProduct(...) is accessing an list that is empty. You are passing the position of the Adapter into this empty list that exists on your Pedido object, which is not what it intended within getView I assume that you are trying to actually made a list of Products, in which case, why do you not just have your adapter use an ArrayList&lt;Produto&gt;?
answers question: http://stackoverflow.com/q/27370500
score: 0
type: Answer

http://stackoverflow.com/comment/43116577
comment on: http://stackoverflow.com/q/27328998
score: 0
type: Comment
type: QuestionComment
has text: You know it is a `String` and you want some operation done on it. Read the API: https://docs.oracle.com/javase/7/docs/api/java/lang/String.html. That way you would learn this and more. Stackoverflow is no substitute for API documentation.

http://stackoverflow.com/q/27338263
answer count: 1
has comment: http://stackoverflow.com/comment/43133524
has body: I'm building an Android app that requires some files sent to it from our server. I've implemented both the Server Socket in Java and the Android socket client and tested it, but the transfer is too slow. FILE SIZE: 5 MB TRANSFER TIME: 15.3 seconds So the server is set up on my own PC, I use port forwarding so I can be able to connect to it from any network. If you think it's relevant, here is a speed test of my network: http://www.speedtest.net/my-result/3965566858 Now the server code: BufferedInputStream musicData = new BufferedInputStream(new FileInputStream(new File("fileSrc"))); byte[] data = new byte[8192]; int count = 0; while ((count = musicData.read(data)) &gt; 0) { outStreamMusic.write(data, 0, count); } Client code: InputStream inStream = socketClient.getInputStream(); byte[] data = new byte[8192]; int count = 0; while ((count = inStream.read(data)) &gt; 0) { tempFile.write(data, 0, count); } So this will open the file, parse it and send bytes until there's nothing else to send. I'm pretty sure this can be done faster but I have no idea how. The Android client just opens a socket to my ip/port and reads data from it. Any idea how to make this faster?
type: UnansweredQuestion
tagged with: sockets
has comment: http://stackoverflow.com/comment/43133161
has title: How to FAST transfer files from server to Android phone with Java?
has answer: http://stackoverflow.com/a/27338384
tagged with: server
has comment: http://stackoverflow.com/comment/43133278
tagged with: java
has comment: http://stackoverflow.com/comment/43133344
has comment: http://stackoverflow.com/comment/43133435
has comment: http://stackoverflow.com/comment/43133342
type: Question
has comment: http://stackoverflow.com/comment/43133428
has comment: http://stackoverflow.com/comment/43133403
score: 0
tagged with: android

http://stackoverflow.com/comment/43328835
has text: opsss...for an error I think that I am logged using my other email address !!! Now I will come back to use only the main one !!!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27442366
score: 0

http://stackoverflow.com/q/27407501
upvote count: 3
tagged with: oracle-database
tagged with: jdbc
type: AnsweredQuestion
score: 2
accepted answer: http://stackoverflow.com/a/27407764
tagged with: java
has title: Why PreparedStatement is much faster than Statement?
type: Question
has body: A few days ago I had to create some processing performance tests using an in memory computing framework. So in order to do this, I needed a big data pool, which was increased incrementally given the various performance tests. The DB was Oracle, containing a table of 22 fields. This table needed to be populated gradually from 1 mil records to 100 mil records. For populating the table with 1 mil, I generated random test data and used java Statement to insert it into DB, and that has taken around 17 and 16 seconds minutes. After that, I quickly realized that to populate a 100 mil records table will take forever so I tried it with PreparedStatement because I knew that is a bit faster… but the difference was so immense, 1 min and 24 seconds, that I have started to search the web the reason behind this and found out some reasons but nothing that, in my opinion, should have this impact. this is what I have found that might explain this difference: LINK PreparedStatement gets pre compiled In database and there access plan is also cached in database, which allows database to execute parametric query written using prepared statement much faster than normal query because it has less work to do. You should always try to use PreparedStatement in production JDBC code to reduce load on database. In order to get performance benefit its worth noting to use only parametrized version of sql query and not with string concatenation. BUT all the data was generated randomly, so no major caching from oracles side should be involved.
has answer: http://stackoverflow.com/a/27407764
has comment: http://stackoverflow.com/comment/43259794
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/62644868
favorite count: 0

http://stackoverflow.com/q/27452738
has comment: http://stackoverflow.com/comment/43344005
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has title: How to get all the causes of an exception using core Java only?
has body: I have an SQL exception stack trace to demonstrate this. I want to get all the lines which start with "Caused by:". I don't want to use any Apache APIs for this. How do I do it ? java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:489) at oracle.jdbc.driver.PhysicalConnection.&lt;init&gt;(PhysicalConnection.java:553) at oracle.jdbc.driver.T4CConnection.&lt;init&gt;(T4CConnection.java:254) at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32) at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:528) at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at source.DBUtils.getDBConnection(DBUtils.java:41) at source.Mups.main(Mups.java:42) Caused by: oracle.net.ns.NetException: The Network Adapter could not establish the connection at oracle.net.nt.ConnStrategy.execute(ConnStrategy.java:439) at oracle.net.resolver.AddrResolution.resolveAndExecute(AddrResolution.java:454) at oracle.net.ns.NSProtocol.establishConnection(NSProtocol.java:693) at oracle.net.ns.NSProtocol.connect(NSProtocol.java:251) at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1140) at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:340) ... 8 more Caused by: java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) at java.net.AbstractPlainSocketImpl.connect(Unknown Source) at java.net.PlainSocketImpl.connect(Unknown Source) at java.net.SocksSocketImpl.connect(Unknown Source) at java.net.Socket.connect(Unknown Source) at oracle.net.nt.TcpNTAdapter.connect(TcpNTAdapter.java:149) at oracle.net.nt.ConnOption.connect(ConnOptio…
has answer: http://stackoverflow.com/a/27452990
type: Question
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/43344495
possible better answer: http://stackoverflow.com/a/27452990
favorite count: 0
accepted answer: http://stackoverflow.com/a/27452907
has answer: http://stackoverflow.com/a/27452907

http://stackoverflow.com/q/27391055
type: Question
has answer: http://stackoverflow.com/a/40041784
has body: Currently, all of my JUnit tests extend from a common base class that provides methods tagged with @BeforeClass and @AfterClass annotations - all these really do is setup a bunch of static resources/services for the tests to use. This seems a awkward to me for a few reasons: Part of the point of JUnit4 (from my understanding) is that we shouldn't need this classical test inheritance anymore. When I run these tests as part of a suite instead of individually (which we often do), the @BeforeClass and @AfterClass get invoked multiple times, slowing down the tests - we really should only be calling these once What I'd like to do is somehow move the current BeforeClass/AfterClass logic out of the inheritance chain and into something that can be shared by individual tests and the suite as a whole. Can this be done? If so, how? (If it matters, I'm using JUnit 4.7, and it could be a hard sell to update to a different version)
upvote count: 34
tagged with: java
answer count: 3
tagged with: unit-testing
has answer: http://stackoverflow.com/a/27392035
tagged with: junit4
has answer: http://stackoverflow.com/a/27572037
possible better answer: http://stackoverflow.com/a/27392035
score: 34
has title: How to share JUnit BeforeClass logic among multiple test classes
type: AnsweredQuestion
tagged with: junit
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/27572037

http://stackoverflow.com/a/57242224
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27457052
has body: below it is my code to open an .exe in my netbeans GUI program: private void clockActionPerformed(java.awt.event.ActionEvent evt) { try { // file path to open File u = new File("C:\\Program Files (x86)\\Desktop Countdown Timer\\DesktopCountdownTimer.exe"); Desktop d = Desktop.getDesktop(); d.open(u); } catch (IOException eevt) { JOptionPane.showMessageDialog(this, eevt.getMessage()); } }

sockets
tags question: http://stackoverflow.com/q/27467590
tags question: http://stackoverflow.com/q/27392246
tags question: http://stackoverflow.com/q/27341162
tags question: http://stackoverflow.com/q/27424845
tags question: http://stackoverflow.com/q/27395929
tags question: http://stackoverflow.com/q/27376679
tags question: http://stackoverflow.com/q/27333205
tags question: http://stackoverflow.com/q/27344507
tags question: http://stackoverflow.com/q/27367355
tags question: http://stackoverflow.com/q/27391218
tags question: http://stackoverflow.com/q/27326738
tags question: http://stackoverflow.com/q/27326410
tags question: http://stackoverflow.com/q/27330862
tags question: http://stackoverflow.com/q/27427171
tags question: http://stackoverflow.com/q/27431176
type: Tag
tags question: http://stackoverflow.com/q/27320870
tags question: http://stackoverflow.com/q/27338263
tags question: http://stackoverflow.com/q/27393962
tags question: http://stackoverflow.com/q/27400488
tags question: http://stackoverflow.com/q/27377693
tags question: http://stackoverflow.com/q/27332315
tags question: http://stackoverflow.com/q/27463631
tags question: http://stackoverflow.com/q/27368560
tags question: http://stackoverflow.com/q/27348698
tags question: http://stackoverflow.com/q/27315629
tag name: sockets
tags question: http://stackoverflow.com/q/27331263
tags question: http://stackoverflow.com/q/27320827
tags question: http://stackoverflow.com/q/27456124
tags question: http://stackoverflow.com/q/27403964
tags question: http://stackoverflow.com/q/27416952
tags question: http://stackoverflow.com/q/27408694
tags question: http://stackoverflow.com/q/27361482
tags question: http://stackoverflow.com/q/27349749
tags question: http://stackoverflow.com/q/27332507
tags question: http://stackoverflow.com/q/27375381
tags question: http://stackoverflow.com/q/27344004
tags question: http://stackoverflow.com/q/27332627

http://stackoverflow.com/comment/43169817
comment on: http://stackoverflow.com/a/27322141
has text: RE350 if possible can u pls look now i have edited the question and its content. thanks in advance
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43142054
score: 2
comment on: http://stackoverflow.com/q/27343253
has text: @user13107 ctrl-a to select all breakpoints, then rightclick -> disable, then enable the one you want
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27354743
upvote count: 9
has comment: http://stackoverflow.com/comment/75328247
has title: Using Nested Projections in Spring Data REST
tagged with: spring
has body: How to get expected output below where OrderProjection uses ItemProjection to render Items using Spring Data REST GET /orders/1?projection=with_items Projections : @Projection(name = "summary", types = Item.class) public interface ItemProjection { String getName(); } @Projection(name = "with_item", types = Order.class) public interface OrderProjection { LocalDateTime getOrderedDate(); Status getStatus(); Set&lt;ItemProjection&gt; getItems(); // this is marshalling as Set&lt;Item&gt; (full Item graph) } Currently getting as output: { "status" : "PAYMENT_EXPECTED", "orderedDate" : "2014-11-09T11:33:02.823", "items" : [ { "name" : "Java Chip", "quantity" : 1, "milk" : "SEMI", "size" : "LARGE", "price" : { "currency" : "EUR", "value" : 4.20 } } ], "_links" : { "self" : { "href" : "http://localhost:8080/orders/1{?projection}", "templated" : true }, "restbucks:items" : { "href" : "http://localhost:8080/orders/1/items" }, "curies" : [ { "href" : "http://localhost:8080/alps/{rel}", "name" : "restbucks", "templated" : true } ] } } Expected Output: { "status" : "PAYMENT_EXPECTED", "orderedDate" : "2014-11-09T11:33:02.823", "items" : [ { "name" : "Java Chip" } ], "_links" : { "self" : { "href" : "http://localhost:8080/orders/1{?projection}", "templated" : true }, "restbucks:items" : { "href" : "http://localhost:8080/orders/1/items" }, "curies" : [ { "href" : "http://localhost:8080/alps/{rel}", "name" : "restbucks", "templated" : true } ] } }
type: AnsweredQuestion
downvote count: 0
tagged with: java
score: 9
type: Question
tagged with: spring-data-rest
has answer: http://stackoverflow.com/a/27376026
accepted answer: http://stackoverflow.com/a/27376026
answer count: 1
favorite count: 0

http://stackoverflow.com/q/27398597
type: AnsweredQuestion
downvote count: 0
score: 1
favorite count: 0
tagged with: tf-idf
type: Question
upvote count: 1
has answer: http://stackoverflow.com/a/27398767
tagged with: java
has comment: http://stackoverflow.com/comment/43242971
has comment: http://stackoverflow.com/comment/43242855
answer count: 1
has body: I am trying to calculate the tf and idf of a collection of documents. My problem is that I get infinity and I dont want infinity but I want double results. Here is my code: String key = entry.getKey().toString(); Integer value = entry.getValue().intValue(); System.out.println("key " + key + " value " + value); BigDecimal tf=new BigDecimal(entry.getValue()/collection.size()); BigDecimal idf=new BigDecimal(Math.log(counter/entry.getValue())); BigDecimal tfidf =new BigDecimal((tf.doubleValue())*(idf.doubleValue())); System.out.println("TF*IDF: " + key + ": " + tfidf.doubleValue()); input: Map where String is the keyword and the Integer is how many times word appears in the document. output: keyword + TF*IDF:number Any idea how to solve this problem?
has title: Infinity results
accepted answer: http://stackoverflow.com/a/27398767
has comment: http://stackoverflow.com/comment/43242897

opennlp
type: Tag
tags question: http://stackoverflow.com/q/27432286
tag name: opennlp
tags question: http://stackoverflow.com/q/27402189

http://stackoverflow.com/comment/43442477
score: 0
type: Comment
has text: Yes, the computation looks like `features[hash(feature) % numFeatures] += 1`. The vectors that are created are usually used as input to some model so using `Double.MAX_VALUE` would imply a gigantic model. One of the main motivations of the hashing trick is memory reduction. You certainly could create features in the way you are suggesting but I'm not sure how to evaluate the benefits of such an approach.
comment on: http://stackoverflow.com/a/27391036
type: AnswerComment

http://stackoverflow.com/a/27397358
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27317260
type: Answer
has body: According to documentation - "This exception is thrown when a timeout expired on a socket read or accept operation." You can catch both SocketTimeOutException and ConnectionTimeOutException separately.
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27317260
type: AcceptedAnswer

http://stackoverflow.com/q/27418247
tagged with: perforce
has title: Trying to import existing Perforce Project in Eclipse
has body: I have imported Perforce Project to my local Drive and then i create workspace in Eclipse Luna, but when i try to import project using File->Import->General->Existing Projects into Workspace then i select root directory of my project. Import wizard scans whole project and then gives me the warning No projects are found to import. I know the project that i am importing does not have any .classpath and project file. Is there any straight forward way to import the project from Local directory ? Any help is greatly appreciated.
tagged with: eclipse
has answer: http://stackoverflow.com/a/27418347
answer count: 2
accepted answer: http://stackoverflow.com/a/27418480
downvote count: 0
possible better answer: http://stackoverflow.com/a/27418347
favorite count: 0
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27418480
upvote count: 1
type: Question

http://stackoverflow.com/a/27406812
upvote count: 3
has comment: http://stackoverflow.com/comment/43258204
has body: The problem is that when v == i, you are modifying the same list as you are iterating over. A simple solution is to guard for this condition: for(Iterator&lt;Integer&gt; it = graph.get(v).iterator(); it.hasNext();) { Integer i = it.next(); if (i == v) { it.remove(); } else { graph.get(i).remove((Integer) v); } }
has comment: http://stackoverflow.com/comment/43258532
has comment: http://stackoverflow.com/comment/43258163
answers question: http://stackoverflow.com/q/27406571
downvote count: 0
has comment: http://stackoverflow.com/comment/43258457
has comment: http://stackoverflow.com/comment/43258848
has comment: http://stackoverflow.com/comment/43258957
type: Answer
score: 3

http://stackoverflow.com/comment/43167467
type: Comment
comment on: http://stackoverflow.com/a/27357413
score: 0
type: AnswerComment
has text: the above code works for me. i just added this `System.out.println(m.group(0));` line only.

http://stackoverflow.com/a/30721103
upvote count: 1
downvote count: 1
has body: Try (Another option): import com.ibm.ws.portletcontainer.portlet.PortletUtils; public HttpServletRequest getHttpServletRequest(PortletRequest request) { return PortletUtils.getHttpServletRequest(request); } You must install the jar (com.ibm.ws.portletcontainer.jar) in your local maven repository. This jar is in: WebSphere / AppServer / plugins
has comment: http://stackoverflow.com/comment/49499903
score: 0
has comment: http://stackoverflow.com/comment/49499973
type: Answer
answers question: http://stackoverflow.com/q/27387296

http://stackoverflow.com/q/27368895
tagged with: layout
tagged with: jpanel
has body: I've a class that extends JPanel I use it as GUI to hold a worker information including a salary which is available in two options chosen by radio buttons. When the first one is chosen nothing has to be done on the panel. But if the second radio button is chosen we have to show some extra text fields, and *here comes the problem - my panel does not resize to fit the components and its goes totally in disorder. I've tried to implement an observer pattern but it doesn't work or may have done it wrong here in follow the main parts of my class. public class EmpDetails extends JPanel { public EmpDetails() { matriculeLab = new JLabel("MATRICULE :"); matriculeTxt = new JTextField(10); nomLab = new JLabel("Nom :"); nomTxt = new JTextField(30); serviceLab = new JLabel("SERVICE :"); serviceDrBx = new JComboBox&lt;&gt;(); fonctionLab = new JLabel("FONCTION :"); fonctionDrBx = new JComboBox&lt;&gt;(); dateEmbLab = new JLabel("DATE D'EMBAUCHE :"); dateEmb = DatePick.getDatePick(); /// This is the first radio button salaireFxBtn = new JRadioButton("FIXE "); salaireFxBtn.setSelected(true); /// This is the second radio button that shows the hiden elements salaireChngBtn = new JRadioButton("CHANGEANT "); bg.add(salaireFxBtn); bg.add(salaireChngBtn); btnPanel.setLayout(new GridLayout(2, 1)); btnPanel.add(salaireFxBtn); btnPanel.add(salaireChngBtn); salaireLab = new JLabel("MONTANT DU SALAIRE:"); montatSalFix = new JFormattedTextField(NumberFormat.getIntegerInstance()); /// This is the panel holding the hidden elements its shown when radio button 2 is clicked salPanel.setLayout(new GridLayout(3, 2)); salaire1 = new JLabel("MONTANT SALAIRE 1:"); montantSal1 = new JFormattedTextField(NumberFormat.getIntegerInstance()); salPanel.add(salaire1); salPanel.add(montantSal1); periodeLab1 = new JLabel("DUREE 1 :"); periode1 = new JFormattedTextField(NumberFormat.getIntegerInstance()); salPanel.add(periodeLab1); salPanel.add(periode1); salaire2 = new JLabel("MONTANT SALAIRE 2:"); montantSal2 = n…
has comment: http://stackoverflow.com/comment/43202423
answer count: 1
downvote count: 0
tagged with: layout-manager
has comment: http://stackoverflow.com/comment/43189616
favorite count: 0
has comment: http://stackoverflow.com/comment/43202401
has title: Resizing a JPanel and its components to show hidden elements
has answer: http://stackoverflow.com/a/27390416
type: UnansweredQuestion
score: 1
tagged with: java
upvote count: 1
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/43189742

http://stackoverflow.com/comment/43452647
has text: sorry I meant 3 functions, last two with the same name
comment on: http://stackoverflow.com/a/27451145
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27414324
has body: There is no built in method that does this. Use the overloaded String#indexOf(String, int) method that accepts a starting position. Keep looping until you get -1, always providing the result of the previous call as the starting position. You can add each result in a List and convert that to an int[] later. Alternatively, use Pattern and Matcher, looping while Matcher#find() returns a result. Here are a few examples: public static void main(String[] args) { String command = "-u User -P Password mkdir \"temp dir\" rmdir \"host dir\""; List&lt;Integer&gt; positions = new LinkedList&lt;&gt;(); int position = command.indexOf("\"", 0); while (position != -1) { positions.add(position); position = command.indexOf("\"", position + 1); } System.out.println(positions); Pattern pattern = Pattern.compile("\""); Matcher matcher = pattern.matcher(command); positions = new LinkedList&lt;&gt;(); while (matcher.find()) { positions.add(matcher.start()); } System.out.println(positions); } prints [26, 35, 43, 52] [26, 35, 43, 52]
type: Answer
accepted answer of: http://stackoverflow.com/q/27414271
answers question: http://stackoverflow.com/q/27414271
score: 3
downvote count: 0
type: AcceptedAnswer
upvote count: 3

http://stackoverflow.com/a/27463942
has comment: http://stackoverflow.com/comment/43364593
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43364644
has body: You already created the Writer object all you need to do is to write to the file. If you have stored elements in some array or Arraylist then just do pw.println() in a loop. In order to accept user Input take a look on Scanner class E.g. import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; import java.util.Scanner; public class WriteToFile { public static void main(String[] args) throws IOException { PrintWriter pw = new PrintWriter(new FileWriter("output.txt")); Scanner scanner = new Scanner(System.in); System.out.println("enter n to finish"); String text = ""; while (!text.equals("n")) { System.out.println("enter first name"); text = scanner.next(); pw.write(text + ","); System.out.println("enter last name"); text = scanner.next(); pw.write(text + ","); System.out.println("enter sex"); text = scanner.next(); pw.write(text); //add more fields //finally pw.println(); System.out.println("Continue?"); text = scanner.next(); } pw.close(); System.out.println("completed"); } }
has comment: http://stackoverflow.com/comment/43364199
type: Answer
answers question: http://stackoverflow.com/q/27463122
has comment: http://stackoverflow.com/comment/43364190
accepted answer of: http://stackoverflow.com/q/27463122
has comment: http://stackoverflow.com/comment/43364800

http://stackoverflow.com/comment/43335491
comment on: http://stackoverflow.com/q/27446057
has text: Please see this similar question - lots of good tips: http://stackoverflow.com/questions/15843594/how-can-i-use-weblogic-12-c-without-the-application-context-in-the-url
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/27451187
has comment: http://stackoverflow.com/comment/43341206
type: Question
score: 5
has comment: http://stackoverflow.com/comment/43340919
has answer: http://stackoverflow.com/a/27451426
has comment: http://stackoverflow.com/comment/43341423
tagged with: java-8
has comment: http://stackoverflow.com/comment/43340963
has comment: http://stackoverflow.com/comment/43340915
has comment: http://stackoverflow.com/comment/43342115
has body: There is a complex piece of code that does many complex mathematical operations. When it is built and tested by maven on jdk 1.7 it passes all the tests. When using jdk 1.8 it fails. Trying to find the spot where the calculations go wrong in a debugger seems almost hopeless. What are my options? Is there a tool that can scan for incompatibilities between jdk 1.7 and 1.8 in my code? Is my best option to run the code in two separate debuggers and see where the difference would be? EDIT: @Philipp Claßen That is the most likely cause so far. I was hoping there would be an automated way of checking for this. @dkatzel The code was not written by me, poorly commented and does scientific calculations that are "woodo" to me. @Mike Samuel I see no benefit of this approach over running two debuggers in parallel. Thank you all for helping. Seems that two debuggers is the best way to go. EDIT 2 The author of the original code was relying on hash map ordering. That was the problem.
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/27451516
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43342221
has comment: http://stackoverflow.com/comment/43342018
answer count: 4
has answer: http://stackoverflow.com/a/27452410
has comment: http://stackoverflow.com/comment/43341127
tagged with: java-7
downvote count: 0
has comment: http://stackoverflow.com/comment/43342316
tagged with: incompatibility
has title: Incompatibilities between java versions
has answer: http://stackoverflow.com/a/27451541
favorite count: 0

http://stackoverflow.com/comment/43384600
has text: i have found a solution for my problem, thanks anyway.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27460666
type: Comment

storage
tag name: storage
tags question: http://stackoverflow.com/q/27409322
tags question: http://stackoverflow.com/q/27447129
type: Tag
tags question: http://stackoverflow.com/q/27400046

http://stackoverflow.com/comment/43354051
score: 0
type: Comment
has text: I'd use a static initializer for that.
comment on: http://stackoverflow.com/a/27458153
type: AnswerComment

http://stackoverflow.com/comment/43164008
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27355540
has text: If I understand right you are trying to create a program like notepad++ that displays and formats the code??

http://stackoverflow.com/comment/43161572
has text: Try annotating the *createRelationshipBetweenPersons* method with *@Transactional*.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27334225

http://stackoverflow.com/a/33170314
has body: The way I have always solved this for JSliders is via a private boolean flag. Directly before I set the JSlider value programmatically, I set the flag to true. At the beginning of the JSlider event code, I immediately return in case the flag is true. Setting the flag to false is the tricky part, because if you do that immediately after setting the JSlider value programmatically, the change event won't even have executed yet, so when it actually executes, the flag will be false and nothing will have been gained. Excerpt from the JavaDocs of SwingUtilities.invokeLater(): "If invokeLater is called from the event dispatching thread [...] will still be deferred until all pending events have been processed." Since you're already in the AWT EDT, and the goal is to let the JSlider react to the change (and immediately return) and then to set the flag to false, the solution is brilliantly simple and has never failed me: ignoreEvents = true; jSlider.setValue(newValue); SwingUtilities.invokeLater(() -&gt; ignoreEvents = false); EDIT: If the situation is really simple (You want to ignore just one event.), you could do this: Like above, set the boolean flag before calling setValue. In the JSlider event code, if the flag is set, clear the flag and return. No SwingUtilities.invokeLater() needed here.
type: Answer
score: 0
accepted answer of: http://stackoverflow.com/q/27425820
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/54158263
answers question: http://stackoverflow.com/q/27425820
has comment: http://stackoverflow.com/comment/54193920

http://stackoverflow.com/q/27373031
tagged with: java-6
favorite count: 0
has answer: http://stackoverflow.com/a/27375462
has body: Can someone please help and explain to me how to convert the following Java 1.8 code to Java 1.6? private java.util.Optional&lt;Edge&lt;T&gt;&gt; findEdge(Node&lt;T&gt; node) { return edges.stream() .filter(edge -&gt; edge.isBetween(this, node)) .findFirst(); } public boolean removeEdge(Node&lt;T&gt; node) { *java.util.Optional&lt;Edge&lt;T&gt;&gt; optional = findEdge(node);* if (optional.isPresent()) { return edges.remove(optional.get()); } return false; } public boolean hasEdge(Node&lt;T&gt; node) { return findEdge(node).*isPresent();* }
tagged with: lambda
tagged with: java-8
has title: Convert Java 8 code with lambda expressions to Java 6
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: java
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/27884518
has answer: http://stackoverflow.com/a/27373075
accepted answer: http://stackoverflow.com/a/27373075
possible better answer: http://stackoverflow.com/a/27375462
answer count: 3

http://stackoverflow.com/a/27348072
has body: Check what you imported android.support.v4.content.Loader, not the some other thing.
type: Answer
answers question: http://stackoverflow.com/q/27347706
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/27347706
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43229800
has text: when you say export, does it mean that you are using a plugin to write a CSV or other kind of file? If so what's the plugin? Can you share the piece of code that renders the output so I can help you with this issue
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27343899
type: Comment

http://stackoverflow.com/comment/43229183
has text: See https://code.google.com/p/android/issues/detail?id=78842
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27390576

http://stackoverflow.com/comment/43172137
type: Comment
type: QuestionComment
has text: checkID(acctNum, pwd,validAccounts);//it is showing an error there as well but thats probbaly because there is an null point exception in the checkID method
score: 0
comment on: http://stackoverflow.com/q/27359953

http://stackoverflow.com/q/27462420
has answer: http://stackoverflow.com/a/27462507
type: Question
has body: Let's suppose I have 2 classes Vehicle and Car public class Vehicle { public List&lt;? extends Vehicle&gt; getList() { return new ArrayList&lt;Vehicle&gt;(); } } @Override public class Car extends Vehicle { public List&lt;? extends Vehicle&gt; getList() { return new ArrayList&lt;Car&gt;(); } } If I want to get a list from a class that derives Vehicle is there a way I can use getList() without having to cast? This doesn't work(and I understand why: List&lt;Car&gt; list = new Car().getList(); And this does: List&lt;Car&gt; list = (List&lt;Car&gt;)new Car().getList(); Is there a way to prevent this?
tagged with: oop
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27462492
has title: How to implement a method from a derived class that does not require cast
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/27462507
accepted answer: http://stackoverflow.com/a/27462492
tagged with: design-patterns

http://stackoverflow.com/comment/43115372
comment on: http://stackoverflow.com/q/27328247
score: 0
type: Comment
type: QuestionComment
has text: I have already told you the method in my comment -- it's called `setText(...)`.

http://stackoverflow.com/q/27336523
tagged with: for-loop
upvote count: 0
answer count: 1
tagged with: arrays
has answer: http://stackoverflow.com/a/27336633
favorite count: 0
has comment: http://stackoverflow.com/comment/43129799
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27336633
downvote count: 1
tagged with: each
has body: //is there any way to do this public Entry[] getArray(SimpleHashtable table) { Entry[] data; for (Entry k: table) { //do something here } return data; //array that contains all elements stored in table } Is there a way to create and fill array with elements in for each loop? Explained in short: I have made class SimpleHashtable that stores objects, it implements Iterable. Now I have to code method that returns an array of elements that are stored in that SimpleHashtable, and first idea that came to mind is to iterate over SimpleHashtable and fill array one element at the time, but I cant find any example of that. If would like to avoid putting elements in a list in the meantime until I have iterated over SimpleHashtable (seems messy). I know that arrays in Java aren't resizable, and that seems to make things difficult.
type: Question
has title: Creating and filling an array in for each loop
tagged with: java
score: -1

http://stackoverflow.com/q/27462127
has title: consistent display of panel body bootstrap
has body: I am trying to list all the files on my device on the browser , I've managed to give each file a proper html5 tag for example path = "/Files/f/extensions/folder.png"; if (f.listFiles() != null)// cant access some files (security issues // like d:/reposotories).. tag = " " + " " + " " + "@name@ " + " " + " " + " " + " " + " " + " " + f.listFiles().length + " Files " + " last modified : @lastModified@ " + " " + " " + " " + " "; I use to display directories. and (extension.equalsIgnoreCase("gif") || extension.equalsIgnoreCase("jpg") || extension.equalsIgnoreCase("jpeg") || extension.equalsIgnoreCase("png")) { tag = " " + " " + " " + "@name@ " + " " + " " + " " + " " + " " + " size : @fileSize@ " + " last modified : @lastModified@ " + " " + " " + " " + " "; to display images where all @xxx@ is a placeholder that will be replaced as needed, however there is a problem that the body of the panel takes different dimensions and that's ruining the display of the page , and since the second panel adjusted itself automatically to match the image that column in the second row couldn't be used
tagged with: twitter-bootstrap
has comment: http://stackoverflow.com/comment/43360984
tagged with: css
has comment: http://stackoverflow.com/comment/43360630
accepted answer: http://stackoverflow.com/a/27462679
type: AnsweredQuestion
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/27462622
has answer: http://stackoverflow.com/a/27462622
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27462679
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/q/27344160
upvote count: 5
tagged with: java
has comment: http://stackoverflow.com/comment/43143860
tagged with: gradle
answer count: 2
score: 5
has answer: http://stackoverflow.com/a/33385100
downvote count: 0
has answer: http://stackoverflow.com/a/31628981
favorite count: 0
has body: I have a custom android.jar which overrides the default android classes and needs to be build before the default android.jar .In eclipse I can set the order in the tab of 'Order and Export'。But now I'm using gradle in android studio,what should i do? Any ideas? Any clarification needed? Thanks in advance!
tagged with: android
has comment: http://stackoverflow.com/comment/43255238
tagged with: android-gradle-plugin
has comment: http://stackoverflow.com/comment/47052241
type: UnansweredQuestion
type: Question
has title: How to set the library build order in gradle?
tagged with: build

http://stackoverflow.com/comment/43185449
comment on: http://stackoverflow.com/a/27365638
type: Comment
has text: okay this works by I though I need to somehow reference to the super class with the variables which are not in it. Thank you.
score: 0
type: AnswerComment

http://stackoverflow.com/a/61141458
has body: you have 3 options, I am using jsonschema2pojo : 1.0.0-alpha2 "extends": { "$ref": "MyObject.json" } or "extends": { "type": "object", "javaType": "com.mycompany.model.MyObject" } or "extendsJavaClass" : "com.mycompany.model.MyObject"
downvote count: 2
has comment: http://stackoverflow.com/comment/108184531
score: -2
answers question: http://stackoverflow.com/q/27410216
upvote count: 0
type: Answer

http://stackoverflow.com/a/27319845
has comment: http://stackoverflow.com/comment/43100012
downvote count: 0
has comment: http://stackoverflow.com/comment/43207006
has comment: http://stackoverflow.com/comment/43099421
has comment: http://stackoverflow.com/comment/43099718
has comment: http://stackoverflow.com/comment/43099785
type: Answer
score: 1
upvote count: 1
has body: Your constructor is not accessible due to compilation errors, basically because you defined your variables adding the modifier: final plus the static keyword, When you do that, you need to specify a default value, else you will get a compilation error. In your constructor you're assigning a value to your final variables, which is not allowed in the way you're declaring your variables before the constructor, every variable defined as final should have that value, that's the way you define constants for your code. I will recommend you to check both concepts for final and static modifiers: static final If you're trying to create a simple class to create instances of it and use their properties, you should just remove static and final modifiers, like: public class Tree { private int height; private String name; public Tree() { height = 5; name = "Basic Tree"; } public Tree(int a, String n) { height = a; name = n; } public int getHeight() { return height; } public String getName() { return name; } } Also, try to follow code conventions for defining variables, if the variables are constants, for sure you can write them in UPPERCASE, if not, you should write it with lower camel case: lowerCamelCase; for instance: double baseSalary. Then you can define constants for your class, something like: private static final int MAX_TREE_HEIGHT = 100;
answers question: http://stackoverflow.com/q/27319680

http://stackoverflow.com/q/27430092
has comment: http://stackoverflow.com/comment/43301369
score: 86
has comment: http://stackoverflow.com/comment/43310398
has comment: http://stackoverflow.com/comment/43301760
has title: What is a possible use case of BigInteger's .isProbablePrime()?
upvote count: 89
answer count: 6
has comment: http://stackoverflow.com/comment/43301476
has answer: http://stackoverflow.com/a/27430187
accepted answer: http://stackoverflow.com/a/27430187
has answer: http://stackoverflow.com/a/27445642
downvote count: 3
has comment: http://stackoverflow.com/comment/43301407
possible better answer: http://stackoverflow.com/a/27432885
has answer: http://stackoverflow.com/a/27432885
favorite count: 0
has comment: http://stackoverflow.com/comment/43301735
has answer: http://stackoverflow.com/a/27430172
has body: The method BigInteger.isProbablePrime() is quite strange; from the documentation, this will tell whether a number is prime with a probability of 1 - 1 / 2^arg, where arg is the integer argument. It has been present in the JDK for quite a long time, so it means it must have uses. My limited knowledge in computer science and algorithms (and maths) tells me that it does not really make sense to know whether a number is "probably" a prime but not exactly a prime. So, what is a possible scenario where one would want to use this method? Cryptography?
linked to: http://stackoverflow.com/q/23144236
has comment: http://stackoverflow.com/comment/43301528
has comment: http://stackoverflow.com/comment/43301604
has comment: http://stackoverflow.com/comment/43301386
tagged with: primes
has answer: http://stackoverflow.com/a/27430283
has answer: http://stackoverflow.com/a/27449187
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43301392
has comment: http://stackoverflow.com/comment/43308697
tagged with: java
has comment: http://stackoverflow.com/comment/43301463
has comment: http://stackoverflow.com/comment/43301342
type: Question

http://stackoverflow.com/q/27459135
tagged with: android
has answer: http://stackoverflow.com/a/27464803
tagged with: c++
has body: Are there any libraries or methods that would make sharing code between C++/Java and IOS/Android easier? I realize we have JNI and IOS can use C++ pretty much directly, but it seems like it could be easier. Microsoft Universal Windows Apps and Chrome Apps are (sort of) doing this. Open Source is preferable.
score: 0
tagged with: java
upvote count: 1
downvote count: 1
has title: Code sharing on IOS and Android mobile apps using C++ or Java
type: Question
tagged with: ios
has answer: http://stackoverflow.com/a/27459713
answer count: 2
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/43355622
comment on: http://stackoverflow.com/q/27459479
type: Comment
type: QuestionComment
has text: If you want to see errors, I suggest you read the error stream. Or you can combine the two streams into one to make it easier to read.
score: 0

http://stackoverflow.com/comment/43392174
type: AnswerComment
has text: What about running the Application: ApplicationContext ctx = SpringApplication.run(App.class, args) ?
comment on: http://stackoverflow.com/a/27445498
type: Comment
score: 1

http://stackoverflow.com/q/27392736
has title: A* Pathfinding Algorithm -- finding a path, but not optimal best path
has comment: http://stackoverflow.com/comment/43233213
has comment: http://stackoverflow.com/comment/43233506
answer count: 1
type: UnansweredQuestion
tagged with: a-star
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27393235
has body: I'm working on an A* algorithm. This is the code for the pathfinding method. For reference, this is the board I am working with: https://i.sstatic.net/ORBqb.png Each color tile represents a different heuristic value. For some unknown reason, it finds a path every single time, just not always the correct path. Here is the code for the pathfinding method. If anyone needs any clarifications, I'd be happy to provide them. public List&lt;Point&gt; findPath(Point start, Point end) { //declarations and instantiations List&lt;PathState&gt; closedList = new ArrayList&lt;PathState&gt;(); //the nodes already considered List&lt;PathState&gt; openList = new ArrayList&lt;PathState&gt;(); //nodes to be considered openList.add(new PathState(start, end, tm)); //add starting point PathState current = openList.get(0); while(!current.isGoal()){ //sort open list to find the pathstate with the best hscore(sorts by hscore) Collections.sort(openList); current = openList.get(openList.size() - 1); closedList.add(current); openList.remove(current); //get the valid children of current node List&lt;PathState&gt; children = current.getChildren();; if(!current.isGoal()){ for(int i = 0; i &lt; children.size(); i++){ if(!closedList.contains(children.get(i))){ if(openList.contains(children.get(i))){ if(openList.get(openList.indexOf(children.get(i))).getgScore() &gt; children.get(i).getgScore()){ //child is already on the open list, but this node has lower g value //change g value and parent of node on open list openList.get(openList.indexOf(children.get(i))).setG(children.get(i).getgScore()); openList.get(openList.indexOf(children.get(i))).changeParent(current); } }else{ //child not in closed list openList.add(children.get(i)); //repaint the terrain panel with shades tp.addAstarState(children.get(i)); tp.repaint(); try { Thread.sleep(25); } catch(Exception e) { e.printStackTrace(); } } } } } } //returns the path from winning node to start for output return current.getPath(); }
type: Question
tagged with: path-finding

http://stackoverflow.com/comment/43149513
type: QuestionComment
comment on: http://stackoverflow.com/q/27347365
score: 0
has text: Try to do a "clean build" and then a rebuild. Something went wrong with referencing to the R file
type: Comment

http://stackoverflow.com/q/27389152
has comment: http://stackoverflow.com/comment/43241082
accepted answer: http://stackoverflow.com/a/27400126
type: Question
has comment: http://stackoverflow.com/comment/43243097
answer count: 1
has comment: http://stackoverflow.com/comment/43239693
has comment: http://stackoverflow.com/comment/43240233
has title: How does HP Vugen locate the JRE used to record scripts?
score: 0
tagged with: settings
has body: Recording a Vugen script using Java over HTTP requires a JRE. How does HP Vugen locate this JRE used? On a Windows 7, I've installed a fresh copy of JRE (without JDK), removed the PATH system variable, deleted all the registry entries under HKEY_CURRENT_USER\SOFTWARE\JavaSoft, and restarted HP Vugen. However, HP Vugen is still able to locate the installed JRE. I'm using HP Vugen 12.01.
has comment: http://stackoverflow.com/comment/43241495
has answer: http://stackoverflow.com/a/27400126
tagged with: loadrunner
tagged with: vugen
tagged with: environment
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/27406555
has comment: http://stackoverflow.com/comment/43293736
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/75224396
answers question: http://stackoverflow.com/q/27403540
has body: The error you are getting is because @EnableBatchProcessing registers a StepScope and so does Spring Batch Admin. As I mentioned in the post you referenced, I would not recommend using @EnableBatchProcessing with Spring Batch Admin and instead, just configure the beans you need (only the job factory and step factory).
has comment: http://stackoverflow.com/comment/43318059
upvote count: 1
has comment: http://stackoverflow.com/comment/46922903
has comment: http://stackoverflow.com/comment/46921735
type: Answer

http://stackoverflow.com/comment/43360588
score: 0
has text: well 404 was happening due to missing Component Scan in MVC Context. < 2.2.1 Spring data rest Release, this however worked from Component Scan from Application Context
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27376026

http://stackoverflow.com/q/27454412
has body: I am facing the problem in Drive. I am unable to import it. The error I am getting is that DriveScopes cannot be resolved to a variable. private ProgressBar progressBar; private Context context; private static Uri callLogFileUri; private static Uri smsLogFileUri; private static Drive service; private boolean callLogs; private boolean smsLogs; private String address; private ContentResolver cr; private GoogleAccountCredential credential; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.backup_layout); progressBar = (ProgressBar) findViewById(R.id.progressBar); progressBar.setVisibility(View.VISIBLE); context = this; Intent intent; cr = getContentResolver(); credential = GoogleAccountCredential.usingOAuth2(this,DriveScopes.DRIVE); try { intent = getIntent(); if (intent.hasExtra("fromReceiver")) { address = intent.getStringExtra("fromReceiver"); Log.i(TAG, "Backup intent from receiver"); recoverData(); } else { Log.i(TAG, "Backup intent from elsewhere"); DialogFragment dialog = new BackupAccountsDialogFragment(); dialog.show(getFragmentManager(), "BackupAccountsDialogFragment"); } } catch(Exception e) { recoverData(); } } @Override protected void onActivityResult(final int requestCode, final int resultCode, final Intent data) { switch (requestCode) { case REQUEST_ACCOUNT_PICKER: if (resultCode == RESULT_OK &amp;&amp; data != null &amp;&amp; data.getExtras() != null) { final String accountName = data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME); if (accountName != null) { Log.i(TAG, "REQUEST ACCOUNT PICKER"); credential.setSelectedAccountName(accountName); service = getDriveService(credential); storeGoogleAccounts(accountName); Log.i(TAG, "Account saved: " + CHOSEN_GOOGLE_ACCOUNT + " " + accountName); getFirstAuthInAsync(); }
has title: Unable to import Drive
tagged with: android
score: 1
favorite count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: java
type: Question
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43352184
has answer: http://stackoverflow.com/a/27454443

http://stackoverflow.com/q/27321945
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43104765
has title: Remove mark selection values Netbeans
tagged with: java
has comment: http://stackoverflow.com/comment/43105181
type: Question
has comment: http://stackoverflow.com/comment/43103414
has body: i'm trying to remove the mark selection, but I don't find the way to do that... I give you the link of the image below. Theme --> Shady-Manokai Netbeans version --> 8.0.2
score: 0
tagged with: netbeans
has comment: http://stackoverflow.com/comment/43103830

http://stackoverflow.com/a/27322007
has comment: http://stackoverflow.com/comment/43106989
upvote count: 1
has comment: http://stackoverflow.com/comment/43105855
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43105654
has body: int fare = 0; int distance = 0; if (distance &gt; 21) { fare += (distance - 21) * 25; distance = 21; } if (distance &gt; 11) { fare += (distance - 11) * 35; distance = 11; } if (distance &gt; 1) { fare += (distance - 1) * 45; distance = 1; } if (distance &gt; 0) { fare += distance * 50; } Then refactor by putting the magic numbers into arrays and loop through the arrays (4 times).
has comment: http://stackoverflow.com/comment/43104840
has comment: http://stackoverflow.com/comment/43105449
has comment: http://stackoverflow.com/comment/43105534
type: Answer
accepted answer of: http://stackoverflow.com/q/27321756
has comment: http://stackoverflow.com/comment/43105807
answers question: http://stackoverflow.com/q/27321756
downvote count: 0
score: 1

http://stackoverflow.com/comment/43151486
type: QuestionComment
has text: its from AP Com Sci. That's why I cant use any other method
comment on: http://stackoverflow.com/q/27348378
score: 0
type: Comment

http://stackoverflow.com/q/27418068
type: Question
has answer: http://stackoverflow.com/a/58560182
tagged with: jvm-codecache
has answer: http://stackoverflow.com/a/27418971
tagged with: jstat
answer count: 2
tagged with: windows
downvote count: 0
has body: I want to find the non-heap memory code cache details of a remote JVM (JDK 8) running on windows from my windows machine. I can get the details using jconsole. But, what i need is to get the values using jstat command. GUI monitoring tools doesn't serves my purpose. Thanks
favorite count: 0
type: UnansweredQuestion
has title: How to get non-heap "code cache" details using jstat
tagged with: java-8
score: 3
upvote count: 3
tagged with: java

http://stackoverflow.com/q/27379810
tagged with: java
tagged with: hibernate
upvote count: 1
has answer: http://stackoverflow.com/a/27395756
type: Question
tagged with: metamodel
accepted answer: http://stackoverflow.com/a/27395756
has title: org.bsc.maven.maven-processor-plugin doesn't work for java 1.7 and above
answer count: 1
tagged with: jpa
downvote count: 0
favorite count: 0
tagged with: code-generation
has body: I have a GitHub repository where I host some Hibernate examples and to generate the JPA MetaModel classes I've been using the following Maven plugin: org.bsc.maven maven-processor-plugin 2.0.5 process process generate-sources target/generated-sources/java/ org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor With Java 1.6 everything runs just fine, but when I switch to Java 1.7 I get the following error: [INFO] javac option: D:\wrk\vladmihalcea\vladmihalcea.wordpress.com\hibernate-facts\target\generated-sources\java [INFO] diagnostic Note: Hibernate JPA 2 Static-Metamodel Generator 1.0.0.Final [INFO] diagnostic warning: Supported source version 'RELEASE_6' from annotation processor 'org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor' less than -source '1.7' [INFO] diagnostic warning: File for type 'com.vladmihalcea.hibernate.model.store.Version_' created in the last round will not be subject to annotation processing. [INFO] diagnostic warning: File for type 'com.vladmihalcea.hibernate.model.baglist.BagTree_' created in the last round will not be subject to annotation processing. [INFO] diagnostic warning: File for type 'com.vladmihalcea.hibernate.model.store.Product_' created in the last round will not be subject to annotation processing. [INFO] diagnostic warning: File for type 'com.vladmihalcea.hibernate.model.store.Importer_' created in the last round will not be subject to annotation processing. [INFO] diagnostic warning: File for type 'com.vladmihalcea.hibernate.model.linkedset.LinkedParent_' created in the last round will not be subject to annotation processing. [INFO] diagnostic warning: File for type 'com.vladmihalcea.hibernate.model.fetch.FetchChild_' created in the last round will not be subject to annotation processing. [INFO] diagnostic warning: File for type 'com.vladmihalcea.hibernate.model.store.Company_' created in the last round will not be subject to annotation processing. [INFO] diagnostic warning: File for type 'com.vladmihalcea.hibernate.mod…
type: AnsweredQuestion
score: 1

http://stackoverflow.com/a/27392770
type: Answer
has body: I have fixed it myself.It's a bug of JCIFS and i have reported to Jcifs team.
has comment: http://stackoverflow.com/comment/112812429
score: -1
downvote count: 2
has comment: http://stackoverflow.com/comment/61456854
upvote count: 1
answers question: http://stackoverflow.com/q/27372860

http://stackoverflow.com/comment/43328192
type: QuestionComment
has text: If your program is exiting the memory will be released anyway, so garbage collection would be a waste of time and effort.
comment on: http://stackoverflow.com/q/27444496
score: 0
type: Comment

http://stackoverflow.com/a/59136837
upvote count: 2
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27323639
has body: this worked for me try (Reader in = new FileReader(f); CSVParser parser = new CSVParser(in, CSVFormat.EXCEL.withDelimiter(';').withHeader("Assembly Item Number", "Material Type", "Item Name", "Drawing Num", "Document Type", "Revision", "Status", "Drawing name", "BOM Material Type", "Component Name"));) { for (CSVRecord record : parser) { System.out.println(record.get("Item Name")); } } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); }
type: Answer

http://stackoverflow.com/comment/43217715
score: 1
has text: If you had multiple namespace schemas defined, you'd need to be able to tell the validator where each namespace's schema is. That's done by pairing the namespace with its location in the schemaLocation.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27384310

http://stackoverflow.com/comment/43177533
type: Comment
has text: Yes I have looked at those tutorials, but still cannot understand. Any suggestions how I should proceed with this class?
type: QuestionComment
comment on: http://stackoverflow.com/q/27360970
score: 0

http://stackoverflow.com/comment/43130497
has text: Updating the model could trigger and update to the row sorter, which is not...and yes, I've done this and it doesn't end well...this not an assumption that can or should make ;)
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27334656
type: Comment

http://stackoverflow.com/q/27337222
upvote count: 6
has comment: http://stackoverflow.com/comment/43139041
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27337462
accepted answer: http://stackoverflow.com/a/27337462
has body: interface Problematic { void method(); } class Parent { void method(int arg) { } } class Child extends Parent { void test() { new Problematic() { @Override public void method() { // javac error: method method in class &lt;anonymous Problematic&gt; cannot be applied to given types; // required: no arguments, found: int method(0); Child.this.method(0); // works just fine Child.super.method(0); // works just fine } }; } } IntelliJ IDEA also gives a warning: Method 'method()' recurses infinitely, and can only end by throwing an exception
has answer: http://stackoverflow.com/a/27337363
downvote count: 2
has answer: http://stackoverflow.com/a/27337473
type: Question
tagged with: overloading
has answer: http://stackoverflow.com/a/27337379
has comment: http://stackoverflow.com/comment/43131565
tagged with: java
score: 4
tagged with: visibility
possible better answer: http://stackoverflow.com/a/27337473
favorite count: 0
tagged with: javac
has title: Why is the super method not visible/resolved?

regex
tags question: http://stackoverflow.com/q/27357368
tags question: http://stackoverflow.com/q/27368264
tags question: http://stackoverflow.com/q/27320857
tags question: http://stackoverflow.com/q/27369555
tags question: http://stackoverflow.com/q/27446122
tags question: http://stackoverflow.com/q/27452920
tags question: http://stackoverflow.com/q/27315742
tags question: http://stackoverflow.com/q/27448556
tags question: http://stackoverflow.com/q/27328998
tags question: http://stackoverflow.com/q/27344418
tags question: http://stackoverflow.com/q/27418045
tags question: http://stackoverflow.com/q/27379046
tags question: http://stackoverflow.com/q/27440155
tag name: regex
tags question: http://stackoverflow.com/q/27360890
tags question: http://stackoverflow.com/q/27436842
tags question: http://stackoverflow.com/q/27439931
tags question: http://stackoverflow.com/q/27473497
tags question: http://stackoverflow.com/q/27431439
tags question: http://stackoverflow.com/q/27365008
tags question: http://stackoverflow.com/q/27435120
tags question: http://stackoverflow.com/q/27373989
tags question: http://stackoverflow.com/q/27399345
tags question: http://stackoverflow.com/q/27369273
tags question: http://stackoverflow.com/q/27372071
tags question: http://stackoverflow.com/q/27338159
tags question: http://stackoverflow.com/q/27397095
tags question: http://stackoverflow.com/q/27381169
tags question: http://stackoverflow.com/q/27458041
tags question: http://stackoverflow.com/q/27363840
tags question: http://stackoverflow.com/q/27323505
tags question: http://stackoverflow.com/q/27442174
tags question: http://stackoverflow.com/q/27415584
tags question: http://stackoverflow.com/q/27432248
tags question: http://stackoverflow.com/q/27315328
tags question: http://stackoverflow.com/q/27443222
tags question: http://stackoverflow.com/q/27427414
tags question: http://stackoverflow.com/q/27432862
tags question: http://stackoverflow.com/q/27356677
tags question: http://stackoverflow.com/q/27330681
tags question: http://stackoverflow.com/q/27425709
tags question: http://stackoverflow.com/q/27401437
tags question: http://stackoverflow.com/q/27348213
tags question: http://stackoverflow.com/q/27387166
tags question: http://stackoverflow.com/q/27444044
tags question: http://stackoverflow.com/q/27365295
tags question: http://stackoverflow.com/q/27372842
tags question: http://stackoverflow.com/q/27318261
tags question: http://stackoverflow.com/q/27414939
tags question: http://stackoverflow.com/q/27384829
tags question: http://stackoverflow.com/q/27444398
tags question: http://stackoverflow.com/q/27373180
tags question: http://stackoverflow.com/q/27373838
tags question: http://stackoverflow.com/q/27390992
tags question: http://stackoverflow.com/q/27381333
tags question: http://stackoverflow.com/q/27432674
tags question: http://stackoverflow.com/q/27468627
tags question: http://stackoverflow.com/q/27449466
tags question: http://stackoverflow.com/q/27376129
tags question: http://stackoverflow.com/q/27463147
tags question: http://stackoverflow.com/q/27372262
tags question: http://stackoverflow.com/q/27373324
tags question: http://stackoverflow.com/q/27449454
tags question: http://stackoverflow.com/q/27394475
tags question: http://stackoverflow.com/q/27397883
tags question: http://stackoverflow.com/q/27364518
tags question: http://stackoverflow.com/q/27329519
tags question: http://stackoverflow.com/q/27433285
tags question: http://stackoverflow.com/q/27406173
tags question: http://stackoverflow.com/q/27459138
type: Tag
tags question: http://stackoverflow.com/q/27346080

http://stackoverflow.com/a/33410621
has body: I actually found a straight-forward solution: FluentIterable.from(values).transform(keyFunction).toSet();
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27424311
type: Answer
answers question: http://stackoverflow.com/q/27424311

http://stackoverflow.com/q/27461640
score: 1
favorite count: 0
tagged with: io
has answer: http://stackoverflow.com/a/27461659
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27461659
has title: Buffered reader not accessable by other methods
upvote count: 1
type: Question
tagged with: java
answer count: 2
possible better answer: http://stackoverflow.com/a/27461716
has body: Sorry if this is obvious, I am inexperienced with Java. I have 2 methods, one that creates a BufferedReader, and one that processes it. However, the processing method can not access the BufferedReader, even though it is in a public method. Am I doing something wrong? package textfiles; import java.io.IOException; import java.io.FileReader; import java.io.BufferedReader; public class ReadFile { private String path; public ReadFile(String filePath) { path = filePath; } public void Open() throws IOException { FileReader read = new FileReader(path); BufferedReader buff = new BufferedReader(read); } public String[] OpenFile() throws IOException { int numberOfLines = readLines(); String[] textData = new String[numberOfLines]; int i; for (i=0; i &lt; numberOfLines; i++) { textData[i] = buff.readLine(); } buff.close(); return textData; } int readLines() throws IOException { FileReader linedFile = new FileReader(path); BufferedReader findLines = new BufferedReader(linedFile); String lines; int noLines = 0; while ((lines = findLines.readLine()) != null) { noLines++; } findLines.close(); return noLines; } }
downvote count: 0
has answer: http://stackoverflow.com/a/27461716
tagged with: bufferedreader

http://stackoverflow.com/q/27470798
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/27476695
has body: I hava a problem upload more than 500 bytes to app engine. The system throws: java.lang.IllegalArgumentException: video: byte[] properties must be 500 bytes or less. Instead, use com.google.appengine.api.datastore.Blob, which can store binary data of any size. at com.google.appengine.api.datastore.DataTypeUtils.checkSupportedSingleValue(DataTypeUtils.java:259) at com.google.appengine.api.datastore.DataTypeUtils.checkSupportedValue(DataTypeUtils.java:208) at com.google.appengine.api.datastore.DataTypeUtils.checkSupportedValue(DataTypeUtils.java:174) at com.google.appengine.api.datastore.DataTypeUtils.checkSupportedValue(DataTypeUtils.java:149) at com.google.appengine.api.datastore.PropertyContainer.setProperty(PropertyContainer.java:101) at com.google.appengine.datanucleus.EntityUtils.setEntityProperty(EntityUtils.java:174) at com.google.appengine.datanucleus.StoreFieldManager.storeFieldInEntity(StoreFieldManager.java:360) at com.google.appengine.datanucleus.StoreFieldManager.storeObjectField(StoreFieldManager.java:190) at org.datanucleus.state.AbstractStateManager.providedObjectField(AbstractStateManager.java:1447) at com.rmi.videoservice.PersistentVideo.jdoProvideField(PersistentVideo.java) at com.rmi.videoservice.PersistentVideo.jdoProvideFields(PersistentVideo.java) at org.datanucleus.state.AbstractStateManager.provideFields(AbstractStateManager.java:1515) at com.google.appengine.datanucleus.DatastorePersistenceHandler.insertObjectsInternal(DatastorePersistenceHandler.java:241) at com.google.appengine.datanucleus.DatastorePersistenceHandler.insertObject(DatastorePersistenceHandler.java:218) at org.datanucleus.state.JDOStateManager.internalMakePersistent(JDOStateManager.java:2381) at org.datanucleus.state.JDOStateManager.makePersistent(JDOStateManager.java:2357) at org.datanucleus.ObjectManagerImpl.persistObjectInternal(ObjectManagerImpl.java:1896) at org.datanucleus.ObjectManagerImpl.persistObjectWork(ObjectManagerImpl.java:1745) at org.datanucleus.ObjectManagerI…
tagged with: google-app-engine
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43376458
tagged with: java
has answer: http://stackoverflow.com/a/27476695
tagged with: servlets
type: Question
has title: exception upload more than 500 bytes to app engine

http://stackoverflow.com/a/27329545
upvote count: 2
answers question: http://stackoverflow.com/q/27329474
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27329474
type: Answer
downvote count: 0
score: 2
has body: Invoking CursorAdapter.getItem(position) returns the cursor that contains the data moved to the correct position. Because it returns a Cursor, you cannot cast it to an Album. Instead, you need to query the cursor like what you did in AlbumAdapter.bindView()

http://stackoverflow.com/comment/43308033
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27432859
has text: What is the actual question? What do you mean when you say 'name'?
score: 0

http://stackoverflow.com/q/27318172
upvote count: 1
has comment: http://stackoverflow.com/comment/43103289
favorite count: 0
type: UnansweredQuestion
has body: I have following code where I am trying to move the file to a different location once the file rotation is complete. The MOVEFILEACTION is not happening (no errors either). Not sure if I am missing something here. SyncPolicy syncPolicy = new CountSyncPolicy(100); // Rotate data files when they reach five MB FileRotationPolicy rotationPolicy = new FileSizeRotationPolicy(0.05f, Units.MB); MoveFileAction moveFileAction = new MoveFileAction().toDestination(rootPath + "/test"); FileNameFormat fileNameFormat = new DefaultFileNameFormat() .withPath(rootPath + "/staging") .withPrefix(prefix); // Instantiate the HdfsBolt HdfsBolt hdfsBolt = new HdfsBolt() .withFsUrl(fsUrl) .withFileNameFormat(fileNameFormat) .withRecordFormat(format) .withRotationPolicy(rotationPolicy) .withSyncPolicy(syncPolicy) .addRotationAction(moveFileAction);
answer count: 0
downvote count: 0
score: 1
tagged with: java
has title: Apache STORM - Moving file to a different location using hdfsbolt is not working
tagged with: apache-storm
type: Question
tagged with: hdfs

http://stackoverflow.com/q/27465040
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27465128
tagged with: jdo
has body: I have a problem when I try to encode object in http response. I do not know how to do it. I will have use the header? public class Download extends HttpServlet{ public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException{ PersistenceManager pm = PMF.get().getPersistenceManager(); String method = req.getParameter("method"); if(method.equals("view")){ Query query = pm.newQuery(Article.class); List&lt;Article&gt; articles=null; try { articles=(List&lt;Article&gt;) query.execute(); } finally { query.closeAll(); } Article article= art.get(0); res.setContentType("application/octet-stream");//?? //problem here } } }
type: Question
tagged with: java
has title: How parse object in HttpServletResponse?
tagged with: servlets
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27465128
tagged with: google-app-engine

http://stackoverflow.com/a/27458920
has comment: http://stackoverflow.com/comment/43369384
has body: The standard approach (also used by JAXB when generating code from an XML schema) is @XmlRootElement(name="a") public class A { private List&lt;B&gt; bs; @XmlElement(name="b") public List&lt;B&gt; getBs(){ if( bs == null ){ bs = new ArrayList&lt;&gt;(); } return bs; } } No setter for bs!
type: Answer
answers question: http://stackoverflow.com/q/27454750
accepted answer of: http://stackoverflow.com/q/27454750
has comment: http://stackoverflow.com/comment/43363626
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/43316409
comment on: http://stackoverflow.com/q/27437743
score: 0
has text: @Maduri - do you using maven plugin?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27374956
tagged with: look-and-feel
tagged with: swing
tagged with: nimbus
has comment: http://stackoverflow.com/comment/43235492
has title: Customize JTextField border when focused - Nimbus
has comment: http://stackoverflow.com/comment/43223757
tagged with: java
has comment: http://stackoverflow.com/comment/43238696
tagged with: jtextfield
type: Question
has comment: http://stackoverflow.com/comment/43204884
has comment: http://stackoverflow.com/comment/43223687
score: 0
has body: My app is working with Nimbus LAF but my problem is that, because I am using JTextfield with height dimension of 17 the heavy border when focused, it is cutting half of the text. On the other hand I looked on the text field when using Metal LAF, it works perfect, the border not cover the text at all. Can I customize the text field to Metal behavior when using Nimbus? If so, how?
has comment: http://stackoverflow.com/comment/43200324
has comment: http://stackoverflow.com/comment/43230157
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/q/27320458
has title: java.lang.NumberFormatException Error shows when trying to run program
has body: This program is supposed to chop up and add together social security numbers. I thought I wrote all of the code correctly, but when I ran the code it outputted the java.lang.NumberFormatException error. I am using Eclipse and it doesn't show which line of the code has the error so I don't know what to fix. Here are the two classes of code I am working with: MAIN CLASS: import static java.lang.System.*; public class social { private String socialNum; private int sum; public social() { setWord(""); } public social(String soc) { setWord(soc); } public void setWord(String w) { socialNum = w; } public void chopAndAdd() { String sub1 = socialNum.substring(0, socialNum.indexOf("-")); String sub2 = socialNum.substring(socialNum.indexOf("-") + 1, socialNum.lastIndexOf("-")); String sub3 = socialNum.substring(socialNum.indexOf("-") + 1); int int1 = Integer.parseInt(sub1); int int2 = Integer.parseInt(sub2); int int3 = Integer.parseInt(sub3); sum = int1 + int2 + int3; } public String toString() { return "SS# " + socialNum + " has a total of " + sum + "\n"; } } RUNNER CLASS: import static java.lang.System.*; public class socialrunner { public static void main( String args[] ) { //add test cases social test = new social("456-56-234"); test.chopAndAdd(); System.out.println(test); test.setWord("1-1-1"); test.chopAndAdd(); System.out.println(test); test.setWord("182-2-12"); test.chopAndAdd(); System.out.println(test); test.setWord("0-0-0"); test.chopAndAdd(); System.out.println(test); } } Thanks for any help~!
has comment: http://stackoverflow.com/comment/43100390
has answer: http://stackoverflow.com/a/27320737
type: AnsweredQuestion
tagged with: java
score: 0
tagged with: error-handling
has comment: http://stackoverflow.com/comment/43100275
type: Question
has answer: http://stackoverflow.com/a/27320711
accepted answer: http://stackoverflow.com/a/27320737
has answer: http://stackoverflow.com/a/27320715
answer count: 3
possible better answer: http://stackoverflow.com/a/27320711

http://stackoverflow.com/comment/43272424
comment on: http://stackoverflow.com/q/27413940
type: Comment
type: QuestionComment
has text: Yes, but you'd need to change it so that it could not only store those lines, but could also provide some kind of access to them...
score: 0

http://stackoverflow.com/a/27325082
has body: got it working, like this public String CreateCalendar (String titel, String startDate, String endDate, String note, String location, String email) throws SQLException, ParseException { String stringToBeReturned =""; testConnection(); SimpleDateFormat format = new SimpleDateFormat ("yyyy-MM-dd"); format.parse(startDate); format.parse(endDate); String [] keys = {"title", "start", "end", "note", "location", "active", "email"}; String [] values = {titel, startDate, endDate, note, location, "1", email}; qb.insertInto("calendar", keys).values(values).Execute(); return stringToBeReturned; }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27324881

http://stackoverflow.com/q/27395634
linked to: http://stackoverflow.com/q/27377431
score: 0
has comment: http://stackoverflow.com/comment/43240938
has body: How I can copy my schema in db2 database into the oracle database with full table structure, columns, data and etc using Java. I write java code but it does not select all tables. I do not know how many tables are in db2 database and even do not know the name of the tables. I just wanna store all the information and make the same schema in oracle. public class automateExport { static String value; public static void main(String[] args) throws SQLException, ClassNotFoundException { // ResultSet rs = null; Connection DB2 = getConnection (); String sql = "SELECT * FROM SYSCAT.COLUMNS WHERE TABSCHEMA NOT LIKE 'SYS%'"; PreparedStatement mainStmt = DB2.prepareStatement(sql); ResultSet rs = mainStmt.executeQuery(); ResultSetMetaData rsmd = rs.getMetaData(); int columnCount = rsmd.getColumnCount(); String tableName = null; StringBuilder sb = new StringBuilder( 1024 ); if ( columnCount &gt; 0 ) { sb.append( "Create table " ).append( rsmd.getTableName( 1 ) ).append( " ( " ); } for ( int i = 1; i &lt;= columnCount; i ++ ) { if ( i &gt; 1 ) sb.append( ", " ); String columnName = rsmd.getColumnLabel( i ); String columnType = rsmd.getColumnTypeName( i ); sb.append( columnName ).append( " " ).append( columnType ); int precision = rsmd.getPrecision( i ); if ( precision != 0 ) { sb.append( "( " ).append( precision ).append( " )" ); } } // for columns sb.append( " ) " ); System.out.println( sb.toString() ); } private static Connection getConnection() throws ClassNotFoundException, SQLException { Class. forName ( "COM.ibm.db2os390.sqlj.jdbc.DB2SQLJDriver" ); Connection connection = DriverManager.getConnection("jdbc:db2://localhost:50000/navid","navid","oracle"); return connection; } }
type: UnansweredQuestion
tagged with: oracle-database
has comment: http://stackoverflow.com/comment/43240683
has comment: http://stackoverflow.com/comment/43241444
has comment: http://stackoverflow.com/comment/43239961
answer count: 0
tagged with: java
has title: How to create full copy of database schema (db2) in an other database(oracle) using Java?
has comment: http://stackoverflow.com/comment/43239735
has comment: http://stackoverflow.com/comment/43240234
has comment: http://stackoverflow.com/comment/43239372
type: Question
tagged with: db2

http://stackoverflow.com/comment/43248683
has text: when I try this my program crashes immediately :S
comment on: http://stackoverflow.com/a/27397660
type: Comment
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43338051
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27449637
has text: You explained it fine but i doesn't see the code that explain what have you did till now

http://stackoverflow.com/comment/43199346
comment on: http://stackoverflow.com/q/27372819
type: QuestionComment
has text: Ok, since it's a batch processing environment to be used for future clients, let's say the volume could be as high as 500M records per day and as low as 1000 records per month
score: 0
type: Comment

http://stackoverflow.com/q/27374778
tagged with: java
type: Question
upvote count: 2
has body: I use MailSSLSocketFactory class to send email via gmail to ignore certification. eclipse does not find this class, i added java mail 1.5 repo, i use java 1.7 how can i add this package into my maven project in eclipse ? i added this code MailSSLSocketFactory socketFactory = new MailSSLSocketFactory(); socketFactory.setTrustedHosts(new String[] { "my-server"}); socketFactory.setTrustAllHosts(true); eclipse does not find MailSSLSocketFactory class.
has title: How can i add MailSSLSocketFactory class into eclipse maven project
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
score: 2
has answer: http://stackoverflow.com/a/37565258

http://stackoverflow.com/q/27393508
favorite count: 0
type: UnansweredQuestion
has title: How many objects will get created for the code shown here?
has answer: http://stackoverflow.com/a/27393561
answer count: 4
score: 2
tagged with: java
downvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/43234277
has answer: http://stackoverflow.com/a/27393739
has comment: http://stackoverflow.com/comment/43234151
upvote count: 4
linked to: http://stackoverflow.com/q/3297867
has comment: http://stackoverflow.com/comment/43234599
has answer: http://stackoverflow.com/a/27393522
has answer: http://stackoverflow.com/a/27393675
has body: How many objects will get created for the piece of code shown below? String str1 = new String("nitesh"); String str2 = new String("nitesh"); String str3 = "nitesh"; String str4 = str3; String str5 = str2;
tagged with: string

http://stackoverflow.com/comment/43368353
comment on: http://stackoverflow.com/a/27466180
score: 0
has text: Yes, you can retrieve, modify and delete objects in `ArrayList`s. It's all in the documentation.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43234744
score: 0
type: Comment
has text: @MiiinimalLogic Even forgetting the learning part and thinking only in *SO's answer only and no additional noise* perspective, Haar will not help the OP for a cricket live video stream.
type: AnswerComment
comment on: http://stackoverflow.com/a/27371262

android-viewpager
tag name: android-viewpager
tags question: http://stackoverflow.com/q/27468986
tags question: http://stackoverflow.com/q/27362223
type: Tag
tags question: http://stackoverflow.com/q/27414798
tags question: http://stackoverflow.com/q/27371565

http://stackoverflow.com/comment/43381972
comment on: http://stackoverflow.com/a/27473599
has text: Yeah I was just thinking about all the above. I find it easier to keep immutable stuff casted as immutable wherever its called, just so its immutability is documented. With the List vs Collection thing, I have to think about that...
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43123753
score: 0
has text: If Project A's Five.java refers to Four.java, then that referral would end up being Project B's Four.java (my goal anyway). As if I had copies project A over entirely to Project B (with no dependency) and altered Four.java in Project B.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27332328

http://stackoverflow.com/comment/43565953
has text: Or [mojo-executor](https://github.com/TimMoore/mojo-executor) for that matter?
score: 0
comment on: http://stackoverflow.com/q/27463711
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43115015
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27328101
has text: http://stackoverflow.com/questions/5699427/what-does-it-mean-for-a-function-to-return-an-interface
type: Comment

http://stackoverflow.com/comment/43293314
type: Comment
has text: @joekutner's response should be the accepted answer.
score: 0
comment on: http://stackoverflow.com/q/27387999
type: QuestionComment

http://stackoverflow.com/comment/43160845
type: Comment
comment on: http://stackoverflow.com/a/27353754
type: AnswerComment
has text: thanks but what about how to call its different functions? lets say i want to call "dotask1" now and "dotask2" later
score: 0

http://stackoverflow.com/a/27338633
has comment: http://stackoverflow.com/comment/43133989
score: 5
type: Answer
has comment: http://stackoverflow.com/comment/43134428
has comment: http://stackoverflow.com/comment/43133950
upvote count: 5
downvote count: 0
answers question: http://stackoverflow.com/q/27338623
has body: From the java documentation: Variable names are case-sensitive. A variable's name can be any legal identifier — an unlimited-length sequence of Unicode letters and digits, beginning with a letter, the dollar sign "$", or the underscore character "". The convention, however, is to always begin your variable names with a letter, not "$" or "". Additionally, the dollar sign character, by convention, is never used at all. You may find some situations where auto-generated names will contain the dollar sign, but your variable names should always avoid using it. A similar convention exists for the underscore character; while it's technically legal to begin your variable's name with "_", this practice is discouraged. White space is not permitted. Subsequent characters may be letters, digits, dollar signs, or underscore characters. Conventions (and common sense) apply to this rule as well. When choosing a name for your variables, use full words instead of cryptic abbreviations. Doing so will make your code easier to read and understand. In many cases it will also make your code self-documenting; fields named cadence, speed, and gear, for example, are much more intuitive than abbreviated versions, such as s, c, and g. Also keep in mind that the name you choose must not be a keyword or reserved word. https://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html In short: yes, you're right. You can use underscores, dollarsigns, and characters to start a variable name. After the first letter of the variable name, you can also use numbers. Note that using dollar signs is generally not good practice. From your comment, you said that your teacher rejected "II". Under your question, II is perfectly fine (try it, it will run). However, if the question on your test asked which are "good" variable names, or which variable names follow common practice, then II would be eliminated as explained in the quotation above. One reason for this is that dollar signs do not make readabl…

http://stackoverflow.com/q/27380933
favorite count: 0
has title: How does reference by classname.this.method works?
has comment: http://stackoverflow.com/comment/43210912
has comment: http://stackoverflow.com/comment/43210817
upvote count: 2
has answer: http://stackoverflow.com/a/27380993
has answer: http://stackoverflow.com/a/27397920
answer count: 4
has answer: http://stackoverflow.com/a/27381144
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27380993
tagged with: java
has body: For example, I've got this code: public class NewProjectModalWindow extends Window { private void initComponents() { cancel = new Button("Cancel"); cancel.addClickListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { NewProjectModalWindow.this.close(); } }); } } How does this work in that case? I mean - how does it understand in the anonymous class that I want to call close method for exactly this instance of NewProjectModalWindow? How is it able to find in the bunch of objects in the memory exactly my object by using NewProjectModalWindow.this? How does this point out to the current instance?
has comment: http://stackoverflow.com/comment/43210775
possible better answer: http://stackoverflow.com/a/27381144
type: Question
has answer: http://stackoverflow.com/a/27381181
has comment: http://stackoverflow.com/comment/43210854
tagged with: this
downvote count: 0
has comment: http://stackoverflow.com/comment/43210958

http://stackoverflow.com/q/27431225
answer count: 1
has body: I need to use the commons-codec-1.9.jar from the commons-codec-1.9 library supplied by Apache. I've used this as a library in another project in NetBeans, so I already had the required .jar file that I needed to import. I copied the jar file from the NetBeans project and put it in my app project (app:libs folder) and right-clicked and chose the "Add as library..." option. I added it to my project dependencies as well via File > Project Structure > Dependencies. I created the import for the library in the classes I've written that use the library, and I get no errors and the code builds. However, when I run the app, it breaks and throws a NoSuchMethod exception... even though it is there. Here are the contents of my build.gradle apply plugin: 'com.android.application' android { compileSdkVersion 20 buildToolsVersion '20.0.0' defaultConfig { applicationId "com.example.&lt;path_stuff&gt;" minSdkVersion 17 targetSdkVersion 20 versionCode 1 versionName "1.0" } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile files('libs/commons-codec-1.9.jar') } Here is my settings.gradle include ':app' I have also recently been getting a build error after I removed the commons-codec stuff from the libs folder and tried to re-add it. The error says something along the lines of "Build failed: could not find task 'assemble' in project " as if Android Studio thinks this is another project. Can someone please help me understand what is going on here and where I am going wrong? No such method error details: java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.encodeBase64String Edit: Realized I included the incorrect build.gradle file. Updated settings.gradle to remove the include statement. Included correct build.gradle and NoSuchMethod error.
has comment: http://stackoverflow.com/comment/43304240
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/27431508
tagged with: android-studio
has comment: http://stackoverflow.com/comment/43303975
has comment: http://stackoverflow.com/comment/43304048
type: Question
tagged with: java
has title: How do I import an external library into Android Studio?
has comment: http://stackoverflow.com/comment/43304446
has comment: http://stackoverflow.com/comment/43304773
score: 0

http://stackoverflow.com/a/27468471
type: Answer
answers question: http://stackoverflow.com/q/27468430
score: 0
has body: This is because you're overlooking the custom object entirely and going to a field that has an equals method defined. If you were doing something like this instead: if(obj1.equals(obj2)) ...you would have an issue if equals isn't defined on Lang. But, as we know, equals is indeed defined on String, so you would see it working just fine. This is, of course assuming that category actually is String; I'm only inferring it for now.
has comment: http://stackoverflow.com/comment/43372401

http://stackoverflow.com/comment/43318676
score: 1
has text: @DaImTo GOOD LORD thanks for the help. I am pretty sure from my code I've settled everything there needs to be present for an EXCLUDE filter, but it just won't work. But yes patch worked perfectly fine, thank you!
comment on: http://stackoverflow.com/q/27438481
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27435116
has comment: http://stackoverflow.com/comment/43319723
accepted answer: http://stackoverflow.com/a/27449049
has title: CliBuilder argument without dash
upvote count: 2
linked to: http://stackoverflow.com/q/7739214
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27449049
tagged with: java
has comment: http://stackoverflow.com/comment/43314993
has body: Using Groovy CliBuilder, ideally I would like to have an cmd-line as follows: ./MyProgram.groovy CommandName -arg1 -arg2 -arg3 Is is possible to parse pull out the CommandName as an argument using CliBuilder?
tagged with: command-line-interface
downvote count: 0
answer count: 1
favorite count: 0
tagged with: groovy
score: 2

http://stackoverflow.com/comment/43339241
type: AnswerComment
has text: @ccleve Please be more detailed in how it does not answer the question. I think it does by saying it is not possible. My point is that there is no way to make a JsonObject or JsonArray be type safe, JSON is a string serialization, therefore inherently not type safe, you can workaround it with marshalling into type safe classes. By the way, asking for library suggestions is one of the reasons for closing a question, I am showing you how to add type safety using the library you mentioned.
comment on: http://stackoverflow.com/a/27449512
type: Comment
score: 0

http://stackoverflow.com/a/27364130
has body: You need to resize the JFrame not the JPanel. Try: this.setPreferredSize(new Dimension(350, 25);// in Ex1 Or in your main method: frame.setPreferredSize(new Dimension(350, 25);
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27364098
has comment: http://stackoverflow.com/comment/43257597

http://stackoverflow.com/q/27459678
has comment: http://stackoverflow.com/comment/43356275
linked to: http://stackoverflow.com/q/22395417
type: AnsweredQuestion
upvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: -1
type: Question
tagged with: jsoup
has comment: http://stackoverflow.com/comment/43356065
answer count: 1
has title: How to parse html from parsed json data?
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27459719
accepted answer: http://stackoverflow.com/a/27459719
has body: I tried to parse some url from json data to get only the image from the url inside the json and show it as a picture. But I keep getting errors from it and i don't know how to solve it (a.k.a I'm still a noob at this). I'm using the code from here and change the json file and the code a bit. This is the code public class MainActivity extends Activity { // Log tag private static final String TAG = MainActivity.class.getSimpleName(); // Movies json url static final String url = "http://url"; ProgressDialog pDialog; List&lt;Movie&gt; movieList = new ArrayList&lt;Movie&gt;(); ListView listView; CustomListAdapter adapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); listView = (ListView) findViewById(R.id.list); adapter = new CustomListAdapter(this, movieList); listView.setAdapter(adapter); pDialog = new ProgressDialog(this); // Showing progress dialog before making http request pDialog.setMessage("Loading..."); pDialog.show(); // changing action bar color getActionBar().setBackgroundDrawable( new ColorDrawable(Color.parseColor("#1b1b1b"))); // Creating volley request obj JsonArrayRequest movieReq = new JsonArrayRequest(url, new Response.Listener&lt;JSONArray&gt;() { @Override public void onResponse(JSONArray response) { Log.d(TAG, response.toString()); hidePDialog(); // Parsing json for (int i = 0; i &lt; response.length(); i++) { try { Movie movie = new Movie(); JSONObject obj = response.getJSONObject(i); movie.setTitle(obj.getString("title")); //here where I try to parse the string from json file String url2= obj.getString("image"); Document document = Jsoup.connect(url2).get(); Elements img = document.select("div [class=ipsBox] img[src]"); String imgSrc = img.attr("src"); movie.setThumbnailUrl(imgSrc); movie.setRating(((Number) obj.get("rating")) .doubleValue()); movie.setYear(obj.getInt("releaseYear")); // Genre is json array JSONArray genreArry = obj.getJSONArray("genre");…
tagged with: android

http://stackoverflow.com/q/27373362
tagged with: multithreading
tagged with: android
has body: I have an android application, which contains a main activity which displays information to the user. When MainActivity starts, A service is created/started which checks a web service on every 10 seconds - if the Web service result will show in a notification. I start the service from Main activity using Intent, getActivity().startService(new Intent(getActivity(), NotificationService.class)); I Also try this code, (But same result). getActivity().runOnUiThread(new Runnable() { @Override public void run() { getActivity().startService(new Intent(getActivity(), NotificationService.class)); } }); If service started I get warning In my Logcat, Skipped 91 frames! The application may be doing too much work on its main thread. My notification service code, public class NotificationService extends Service { // constant public static final long NOTIFY_INTERVAL = 10 * 1000; // 10 seconds long current_times; String c_time; // run on another Thread to avoid crash private Handler mHandler = new Handler(); // timer handling static HttpClient client = new DefaultHttpClient(); private Timer mTimer = null; @Override public int onStartCommand(Intent intent, int flags, int startId) { // TODO Auto-generated method stub return START_STICKY; } @Override public IBinder onBind(Intent intent) { return null; } @TargetApi(Build.VERSION_CODES.GINGERBREAD) @SuppressLint("NewApi") @Override public void onCreate() { // cancel if already existed StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); SharedPreferences.Editor editor = getSharedPreferences("notification_oldtime", MODE_PRIVATE).edit(); editor.putInt("old_trail_time", 0); editor.putInt("old_sample_time", 0); editor.putInt("old_neworder_time", 0); editor.commit(); if(mTimer != null) { mTimer.cancel(); } else { // recreate new mTimer = new Timer(); } // schedule task mTimer.scheduleAtFixedRate(new TimeDisplayTimerTask(), 0, NOTIFY_INTERVAL); } public long current_tim…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27373385
tagged with: java
possible better answer: http://stackoverflow.com/a/27373586
type: Question
has answer: http://stackoverflow.com/a/27373586
tagged with: android-service
accepted answer: http://stackoverflow.com/a/27373385
has comment: http://stackoverflow.com/comment/43200185
score: 0
answer count: 2
has title: Android service run every 10 seconds makes ANR Message
has comment: http://stackoverflow.com/comment/43197359
has comment: http://stackoverflow.com/comment/43198208

http://stackoverflow.com/comment/43310425
score: 0
type: AnswerComment
type: Comment
has text: Running a black square on canvas, i have done this before and when i run it i see the square but my whole pc start to freeze lol...
comment on: http://stackoverflow.com/a/27434698

http://stackoverflow.com/comment/43213607
comment on: http://stackoverflow.com/a/27378687
has text: what do you mean by sentence has to be same?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27323087
tagged with: java
has comment: http://stackoverflow.com/comment/43105490
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43105421
linked to: http://stackoverflow.com/q/94361
has comment: http://stackoverflow.com/comment/43105736
has comment: http://stackoverflow.com/comment/43105664
has comment: http://stackoverflow.com/comment/43106531
has comment: http://stackoverflow.com/comment/43107346
has comment: http://stackoverflow.com/comment/43106373
has answer: http://stackoverflow.com/a/27323248
score: -1
has body: I want to take from a list the user's choice and convert it to a string with Jbox. How can I convert the contents to string so I can use it? public class Graph extends JFrame { private String temp; public Graph() { } public void CreateBox(String[] a) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JButton jButton1 = new JButton("ok"); final JList jList1 = new JList(a); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { Object contents = jList1.getSelectedValue(); //System.out.println(contents); setChoise((String)contents);//how can i convert it to string ? } }); JButton jButton2 = new JButton("close"); jButton2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); frame.add(jList1, "Center"); frame.add(jButton1,"South"); frame.add(jButton2,"North"); frame.setSize(300, 200); frame.setVisible(true); } public void setChoise(String temp) { this.temp=temp; } public String getChoise() { return this.temp; } }
has comment: http://stackoverflow.com/comment/43105976
answer count: 3
has title: how can I convert an Object to a string?
has comment: http://stackoverflow.com/comment/43105544
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27323190
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43105486
has answer: http://stackoverflow.com/a/27323150
has comment: http://stackoverflow.com/comment/43107019
tagged with: jcombobox
linked to: http://stackoverflow.com/q/6055476

http://stackoverflow.com/comment/43108159
has text: [Here are the rules for `url-pattern` matching.](http://javapapers.com/servlet/what-is-servlet-mapping/) You sent a request to `/FibonacciServlet/servlet/HelloWorld`. Assuming `/FibonacciServlet` is your web application context path, the target path is `/servlet/HelloWorld/`. But your servlet is mapped to `/HelloServlet`. Obviously those don't match, so your servlet won't handle that request.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27319524

http://stackoverflow.com/comment/43114241
type: Comment
score: 0
has text: You're actually right, the code worked because it's in the base class of the actual servlets. So there was actually an instance per Servlet. And the logic in the method doesn't need to be re-evaluated every time, so the results make sense, too. Thanks for clarifying!
type: AnswerComment
comment on: http://stackoverflow.com/a/27326992

http://stackoverflow.com/q/27359531
possible better answer: http://stackoverflow.com/a/27359874
has answer: http://stackoverflow.com/a/27359874
has answer: http://stackoverflow.com/a/27360295
accepted answer: http://stackoverflow.com/a/27360295
type: Question
type: AnsweredQuestion
has title: Display GIF image from URL in android
tagged with: java
answer count: 2
score: 0
has body: I'm trying to design an app and all I want it to do is load an image from a URL.I m displaying GIF image with the URL(from internet) but it is not displaying the image.I have posted code as well as logcat below: Activity package com.example.mosdacappalert_radio; import android.app.Activity; import android.os.Bundle; import android.widget.RelativeLayout; public class Heavy_rain1 extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.activity_heavy_rain1); RelativeLayout myLayout = (RelativeLayout) findViewById(R.id.addView); myLayout.addView(new com.example.mosdacappalert_radio.ShowGifView(this, "http://graphico.in/wp-content/uploads/2014/05/Happy-anniversary-wishes-to-you.gif")); } } class file package com.example.mosdacappalert_radio; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import android.content.Context; import android.graphics.Canvas; import android.graphics.Movie; import android.os.AsyncTask; import android.util.AttributeSet; import android.view.View; public class ShowGifView extends View { // Set true to use decodeStream // Set false to use decodeByteArray private static final boolean DECODE_STREAM = true; private InputStream gifInputStream; private Movie gifMovie; private int movieWidth, movieHeight; private long movieDuration; private long mMovieStart; static String gifURL; public ShowGifView(Context context, String a) { super(context); gifURL = a; init(context); } public ShowGifView(Context context, AttributeSet attrs) { super(context, attrs); init(context); } public ShowGifView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context); } private void init(final Context context) { setFocusable(true); gifMovie = null; movieWidth = 0; movieHeigh…
tagged with: android
linked to: http://stackoverflow.com/q/8088865

http://stackoverflow.com/comment/43174544
comment on: http://stackoverflow.com/a/27360384
type: AnswerComment
has text: you are missing tools.jar, which is part of the jdk, so you must be using jre
score: 0
type: Comment

pdfbox
tag name: pdfbox
tags question: http://stackoverflow.com/q/27333499
tags question: http://stackoverflow.com/q/27472708
tags question: http://stackoverflow.com/q/27328745
tags question: http://stackoverflow.com/q/27341553
tags question: http://stackoverflow.com/q/27460541
type: Tag

embedded-tomcat-7
type: Tag
tag name: embedded-tomcat-7
tags question: http://stackoverflow.com/q/27430577

http://stackoverflow.com/comment/43246524
has text: @madprorammer i got your point but, with UIManager we can use the LAFS which is already available but we could not customise the UI colors according to our wish thats the problem. is there any solution available ? please suggest !!!
comment on: http://stackoverflow.com/a/27394489
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43199191
has text: @Rick, JAVA is NOT "more memory hungry than C#". It's only your JAVA code is more memory hungry than your C# code. C# and JAVA code can look similar, but it's may do absolutely differing things or use "more memory hungry" structures. As programmer you should use profiling to find out what is actually use your memory. Practically identical code will always use same amount of memory, detached of language this code is written in.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27354525
type: AnswerComment

http://stackoverflow.com/q/27318596
has comment: http://stackoverflow.com/comment/43096733
has answer: http://stackoverflow.com/a/27318642
has answer: http://stackoverflow.com/a/27319463
has comment: http://stackoverflow.com/comment/43096786
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43097477
has comment: http://stackoverflow.com/comment/43096590
score: -1
has comment: http://stackoverflow.com/comment/43096600
has title: Error running and compiling java code related issues
has answer: http://stackoverflow.com/a/27318885
answer count: 3
upvote count: 0
has body: Issue with running the code Getting constant illegal escape character declaring variables, and strings which seem to be declared properly. import java.swing.*; import java.text.DecimalFormat; public class TWP1Project { private static Object dataIn; public static void main(String[] args) { // declare class variables int hours; double fee, rate, tuition; // call methods displayWelcome(); hours = getHours(); rate = getRate(); tuition = calcTuition(hours); fee = myArray(1); diplayTotal(tuition+fee); } public static void displayWelcome() { System.out.println("\Welcome to the Tuition and Fees Calculator"); } } public static int getHours() { //declare variables String strHours; int hours = 0; //prompts user for input System.out.println("Enter the number of hours accrued in a class."); hours = dataIn.readLine(); try { hours = Integer.parseInt(strHours); } catch{NumberFormatException e}; JOptionPane.showMessageDialog{null,"Your entry was not in the proper format.", "Error"JOptionPane.INFORMATION_MESSAGE}; { System.out.println("Please input whole numbers only"); } return hours; } //the getRate() method ask user to input the rate per credit hours. public static double getRate() { int hours =12; if (hours&gt;12) System.out.println("calculate the rate per credit hours"); else if (hours&lt;12) System.out.println("credit hours is inaccurate"); else System.out.println("zero"); } } return rate; //the calcTuition() allowed to calculate tuition. public static double calcTuition() {`enter code here` int hours double rate =0.0; double rate * hours } return tuition; // public static myArray(int tuition) { int tuition double fee } return fee Need help correcting if you can or offer some tips. Having issues running it in java correctly.
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/43203284
comment on: http://stackoverflow.com/q/27376750
score: 0
type: Comment
type: QuestionComment
has text: but my catagory reference variable(array variable) is Global

http://stackoverflow.com/comment/43383315
type: AnswerComment
comment on: http://stackoverflow.com/a/27474338
type: Comment
has text: @Phil_oneil what exactly is the error? can you please provide it?
score: 0

http://stackoverflow.com/a/27329409
has comment: http://stackoverflow.com/comment/43117973
upvote count: 1
has body: First thing I'd like to mention is the use of static in your method signatures. They should not be static , and you should not be trying to access them statically (MainServerFrame.getFrame().setVisible(true);). Take out the static in all the method signatures, add access the methods like window.getFrame().setVisible(true); Secondly, the MainServerFrame is being created on the Event Dispatch Thread. The EDT handle all the UI interaction. Though your code is not complete, it appears the while loop is in the MainServerFrame's constructor. The problem with this is that the while loops blocks the event thread, causing the unresponsiveness. To fix it, you could simply start a new thread for the while loop. new Thread(new Runnable(){ public void run() { while (true) { ... } } }).start(); Any calls inside this new thread, which attempts to update the UI, should be wrapped in a SwingUtilities.invokeLater. Something like new Thread(new Runnable(){ public void run() { while (true) { ... SwingUtilities.invokeLater(new Runnable(){ public void run() { label.setText(...); } }); } } }).start(); Check out Concurrency in Swing Here's a simple refactor. I took out some of the code just to make the example simpler public class MainServerFrame { private JFrame frame; private ServerSocket serverSocket = null; private Socket clientSocket = null; private int maxClientsCount = 999; private JTextArea serverLog = new JTextArea(10, 40); public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { MainServerFrame app = new MainServerFrame(); app.getFrame().setVisible(true); app.startServer(); } catch (Exception e) { e.printStackTrace(); } } }); } public MainServerFrame() { frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.add(serverLog); frame.pack(); frame.setLocationByPlatform(true); } public JFrame getFrame() { return frame; } public void startServer() { int portNumber = 3333; try { serverSocket = new ServerSocket(…
has comment: http://stackoverflow.com/comment/43117415
answers question: http://stackoverflow.com/q/27329223
has comment: http://stackoverflow.com/comment/43118595
has comment: http://stackoverflow.com/comment/43118133
type: Answer
has comment: http://stackoverflow.com/comment/43118221
has comment: http://stackoverflow.com/comment/43118232
has comment: http://stackoverflow.com/comment/43117429
has comment: http://stackoverflow.com/comment/43117931
downvote count: 0
has comment: http://stackoverflow.com/comment/43118264
has comment: http://stackoverflow.com/comment/43117378
score: 1
has comment: http://stackoverflow.com/comment/43117920
has comment: http://stackoverflow.com/comment/43117699
has comment: http://stackoverflow.com/comment/43117710

http://stackoverflow.com/comment/43216748
type: Comment
comment on: http://stackoverflow.com/q/27367510
score: 0
type: QuestionComment
has text: Can somebody pls advise?

http://stackoverflow.com/comment/43247874
type: Comment
comment on: http://stackoverflow.com/a/27393546
type: AnswerComment
has text: Thanks for such an amazing answer @peeskillet (+1)! A few followup questions, since you piqued my interests: (1) When I inject principals into my resource methods, I assume that this method works with Basic Auth as well as any other auth system I choose to use (OAuthv2, something custom, etc.), yes? (2) I also assume that I can have other arguments in my resource methods, so borrowing from your example above, could I have `public Response getResponse(@Auth SimplePrincipal prince, @PathParam("id") Long id)`, yes?
score: 0

image
tags question: http://stackoverflow.com/q/27392027
tags question: http://stackoverflow.com/q/27333469
tags question: http://stackoverflow.com/q/27370845
tags question: http://stackoverflow.com/q/27337119
tags question: http://stackoverflow.com/q/27470343
tags question: http://stackoverflow.com/q/27430007
tags question: http://stackoverflow.com/q/27323627
tags question: http://stackoverflow.com/q/27347018
tags question: http://stackoverflow.com/q/27452088
tags question: http://stackoverflow.com/q/27465014
tags question: http://stackoverflow.com/q/27446360
tags question: http://stackoverflow.com/q/27432635
tags question: http://stackoverflow.com/q/27328754
tags question: http://stackoverflow.com/q/27334429
tags question: http://stackoverflow.com/q/27370550
tags question: http://stackoverflow.com/q/27436301
tags question: http://stackoverflow.com/q/27436168
tags question: http://stackoverflow.com/q/27431036
tags question: http://stackoverflow.com/q/27458361
tags question: http://stackoverflow.com/q/27462758
tags question: http://stackoverflow.com/q/27367121
tags question: http://stackoverflow.com/q/27362763
tags question: http://stackoverflow.com/q/27403966
tags question: http://stackoverflow.com/q/27400239
tag name: image
tags question: http://stackoverflow.com/q/27343632
tags question: http://stackoverflow.com/q/27411774
type: Tag
tags question: http://stackoverflow.com/q/27342455
tags question: http://stackoverflow.com/q/27408611
tags question: http://stackoverflow.com/q/27473895

http://stackoverflow.com/q/27334452
tagged with: java
has comment: http://stackoverflow.com/comment/43128119
has body: I have written a simple code to retrieve the values of a column from the table. The table contains about 220 something entries. When i run the program, it outputs the column's value after 118th entry. How to solve this problem. I want that the program should output all the values from 1st till the end. Connection con; Statement st; ResultSet rs; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con= DriverManager.getConnection("jdbc:odbc:Airport","",""); st= con.createStatement(); String s1="Select * from Flight_Status1"; rs=st.executeQuery(s1); while(rs.next()) { System.out.println(rs.getInt(9)); } } catch (SQLException ex) { Logger.getLogger(WebBrowser.class.getName()).log(Level.SEVERE, null, ex); } catch (ClassNotFoundException ex) { Logger.getLogger(WebBrowser.class.getName()).log(Level.SEVERE, null, ex); }
type: Question
has comment: http://stackoverflow.com/comment/43126006
score: 0
tagged with: sql
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43177467
has title: select statement not retrieving all the rows in the database
has comment: http://stackoverflow.com/comment/43125921

http://stackoverflow.com/q/27328754
score: -1
tagged with: image
type: Question
has comment: http://stackoverflow.com/comment/43117874
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43116274
favorite count: 0
has answer: http://stackoverflow.com/a/27335590
has comment: http://stackoverflow.com/comment/43135249
tagged with: buffer
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/43116176
has comment: http://stackoverflow.com/comment/43135238
upvote count: 0
has comment: http://stackoverflow.com/comment/43117223
has comment: http://stackoverflow.com/comment/43117419
type: UnansweredQuestion
has body: For my Software Engineering class my group has to get a camera stream from a server and send it to a client via a socket. We do this by constantly sending images through a socket. When we try to run our program we only get one image but the next image turns up as null and therefore we get a nullpointer exception. Here is the UserClient class. The UserClient receives a sequence of images. The null pointer comes up in the run method, I labeled it with a comment. /* * 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 communication; import java.awt.image.BufferedImage; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.ObjectInputStream; import java.net.ConnectException; import java.net.Socket; import java.net.UnknownHostException; import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.JOptionPane; import userpc.RoverGUI; /** * A simple Swing-based client for the capitalization server. It has a main * frame window with a text field for entering strings and a textarea to see the * results of capitalizing them. */ public class UserClient extends Thread{ //ObjectInputStream input; Socket s = null; boolean done = false; String serverAddress; RoverGUI gui; public static void main(String[] args){ String serverAddress = JOptionPane.showInputDialog( "Enter IP Address of a machine that is\n" + "running the date service on port 9090:"); try { UserClient c = new UserClient(null, serverAddress); } catch (IOException ex) { Logger.getLogger(UserClient.class.getName()).log(Level.SEVERE, null, ex); } } public UserClient(RoverGUI gui, String serverAddress) throws UnknownHostException, IOException{ this.gui=gui; this.serverAddress=serverAddress; } @Override public void run(){ while (!done) { try { if (serverAddress.equals("")) { throw new Unk…
tagged with: socket.io
has comment: http://stackoverflow.com/comment/43117125
tagged with: java
has title: Null Pointer Exception on Buffer IO

http://stackoverflow.com/comment/43151530
comment on: http://stackoverflow.com/q/27347174
type: Comment
type: QuestionComment
has text: This question has nothing to do with painting or datagrams. It's just a key listener question.
score: 0

http://stackoverflow.com/a/27453276
score: 1
has body: Try this: Map&lt;String,Object&gt; params = Collections.singletonMap("fields", partyIdList ); namedParameterJdbcTemplate.query("select * from myTable where someCol IN (:fields)", new Object[] { params }, new BeanPropertyRowMapper&lt;MyDto&gt;(MyDto.class));
answers question: http://stackoverflow.com/q/27452849
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27452849
upvote count: 1

http://stackoverflow.com/q/27313937
has comment: http://stackoverflow.com/comment/43088536
has comment: http://stackoverflow.com/comment/43090560
has body: When running a jar file in a 32bit JVM System.getenv("programfiles") returns C:\Program Files (x86). Is there any way of getting the 64 bit version of program files regardless of what JVM you are running on?
score: 0
has comment: http://stackoverflow.com/comment/43088098
tagged with: java
has title: Get 64bit ProgramFiles path running 32bit JVM
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43088280
answer count: 0
has comment: http://stackoverflow.com/comment/43088488
has comment: http://stackoverflow.com/comment/43088662
type: Question

http://stackoverflow.com/comment/43320546
has text: Sorry for irrelevant question, but: what features come with `JUnit 4.12` that cause of your unwillingness to downgrade JUnit?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27420675

http://stackoverflow.com/q/27473513
has title: Read utf-8 using Scanner
has body: I am having trouble with UTF-8 encoding when using Scanner. Example two lines of my data file: 000001 Mėlynas Tadas 63210309683 V 2003/03/17 2016/03/17 000002 Raudonas Tomas 65505023282 V 2006/01/26 2018/01/26 Currently I am using Scanner to read the text separately instead of the whole line as this is more convenient, but it doesn't read correctly because of the encoding. I've read about using InputStream etc but I don't want to deal with messy line chopping. Is there a way to use Scanner with UTF-8?
score: 7
tagged with: java
has comment: http://stackoverflow.com/comment/64463581
type: Question
answer count: 2
tagged with: encoding
has answer: http://stackoverflow.com/a/27473561
has answer: http://stackoverflow.com/a/27473547
downvote count: 0
tagged with: utf-8
favorite count: 0
tagged with: java.util.scanner
type: UnansweredQuestion
upvote count: 7

http://stackoverflow.com/comment/43125856
has text: I think the JSlider at the bottom is part of a music player.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27333149
score: 0

http://stackoverflow.com/a/28475985
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27409887
downvote count: 0
has body: I just got the same crash report. To investigate deeper, the following code can be used: import org.eclipse.swt.internal.win32.OS; import org.eclipse.swt.widgets.Display; public class InvestigateSwtProblem { static final byte[] CLSID_TaskbarList = new byte[16]; static final byte[] IID_ITaskbarList3 = new byte[16]; static { OS.IIDFromString("{56FDF344-FD6D-11d0-958A-006097C9A090}\0".toCharArray(), CLSID_TaskbarList); //$NON-NLS-1$ OS.IIDFromString("{EA1AFB91-9E28-4B86-90E9-9E9F8A5EEFAF}\0".toCharArray(), IID_ITaskbarList3); //$NON-NLS-1$ } public static void main(String[] args) { Display display = new Display(); int /*long*/[] ppv = new int /*long*/ [1]; int hr = OS.CoCreateInstance(CLSID_TaskbarList, 0, OS.CLSCTX_INPROC_SERVER, IID_ITaskbarList3, ppv); System.out.println("Result of CoCreateInstance = " + hr); } } In my case, the error was -2147024882, which I found in winerror.h to be: // // MessageId: E_OUTOFMEMORY // // MessageText: // // Ran out of memory // #define E_OUTOFMEMORY _HRESULT_TYPEDEF_(0x8007000EL) I still don't know the reason or the solution, but at least you have something to tell the sysadmin. PS. this if for 32 bit SWT. I haven't tested on 64 bit SWT, but I guess you should replace int with long where int /*long*/ appears in the code.
type: Answer

http://stackoverflow.com/q/27395055
tagged with: android
tagged with: java
upvote count: 1
type: UnansweredQuestion
has body: For Android Horizontal Scrolling ..how can i keep one or two column fixed?? Rest of one or two column others will scroll horizontally... please help me.... I want to keep fixed one column horizontally fixed in Scroll View TableLayout (here...android:id="@+id/tblPVPDetailList")
has title: Android Horizontal Scrolling
answer count: 0
downvote count: 0
score: 1
favorite count: 0
type: Question

http://stackoverflow.com/q/27464042
answer count: 1
has body: I want to implement some example of Interpreter pattern And met some trouble with code example. I want to pass to method List of child elements using parent reference: Here is a code snippet from main(): GoodPackage truck = new GoodPackage(); truck.setGoodsInside(new ArrayList&lt;Goods&gt;()); Bed bed = new Bed(); GoodPackage doubleTriplePackedBed = new GoodPackage(); doubleTriplePackedBed.setGoodsInside(Arrays.asList(new GoodPackage().setGoodsInside(Arrays.asList(bed)))); Other classes: abstract class Goods { public abstract Integer interpret(CurrentPricesContext context); } class GoodPackage extends Goods { private List&lt;? super Goods&gt; goodsInside; @Override public Integer interpret(CurrentPricesContext context) { int totalSum = 0; for (Iterator&lt;? super Goods&gt; iter = goodsInside.iterator(); iter.hasNext(); iter.next()) { Goods good = (Goods) iter.next(); totalSum += good.interpret(context); } /*for (Goods goods : goodsInside) { totalSum += goods.interpret(context); }*/ return totalSum; } public List&lt;? super Goods&gt; getGoodsInside() { return goodsInside; } public void setGoodsInside(List&lt;? super Goods&gt; goodsInside) { this.goodsInside = goodsInside; } } class Bed extends Goods { @Override public Integer interpret(CurrentPricesContext context) { int price = context.getPrice(GoodsInstances.BAD); System.out.printf("Bad: %d%n", price); return price; } } Issue is that: setGoodsInside (java.util.List&lt;? super patterns.behavioral.interpreter.Goods&gt;) can't be applicable to java.util.List&lt;patterns.behavioral.interpreter.Bed&gt; I couldn't figure out what I missed. Because the type of list is List&lt;? super Goods&gt;. How to solve this issue?
tagged with: polymorphism
has comment: http://stackoverflow.com/comment/43364733
favorite count: 0
has comment: http://stackoverflow.com/comment/105960813
has comment: http://stackoverflow.com/comment/43364721
tagged with: generics
score: -1
accepted answer: http://stackoverflow.com/a/27464671
has title: Strange behavior of generics
downvote count: 1
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43385917
type: Question
upvote count: 0
has answer: http://stackoverflow.com/a/27464671

http://stackoverflow.com/q/27450215
accepted answer: http://stackoverflow.com/a/27480934
score: 0
tagged with: java
type: AnsweredQuestion
has body: I am implementing Speech recognition in android app. But after i speak to my phone, app show me MainActivity (I am starting speech recognition Intent from different activity), and Dialog witch options to choose won,t show up. Below you can find my code. public class AddFoood extends Activity { private static final int REQUEST_CODE = 1234; Button voice; Dialog match_text_dialog; ArrayList&lt;String&gt; matches; ListView textlist; String SPEACH_RESULT; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_add_foood); getActionBar().setTitle("Add Food"); voice = (Button)findViewById(R.id.voiceButton); voice.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(isConnected()){ Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH); //intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, //RecognizerIntent.LANGUAGE_MODEL_FREE_FORM); intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "en-US"); intent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, 15); startActivityForResult(intent,REQUEST_CODE); }else { Toast.makeText(getApplicationContext(),"No internet connection",Toast.LENGTH_SHORT).show(); } } }); } public boolean isConnected() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo net = cm.getActiveNetworkInfo(); if (net!=null &amp;&amp; net.isAvailable() &amp;&amp; net.isConnected()) { return true; } else { return false; } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == REQUEST_CODE &amp;&amp; resultCode == RESULT_OK) { match_text_dialog = new Dialog(AddFoood.this); match_text_dialog.setContentView(R.layout.dialog_matches_frag); match_text_dialog.setTitle("Select Matching Text"); textlist = (ListView)match_text_dialog.findViewById(R.id.list); matches = data.getStringA…
answer count: 1
has answer: http://stackoverflow.com/a/27480934
tagged with: speech-recognition
type: Question
tagged with: android
has title: Android speech recognition result dialog won't show up
tagged with: android-studio

http://stackoverflow.com/comment/43370936
type: Comment
comment on: http://stackoverflow.com/q/27467581
type: QuestionComment
has text: Its not clear what exactly the problem is. Do you need to get rid of if else structure in your getElement method ? Or the xpath locator is not working in your getElement method ?
score: 0

http://stackoverflow.com/q/27459783
tagged with: jpanel
accepted answer: http://stackoverflow.com/a/27459878
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27459878
score: 2
has title: Using JLayeredPane to add multiple JPanels to a JPanel
upvote count: 2
tagged with: swing
type: AnsweredQuestion
tagged with: jlayeredpane
has body: I am trying to add multiple panels to another panel. I want them to be on top of each other so I'm using JLayeredPane. I've added a button to each one. Two buttons should appear when it works. import java.awt.Color; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLayeredPane; import javax.swing.JPanel; public class PanelTest { public static void main(String[] args) { JFrame frame = new JFrame(); JPanel mainPanel = new JPanel(); JPanel panel1 = new JPanel(); JPanel panel2 = new JPanel(); JLayeredPane layers = new JLayeredPane(); mainPanel.add(layers); panel2.setOpaque(false); panel1.setOpaque(false); panel1.setVisible(true); panel2.setVisible(true); panel1.add(new JButton("1111111111")); panel2.add(new JButton("2")); frame.setContentPane(mainPanel); layers.add(panel1, new Integer(2)); layers.add(panel2, new Integer(3)); frame.setVisible(true); frame.setSize(500, 500); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } Only the grey background of the mainPanel is visible. What am I doing wrong?
tagged with: java

http://stackoverflow.com/a/27350922
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27350761
type: Answer
score: 2
upvote count: 2
has body: from code for file package is org.springframework.boot.context.embedded maven dependency org.springframework.boot spring-boot x.x.x
answers question: http://stackoverflow.com/q/27350761
has comment: http://stackoverflow.com/comment/43156315

http://stackoverflow.com/tag/json
tags question: http://stackoverflow.com/q/27344936
tags question: http://stackoverflow.com/q/27380858
tags question: http://stackoverflow.com/q/27363376
tags question: http://stackoverflow.com/q/27333173
tags question: http://stackoverflow.com/q/27330136
tags question: http://stackoverflow.com/q/27459279
tags question: http://stackoverflow.com/q/27449365
tags question: http://stackoverflow.com/q/27405492
tags question: http://stackoverflow.com/q/27441208
tags question: http://stackoverflow.com/q/27398674
tags question: http://stackoverflow.com/q/27402466
tags question: http://stackoverflow.com/q/27409808
tags question: http://stackoverflow.com/q/27352672
tags question: http://stackoverflow.com/q/27459678
tags question: http://stackoverflow.com/q/27341653
tags question: http://stackoverflow.com/q/27329227
tags question: http://stackoverflow.com/q/27326681
tags question: http://stackoverflow.com/q/27445435
tags question: http://stackoverflow.com/q/27420014
tags question: http://stackoverflow.com/q/27314654
tags question: http://stackoverflow.com/q/27370685
tags question: http://stackoverflow.com/q/27367352
tags question: http://stackoverflow.com/q/27463937
tags question: http://stackoverflow.com/q/27412682
tags question: http://stackoverflow.com/q/27427999
tags question: http://stackoverflow.com/q/27446496
tags question: http://stackoverflow.com/q/27316485
tags question: http://stackoverflow.com/q/27437768
tags question: http://stackoverflow.com/q/27461077
tags question: http://stackoverflow.com/q/27457701
tags question: http://stackoverflow.com/q/27341848
tags question: http://stackoverflow.com/q/27413894
tags question: http://stackoverflow.com/q/27460893
tags question: http://stackoverflow.com/q/27354019
tags question: http://stackoverflow.com/q/27470651
tags question: http://stackoverflow.com/q/27353664
type: Tag
tags question: http://stackoverflow.com/q/27402825
tags question: http://stackoverflow.com/q/27410216
tags question: http://stackoverflow.com/q/27374366
tags question: http://stackoverflow.com/q/27417670
tags question: http://stackoverflow.com/q/27358721
tags question: http://stackoverflow.com/q/27445722
tags question: http://stackoverflow.com/q/27316854
tags question: http://stackoverflow.com/q/27341788
tags question: http://stackoverflow.com/q/27422217
tags question: http://stackoverflow.com/q/27386883
tags question: http://stackoverflow.com/q/27366129
tags question: http://stackoverflow.com/q/27452817
tags question: http://stackoverflow.com/q/27457925
tags question: http://stackoverflow.com/q/27441576
tags question: http://stackoverflow.com/q/27437447
tags question: http://stackoverflow.com/q/27441249
tags question: http://stackoverflow.com/q/27400261
tags question: http://stackoverflow.com/q/27371134
tags question: http://stackoverflow.com/q/27466772
tags question: http://stackoverflow.com/q/27321366
tags question: http://stackoverflow.com/q/27380377
tags question: http://stackoverflow.com/q/27411902
tags question: http://stackoverflow.com/q/27391867
tags question: http://stackoverflow.com/q/27347053
tags question: http://stackoverflow.com/q/27401658
tags question: http://stackoverflow.com/q/27457812
tags question: http://stackoverflow.com/q/27416413
tag name: json
tags question: http://stackoverflow.com/q/27398837
tags question: http://stackoverflow.com/q/27446065
tags question: http://stackoverflow.com/q/27350827
tags question: http://stackoverflow.com/q/27330238
tags question: http://stackoverflow.com/q/27419834
tags question: http://stackoverflow.com/q/27348283
tags question: http://stackoverflow.com/q/27454200
tags question: http://stackoverflow.com/q/27327838
tags question: http://stackoverflow.com/q/27378459
tags question: http://stackoverflow.com/q/27326393
tags question: http://stackoverflow.com/q/27372940
tags question: http://stackoverflow.com/q/27439860
tags question: http://stackoverflow.com/q/27357108
tags question: http://stackoverflow.com/q/27427613
tags question: http://stackoverflow.com/q/27325995

http://stackoverflow.com/a/27394441
answers question: http://stackoverflow.com/q/27394176
has body: Try dependency:get like this: mvn dependency:get -DrepoUrl=http://repo.maven.apache.org/maven2/ -Dartifact=org.springframework:spring-context:4.0.4.RELEASE:jar -Dtransitive=false -Ddest=spring-context-4.0.4.RELEASE.jar
has comment: http://stackoverflow.com/comment/43236167
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 7
upvote count: 7
accepted answer of: http://stackoverflow.com/q/27394176

http://stackoverflow.com/q/27436802
has answer: http://stackoverflow.com/a/27437061
type: Question
possible better answer: http://stackoverflow.com/a/27437068
type: AnsweredQuestion
tagged with: android
has title: Java (Android): Data in the string pattern
has comment: http://stackoverflow.com/comment/43314540
has answer: http://stackoverflow.com/a/27437347
has answer: http://stackoverflow.com/a/27436863
score: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/27437347
has comment: http://stackoverflow.com/comment/43314483
tagged with: replace
has comment: http://stackoverflow.com/comment/43314245
has answer: http://stackoverflow.com/a/27436990
has body: I have a TextView with a string where I need to insert data. Something like: "some text %d other text". I don't want to have a hardcoded text in my sources. Are there any good practices for that?
has comment: http://stackoverflow.com/comment/43314609
has answer: http://stackoverflow.com/a/27437068
answer count: 5

http://stackoverflow.com/comment/43198526
score: 3
type: Comment
type: QuestionComment
has text: But you never have to install pgadmin when installing Postgres anyway.
comment on: http://stackoverflow.com/q/27373960

http://stackoverflow.com/q/27321884
downvote count: 2
answer count: 3
has body: I just started to learn about Lambda Expression and I did something like this: public class LambdaTest { public static void main(String[] args) { int num = returnNumber((num) -&gt; { return 4 }); } public static int returnNumber(int num) { return num; } } But it gives me an error: "invalid tokens". Here is an image: Can someone please explain me what's wrong? It's just a test. I have Java 1.8 supported in my Eclipse installation (Luna 4.4).
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43103175
tagged with: arguments
has comment: http://stackoverflow.com/comment/43103256
tagged with: lambda
tagged with: java-8
has answer: http://stackoverflow.com/a/27322291
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27356599
has answer: http://stackoverflow.com/a/27322463
type: Question
has title: Lambda expression gives "invalid tokens" syntax error in Java
has comment: http://stackoverflow.com/comment/43103117
upvote count: 3

http://stackoverflow.com/a/27437488
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27437174
downvote count: 0
type: Answer
has body: step 1: put .swf file in assests folder step 2: WebView wv = (WebView) findViewById(R.id.webview1); WebSettings ws = wv.getSettings(); ws.setPluginState(PluginState.ON); ws.setJavaScriptEnabled(true); wv.loadUrl(SWF FilePath); duplicate link How to insert a swf animation (flash) in Java for Android (Eclipse)

http://stackoverflow.com/q/27433299
tagged with: android
has title: Best way to store and restore non-primitive data on Android?
score: 0
tagged with: store
answer count: 1
tagged with: java
type: UnansweredQuestion
has body: I have written my first app which can do the following: You can store courses and in these courses you can store assignments of the courses. They are both represented in lists. My class course has some primitive variables and an ArrayList of assignments. My class assignment only has some primitive variables. My MainActivity has an ArrayList of courses. Course and Assignment implements Serializable I am currently using this method: http://developer.android.com/guide/topics/data/data-storage.html#filesInternal by serializing the whole ArrayList into one file in the internal data. The problem which appears now is, that if i want to change the class "course" and add a variable and use the new app, the app wont load my old data since the stored object "course" is not compatible to the new class "course". How can I store data without having the above described problem?
has answer: http://stackoverflow.com/a/27433705
type: Question

http://stackoverflow.com/a/27438560
score: 1
has body: Even though this already has been answered, I'd like to note a few things. Don't use an int or a long to save a phone number! You'll lose leading zeroes! Plus you'll easily go out of your int or long range. Plus the current accepted answer is a little harder to understand. I'd simply go with a lot less, and much easier to understand code: public String toNormalPhoneNumber(String phoneNumber) { String normal = ""; foreach (char c : phoneNumber.toUppercase().toCharArray()) normal += getKeypadNumber(c); return normal; } public char getKeypadNumber(char characterToConvert) { if (Character.isDigit(characterToConvert)) return characterToConvert; else { switch (characterToConvert) { case 'A' : case 'B' : case 'C' : return '2'; case 'D' : case 'E' : case 'F' : return '3'; case 'G' : case 'H' : case 'I' : return '4'; case 'J' : case 'K' : case 'L' : return '5'; case 'M' : case 'N' : case 'O' : return '6'; case 'P' : case 'Q' : case 'R' : case 'S' : return '7'; case 'T' : case 'U' : case 'V' : retrun '8'; case 'W' : case 'X' : case 'Y' : case 'Z' : return '9'; default return '?'; } } } I reckon this is much easier to understand.
upvote count: 1
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/27437431

http://stackoverflow.com/q/27328998
tagged with: regex
has body: In my program a string is generated like this: Energie 670 kJ / 160 kcal So how to write split function in java code and the first keyword Energie should print the outputs? Input : Energie 670 kJ / 160 kcal Expected output : 1) Energie 670 kJ 2) Energie 160 kcal If anyone have a solution to this problem or better way of going about splitting a string twice? Thanks in advance
has answer: http://stackoverflow.com/a/27329045
type: UnansweredQuestion
score: -3
has answer: http://stackoverflow.com/a/27329036
type: Question
linked to: http://stackoverflow.com/q/3481828
has comment: http://stackoverflow.com/comment/43116577
has answer: http://stackoverflow.com/a/27329074
tagged with: java
downvote count: 3
has answer: http://stackoverflow.com/a/27329046
has title: Hi.. How to write java code to split the string?
tagged with: split
upvote count: 0
favorite count: 0
duplicate of: http://stackoverflow.com/q/3481828
has answer: http://stackoverflow.com/a/27329489
answer count: 5

http://stackoverflow.com/q/27339605
tagged with: export
downvote count: 0
favorite count: 0
type: UnansweredQuestion
score: 2
tagged with: grails-plugin
has title: How to get Date format when write to excel sheet using grails2.3.7
answer count: 0
upvote count: 2
has body: There is value in data table. column is Order Date and format is like 2014-11-06 20:27:40. when we export by using below code. response.contentType = grailsApplication.config.grails.mime.types[params.formattext] response.setHeader("Content-disposition", "attachment; filename=Manual Order list.${params.formattext}") List fields = ["orderDate","id","firstName","account","paymentMode","transactionId"] Map labels = ["orderDate":"OrderDate","id":"Order No","firstName":"Customer Name", "account":"Account", "paymentMode":"Payment Method", "transactionId":"Transaction Id"] //Map parameters = [OrderType: "User Order", "column.widths": [0.2, 0.3, 0.5]] exportService.export(params.formattext, response.outputStream,userOrderCriteria?.list{between("orderDate",d1,d2)}, fields, labels, [:], [:]) Then In excel Sheet Order Date value is 27:40 means minute and second only. please help me. How can I get complete format as saved in data table.
tagged with: export-to-excel
type: Question
tagged with: java
tagged with: grails

http://stackoverflow.com/comment/43234614
has text: when server doesnot receive request for long time (idle) when new request is initiated it hangs .But when i initiate a request from my local machine it works(both local machine and server are in LAN)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27376679

http://stackoverflow.com/comment/43221745
has text: Please don't use `Vector`. `ArrayList` has been preferred for a *very* long time.
score: 1
comment on: http://stackoverflow.com/q/27386817
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27427225
has comment: http://stackoverflow.com/comment/43296679
has comment: http://stackoverflow.com/comment/43296636
tagged with: java
type: Question
has body: I'm writing a banking system where as the user deposits or withdraws funds, the balances in the text file should be updated accordingly. void saveFiles(int index) throws IOException{ DateFormat dateFormat = new SimpleDateFormat("E MM/dd/yyyy hh:mm:ss a"); Date date = new Date(); BufferedWriter twriter = new BufferedWriter(new FileWriter("Transactions.txt", true)); BufferedWriter fwriter = new BufferedWriter(new FileWriter("Customers.txt", true)); PrintWriter outputFile = new PrintWriter(fwriter); PrintWriter output = new PrintWriter(twriter); //update to Customer.txt file outputFile.println(people[index].getCustID() + "," +people[index].getTitle() + "," +people[index].getfName() + ","+people[index].getlName()+ "," +people[index].getUsername() + "," +people[index].getPassword() + ","+people[index].getSSN() + ","+people[index].getUniqueID() + "," +people[index].getSightkey() + ","+ FCA + "," + TSA + "," + people[index].getSoarAcctBal()); //update Transactions.txt file output.write((dateFormat.format(date) + "," +people[index].getCustID() + "," +numbers[index].getCheckingAcctNum() + "," + transferAmount + "," + "Withdraw" + "," + people[index].getSoarAcctBal())); outputFile.flush(); outputFile.close(); output.flush(); output.close(); } Loading the Customer File //DEFAULT CONSTRUCTOR public GEBank() { people = new Customer[4]; } //LOAD CUSTOMERS FILE void loadCustomers() throws IOException, FileNotFoundException, ParseException{ BufferedReader inputFile = new BufferedReader(new FileReader("Customers.txt")); //String that holds current file line. String custID = "", title = "", fName = "", lName = "", username = "", password = "", SSN = "", uniqueID = "", sightkey = "", checkingAcctBal = "", savingsAcctBal = "", soarAcctBal = "", line = ""; //Line number of count int i = 0; //Read the first customer line = inputFile.readLine(); //load the array while (line != null) { //Get each item from the line, stopping at the comma separator StringTokenizer st = new StringTokenizer(l…
has comment: http://stackoverflow.com/comment/43296572
has title: How do I update a line from a text file in JAVA?
tagged with: arrays
has comment: http://stackoverflow.com/comment/43296162
has comment: http://stackoverflow.com/comment/43296281
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/43296413
has answer: http://stackoverflow.com/a/27427991
tagged with: append
tagged with: text-files
has answer: http://stackoverflow.com/a/27427497
tagged with: overwrite
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43297322
has answer: http://stackoverflow.com/a/27428692

http://stackoverflow.com/q/27431633
type: UnansweredQuestion
has title: JProgressBar does not fill all the way
has comment: http://stackoverflow.com/comment/43305170
tagged with: jprogressbar
upvote count: 1
tagged with: swing
has body: I have a JProgressBar which I have set the maximum value to 150. With a javax.swing.Timer, I update the progress bar and increase the time variable by 1. The issue is that once time reaches 100, the progress bar will not update any more and remains in the position shown below: Why does this occur? Is there any way to fix the problem? public class Test { int time = 0, duration = 150; JProgressBar progressBar; Timer timer; public Test() { GridBagLayout layout = new GridBagLayout(); GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.BOTH; JFrame frame = new JFrame(); frame.setLayout(layout); constraints.gridwidth = GridBagConstraints.REMAINDER; timer = new Timer(98, new ActionListener() { public void actionPerformed(ActionEvent ev) { time++; if (time == duration) { time = 0; timer.stop(); } } }); timer.start(); progressBar = new JProgressBar(0,duration); progressBar.setValue(0); progressBar.setStringPainted(false); layout.setConstraints(progressBar,constraints); frame.add(progressBar); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); ProgressBarUpdater pbUpdater = new ProgressBarUpdater(); pbUpdater.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent ev) { progressBar.setValue(time); } }); pbUpdater.execute(); } public static void main(String[] args) { new Test(); } public class ProgressBarUpdater extends SwingWorker&lt;Void,Void&gt; { @Override public Void doInBackground() { setProgress(0); while (time &lt;= duration) setProgress(Math.min(time,duration)); return null; } } }
has comment: http://stackoverflow.com/comment/43305223
has answer: http://stackoverflow.com/a/27432021
score: 1
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43305430
tagged with: swingworker
has comment: http://stackoverflow.com/comment/43305351
downvote count: 0
has comment: http://stackoverflow.com/comment/43305241
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/57427857
type: QuestionComment
comment on: http://stackoverflow.com/q/27408806
score: 0
has text: 5 Million is not many
type: Comment

http://stackoverflow.com/comment/43376851
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27463412
type: Comment
has text: Thanks for the answer. I think it's more of a presentation in the document. I'm just not convinced that detecting a weakly reachable object B that is on a path to another weakly reachable object A via first detecting A is better than just detecting B itself. But I have no idea about the graph algorithm that is used by GC and I think the implementation can choose whatever order it likes, efficient or not.

http://stackoverflow.com/comment/43090979
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27314742
has text: That's for jackson only. see here too http://stackoverflow.com/a/27263560/3496666

http://stackoverflow.com/q/27405402
has title: Android listview - Block in the second activity
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27436709
has comment: http://stackoverflow.com/comment/43264613
favorite count: 0
has comment: http://stackoverflow.com/comment/43260233
has comment: http://stackoverflow.com/comment/43314063
tagged with: android-listview
type: UnansweredQuestion
tagged with: android
score: -1
has comment: http://stackoverflow.com/comment/43259076
has comment: http://stackoverflow.com/comment/43313774
has body: We've made an application for sending text messages in groups but our app crashes at the second activity... If someone can help us, we would be so happy !! :) This is the code : MainActivity.java *package fr.deust.androidproject; **import java.util.ArrayList; 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.CheckBox; import android.widget.CompoundButton; import android.widget.ListView; public class MainActivity extends Activity implements android.widget.CompoundButton.OnCheckedChangeListener { ListView lv; ArrayList&lt;Repertoire&gt; repertoireList; ArrayList&lt;Repertoire&gt; repertoireListSelectect; RepertoireAdapter rpAdapter; private void displayRepertoireList() { repertoireList = new ArrayList&lt;Repertoire&gt;(); repertoireList.add(new Repertoire("Richard NGU LEUBOU", "+33650026569")); repertoireList.add(new Repertoire("Yohan Peloille", "+33642526569")); repertoireList.add(new Repertoire("Colin Garisson", "+336470265691")); repertoireList.add(new Repertoire("Clara Elefant", "+33647026570")); repertoireList.add(new Repertoire("William Henckel", "+33657026567")); repertoireList.add(new Repertoire("Richard NGU LEUBOU", "+33697026563")); repertoireList.add(new Repertoire("Yohan Peloille", "+33647026564")); repertoireList.add(new Repertoire("Colin Garisson", "+33647086561")); repertoireList.add(new Repertoire("Clara Elefant", "+33647026522")); repertoireList.add(new Repertoire("William Henckel", "+33647026555")); rpAdapter = new RepertoireAdapter(repertoireList, this); lv.setAdapter(rpAdapter); } @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { int pos = lv.getPositionForView(buttonView); Repertoire p = repertoireList.get(pos); p.setSelected(isChecked); if (isChecked==true){ repertoireListSelectect.add(p); } else{ repertoireListSelectect.remove(p); } } @Override protected v…
downvote count: 1
type: Question
tagged with: java

http://stackoverflow.com/q/27377993
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/43206283
upvote count: 1
has body: I have two classes : Etudiant and Pays In the database the table Etudiant has a foreign key for the table Pays. In my code I have something like this : List<Etudiant> listEtudiants = (List<Etudiant>) etudiantService.getAll(); for(Etudiant etudiant : listEtudiants) { if(((JTextField)arg0.getSource()).getText().equals(etudiant.getNom())){ System.out.println(etudiant.getPays().getNom()); } } but when I run this code it fails with the exception: org.hibernate.LazyInitializationException: could not initialize proxy - no Session In the line : System.out.println(etudiant.getPays().getNom()); Mapping for Etudiant: <column name="num_insc" /> <generator class="assigned" /> <column name="pays" not-null="true" /> <column name="nom" length="50" not-null="true" /> <column name="prenom" length="50" not-null="true" /> Mapping for Pays: <column name="id" /> <generator class="assigned" /> <column name="nom" length="45" not-null="true" /> <column name="pays" not-null="true" /> <one-to-many class="tp.ihm.domain.Etudiant" /> I tried to remove the fetch attribute in the mapping for Pays, and then to change it's value to eager but nothing works. Could someone please help me with this ? Edit : This is the code for the getAll method : public List getAll() throws EntityNotFoundException { // Get the current session Session s = getSession(); List list = null; // If the BLL layer started a transaction // In this case it is the BLL layer that manages the session and transaction if (anActiveTransactionExist(s)) { list = s.createCriteria(Etudiant).list(); } else { LOGGER.debug("DAO initialize its own transaction"); Transaction tx = null; try { // Starts a transaction locally tx = s.beginTransaction(); list = s.createCriteria(boClass).list(); tx.commit(); } catch (RuntimeException ex) { // Cancel the transaction if there is a problem handleDaoOpError(tx, ex); } finally { closeSession(s); } } if (list == null || list.size() == 0) throw new EntityNotFoundException(); return list; }
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/27102495
has comment: http://stackoverflow.com/comment/43205449
has comment: http://stackoverflow.com/comment/43206260
linked to: http://stackoverflow.com/q/2216547
has comment: http://stackoverflow.com/comment/43205748
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43206464
favorite count: 0
has title: Hibernate org.hibernate.LazyInitializationException: could not initialize
has comment: http://stackoverflow.com/comment/43207461
has answer: http://stackoverflow.com/a/27378905
has comment: http://stackoverflow.com/comment/43205950
score: 1
accepted answer: http://stackoverflow.com/a/27378905
has comment: http://stackoverflow.com/comment/43206141

http://stackoverflow.com/q/27459138
answer count: 2
linked to: http://stackoverflow.com/q/3871984
has body: I'm making a date extractor using regex in java. Problem is that date is 20-05-2014 and my program is extracting 0-5-14. In short, how can I get the character on which I'm checking the second character of date? int count = 0; String data = "HellowRoldsThisis20-05-2014. farhan_rock@gmail.comHellowRoldsThisis.farhan@gmail.com"; String regexOfDate = "((?&lt;=[0])[1-9]{2})|((?&lt;=[12])[0-9])|((?&lt;=[3])[01])\\.\\-\\_((?&lt;=[0])[1-9])|((?&lt;=[1])[0-2])\\.\\-\\_((?&lt;=[2])[0-9]{4})"; \\THE PROBLEM String[] extractedDate = new String[1000]; Pattern patternDate = Pattern.compile(regexOfDate); Matcher matcherDate = patternDate.matcher(data); while(matcherDate.find()){ System.out.println("Date "+count+"Start: "+matcherDate.start()); System.out.println("Date "+count+"End : "+matcherDate.end()); extractedDate[count] = data.substring(matcherDate.start(), matcherDate.end()); System.out.println("Date Extracted: "+extractedDate[count]); }
downvote count: 0
favorite count: 0
has title: Regex: How to include character of "if" condition
has answer: http://stackoverflow.com/a/27459320
upvote count: 2
has answer: http://stackoverflow.com/a/27461305
tagged with: regex
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27461305
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27459320

http://stackoverflow.com/a/27399271
has comment: http://stackoverflow.com/comment/43256486
has comment: http://stackoverflow.com/comment/43244513
score: 0
has body: In the tab of Servers, make a full publish of your project. Even if you save it, you have to publish it into your server. It's a bit annoying the fact of having to publish everytime you make a small change, but is the way to deploy the .war into the server. If that doesn't work, try to delete the server and configure a new one. Have a nice code!
type: Answer
has comment: http://stackoverflow.com/comment/43246482
answers question: http://stackoverflow.com/q/27398584
has comment: http://stackoverflow.com/comment/43244382

http://stackoverflow.com/q/27398158
tagged with: jcs
has comment: http://stackoverflow.com/comment/43242316
answer count: 1
has comment: http://stackoverflow.com/comment/43242249
score: 0
has comment: http://stackoverflow.com/comment/43242223
has body: We are writing a test framework and we want to maintain a data structure for storing objects at suite level, objects vary from int to slf4j Logger. I am not clear as which data structure to use, which is more effective.
tagged with: testng
has comment: http://stackoverflow.com/comment/43242964
has answer: http://stackoverflow.com/a/27398327
type: UnansweredQuestion
tagged with: collections
has comment: http://stackoverflow.com/comment/43242447
tagged with: java
has comment: http://stackoverflow.com/comment/43242101
has title: JCS or java.util.Map, which is efficient in terms of time?
type: Question
has comment: http://stackoverflow.com/comment/43242138

http://stackoverflow.com/q/27441142
has title: Java: Other possible forms for return statement
has answer: http://stackoverflow.com/a/27441197
has comment: http://stackoverflow.com/comment/43322466
has answer: http://stackoverflow.com/a/27441206
type: AnsweredQuestion
tagged with: return
upvote count: 3
has answer: http://stackoverflow.com/a/27441762
has comment: http://stackoverflow.com/comment/43321928
type: Question
score: 3
has comment: http://stackoverflow.com/comment/43323402
tagged with: postfix-operator
accepted answer: http://stackoverflow.com/a/27441197
tagged with: java
has body: Suppose I wish to return tos = tos-2, than how can the code be modified? int pop() { System.out.print("tos = " +tos+" "); if (tos&lt;0) { System.out.println("Stack limit reached .. UNDERFLOW"); return 0;} else { return stck[tos--]; } }
downvote count: 0
has answer: http://stackoverflow.com/a/27442011
favorite count: 0
has answer: http://stackoverflow.com/a/27441202
answer count: 5
has comment: http://stackoverflow.com/comment/43322480
possible better answer: http://stackoverflow.com/a/27441206
has comment: http://stackoverflow.com/comment/43322413
has comment: http://stackoverflow.com/comment/43322159

http://stackoverflow.com/q/27376032
tagged with: eclipse
type: Question
has body: I created a plugin which reads the file of format UTF-8 and displays it in a label. If I run the Eclipse plugin project through runconfiguration -> changing the encoding to UTF-8, it is working fine by displaying the special characters also. But when I created a plugin and installed it on Eclipse, it is choosing the default encoding type and not displaying the special characters properly. How can I make my plugin always run in UTF-8 encoding after packaging it into the plugin? Here is my code to read a file: File file = new File("D:\\StringFile.txt"); String Message = ""; try { if (file.exists()) { BufferedReader in = new BufferedReader( new FileReader(file)); String str; System.out.println("File found"); while ((str = in.readLine()) != null) { if (str.contains("GER")) { Message = str.split(" : ")[1]; System.out.println("Message -- " + Message); } } } } catch (IOException e) { e.printStackTrace(); } Label message = new Label(dialog, SWT.LEFT); ... message.setText(Message);
answer count: 1
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/43202054
score: 0
tagged with: utf-8
has title: How to define UTF-8 encoding for Eclipse Plugin Project
has comment: http://stackoverflow.com/comment/43202725
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27376850
tagged with: java

http://stackoverflow.com/comment/43170255
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27359030
score: 0
has text: `Arraylist` is not the same as `ArrayList` (note the upper L). Java is case sensitive.

keystroke
type: Tag
tags question: http://stackoverflow.com/q/27470324
tag name: keystroke

http://stackoverflow.com/q/27385370
tagged with: aes
tagged with: plaintext
upvote count: 0
tagged with: encryption
has comment: http://stackoverflow.com/comment/43219221
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/7360403
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/27385763
accepted answer: http://stackoverflow.com/a/27385763
has comment: http://stackoverflow.com/comment/43219122
type: Question
has body: Hi I'm trying to create an encrypt/decrypt app in java for a project and I managed to do the encrypt decrypt in the same class however I need two separate classes one for encrypt and one for decrypt, but I've been getting this error (Instead of printing the message I initially encrypted) and I'm not sure what I need to do to make it work. Without separating the code into classes:- import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.util.Scanner; import javax.crypto.BadPaddingException; import javax.crypto.Cipher; import javax.crypto.IllegalBlockSizeException; import javax.crypto.KeyGenerator; import javax.crypto.NoSuchPaddingException; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; public class Encrypt1 { public static void main(String[] argv) { try{ //KeyGenerator keygenerator = KeyGenerator.getInstance("AES"); //SecretKey myAesKey = keygenerator.generateKey(key); Scanner input = new Scanner(System.in); System.out.println("Please enter a message you'd like to encrypt"); String plaintext = input.nextLine(); System.out.println("Please enter a 16 digit password: "); String pass = input.nextLine(); byte[] key = pass.getBytes(); SecretKeySpec aesKey = new SecretKeySpec(key, "AES"); Cipher aesCipher; // Create the cipher aesCipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); // Initialize the cipher for encryption aesCipher.init(Cipher.ENCRYPT_MODE, aesKey); //sensitive information byte[] text = plaintext.getBytes(); System.out.println("Text [Byte Format] : " + text); System.out.println("Text : " + new String(text)); // Encrypt the text byte[] textEncrypted = aesCipher.doFinal(text); System.out.println("Text Encryted : " + textEncrypted); // Initialize the same cipher for decryption aesCipher.init(Cipher.DECRYPT_MODE, aesKey); // Decrypt the text byte[] textDecrypted = aesCipher.doFinal(textEncrypted); System.out.println("Text Decryted : " + new String(textDecrypted)); }catch(NoSuchAlgorithmExcepti…
downvote count: 2
has title: Encryption algorithm app android
answer count: 1
favorite count: 0
tagged with: android

http://stackoverflow.com/comment/51626620
type: AnswerComment
comment on: http://stackoverflow.com/a/27389390
score: 0
type: Comment
has text: If you have found a solution, can you please share it ?

http://stackoverflow.com/q/27441374
has title: JPA without Facade interfaces or DAO interfaces
tagged with: jpa
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43322374
has body: I am looking this example JPA implementation using Jdeveloper. https://weblogs.java.net/blog/bleonard/archive/2013/08/30/exposing-jpa-entities-restful-web-services-oracle-cloud Wondering why interface DAO classes or Facade interfaces are not used. What is the real reason for interface classes and then implementation classes which implements interfaces. Appreciate any help.
score: 1
favorite count: 0
tagged with: ejb-3.0
has comment: http://stackoverflow.com/comment/43322894
type: Question
tagged with: interface
upvote count: 1
has comment: http://stackoverflow.com/comment/43322461
tagged with: java
tagged with: facade

http://stackoverflow.com/a/27397033
type: Answer
answers question: http://stackoverflow.com/q/27396819
has body: I'd try it with a RegEx I'm not familiar with Java but according to http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html the \s regex exists. So A simple regex could be something like \s{2,} or with slashes to indicate the start and ending / \s{2,}/ this will get you all double whitespaces. You then simply have to replace it with a single whitespace. Edit: It seams that you'd have to escape a backslash too in Java so use \\s{2,} as your regex (http://ocpsoft.org/opensource/guide-to-regular-expressions-in-java-part-1/)
score: 0

http://stackoverflow.com/comment/43206401
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27378393
type: AnswerComment
has text: when i converted some kb of xlsx to csv it got converted but when i tried for 3 mb size file it giving this exception

http://stackoverflow.com/comment/43093830
has text: Also whether you use a worded name ("After") or numeric ("1234"), doesn't matter. I just used a number as is more common with database ids. Look in your browser, in the URL. You should see `http://stackoverflow.com/questions/27314049`. `27314049` is most likely the database id for this question. Name are common, and there are many duplicates, that's why name database ids are no good. In incrementing number might be better.
comment on: http://stackoverflow.com/a/27315641
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/27460652
downvote count: 0
has comment: http://stackoverflow.com/comment/43357801
score: 3
has comment: http://stackoverflow.com/comment/43357856
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27460556
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27460556
has body: You may try with @ModelAttribute (Visit ModelAttribute question in SO to get clear understanding about it) @RequestMapping(value = "/save", method = RequestMethod.POST) public String save(@ModelAttribute("employeeDTO") EmployeeDTO employeeDTO){ return "saved"; } I used this in spring mvc 3.1
type: Answer

http://stackoverflow.com/a/41774655
upvote count: 11
score: 11
answers question: http://stackoverflow.com/q/27402716
has body: I was having this same issue. For me, it had to do with encoding the string. I ended up doing: Get ASCII bytes from string you want to encrypt (UTF-8 in your case) Encrypt bytes Encode bytes in Base64 string Then to decrypt string I did: Decode encrypted string to Base64 bytes Decrypt Base64 bytes Create new string using ASCII. Here is the code : private String encrypt(String src) { byte[] srcBytes = src.getBytes(StandardCharsets.US_ASCII); cipher.init(Cipher.ENCRYPT_MODE, secretKey, secureRandom); byte[] cipherText = cipher.doFinal(srcBytes); byte[] encryptedBytes = new byte[12 + cipherText.length]; System.arraycopy(ivBytes, 0, encryptedBytes, 0, 12); System.arraycopy(cipherText, 0, encryptedBytes, 12, cipherText.length); return Base64.encodeToString(encryptedBytes, Base64.DEFAULT); } private String decrypt(String encryptedString) { byte[] encryptedBytes = Base64.decode(encryptedString, Base64.DEFAULT); cipher.init(Cipher.DECRYPT_MODE, secretKey, new GCMParameterSpec(128, encryptedBytes, 0, 12)); byte[] decryptedBytes = cipher.doFinal(encryptedBytes, 12, encryptedBytes.length-12); return Base64.encodeToString(decryptedBytes, Base64.DEFAULT); } Any variables I didn't include how to initialize them can be inferred from the java docs. I was trying to do this in Android so I'm not sure how different it is. I found this post to be incredibly helpful: Java AES/GCM/NoPadding - What is cipher.getIV() giving me?
has comment: http://stackoverflow.com/comment/88124853
downvote count: 0
has comment: http://stackoverflow.com/comment/88119009
type: Answer

http://stackoverflow.com/comment/43322861
type: Comment
type: QuestionComment
has text: @Hichamov Actually, it's more of avoiding to write another .java file.
comment on: http://stackoverflow.com/q/27441576
score: 0

http://stackoverflow.com/comment/43221795
comment on: http://stackoverflow.com/a/27386663
has text: I think your code works only for storing uniformly typed objects in the map. What if I wanted a Msg object that can store heterogeneous types? I am not worried much about type safety, but wanted a generic container.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27390977
has comment: http://stackoverflow.com/comment/43230407
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27390672
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27390672
has body: There's no difference in effect between your two snippets. Think of any variable (other than one of a primitive type) as being a label for an object, rather like a little post-it note. You create the label, you stick it on an object, and you can move it to another object if you like. You can even set a variable to null, which means it's not stuck to an object at all. The code new ArrayList&lt;&gt;() creates a new object. Your code in the second snippet puts a label (variable) on that object, but immediately moves the label to an entirely different object. This makes the original ArrayList completely irrelevant. After either one of your snippets, the variable divElements will be stuck to the object that was returned by the findElements method.
upvote count: 2

http://stackoverflow.com/comment/43098765
comment on: http://stackoverflow.com/a/27318529
type: AnswerComment
score: 0
has text: should I add this `@XmlSeeAlso`for each class type that I might use in the list of books? Thanks!
type: Comment

http://stackoverflow.com/a/54457614
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/27440155
upvote count: 3
type: Answer
has body: To understand the performance of this, you need to understand how regular expressions work. They are much more sophisticated than Java "contains" which can have quadratic performance with respect to the string in the worst case. Regular expressions compile down to a graph which you traverse with every character from the input string. That means, if you have multiple words and construct a proper regex statement, you can get much better performance if you craft your regex correctly or use a regex optimiser (eg. https://www.dcode.fr/regular-expression-simplificator). I'm not sure if Java optimises your regex out of the box. Here is a visual example of a correctly compiled regex graph.

http://stackoverflow.com/a/27457065
upvote count: 1
has comment: http://stackoverflow.com/comment/43359379
downvote count: 0
type: Answer
has body: I think your solution is prettiest as possible. Or maybe you could describe in details what does it mean for you elegance?
answers question: http://stackoverflow.com/q/27452209
score: 1

http://stackoverflow.com/q/27339988
type: AnsweredQuestion
score: 1
upvote count: 1
tagged with: swing
type: Question
accepted answer: http://stackoverflow.com/a/27340039
tagged with: java
has answer: http://stackoverflow.com/a/27340004
answer count: 2
possible better answer: http://stackoverflow.com/a/27340004
downvote count: 0
has title: Pressing Yes/No on embedded JOptionPane has no effect
favorite count: 0
tagged with: jdialog
has answer: http://stackoverflow.com/a/27340039
has body: I'm trying to add an exit confirmation check to JFrame but I want the dialog to be undecorated. I've figured I need to use custom JDialog and custom JOptionPane. frame.addWindowListener(new java.awt.event.WindowAdapter() { @Override public void windowClosing(java.awt.event.WindowEvent windowEvent) { JDialog dialog = new JDialog(); dialog.setUndecorated(true); JOptionPane pane = new JOptionPane("Are you sure that you want to exit?", JOptionPane.QUESTION_MESSAGE,JOptionPane.YES_NO_OPTION); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); //I don't even know if this line does anything dialog.setContentPane(pane); dialog.pack(); dialog.setLocationRelativeTo(frame); dialog.setVisible(true); System.out.println("Next Line"); //this line does not work. } }); The dialog appears exactly as I wanted but clicking yes or no does nothing. Dialog does not disappear and I couldn't find a way to check which button is clicked. "Next Line" is never printed to console .
tagged with: joptionpane

http://stackoverflow.com/comment/43101064
has text: when you are working with blocking streams, you need to use _separate threads_ for reading and writing.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27320870
score: 1

http://stackoverflow.com/q/27319524
has comment: http://stackoverflow.com/comment/43108159
has comment: http://stackoverflow.com/comment/43099062
has comment: http://stackoverflow.com/comment/43110606
has comment: http://stackoverflow.com/comment/43098469
tagged with: servlets
score: 0
has comment: http://stackoverflow.com/comment/43110357
answer count: 2
tagged with: tomcat
has comment: http://stackoverflow.com/comment/43098403
has comment: http://stackoverflow.com/comment/43109202
possible better answer: http://stackoverflow.com/a/27319986
has comment: http://stackoverflow.com/comment/43110307
has answer: http://stackoverflow.com/a/27319986
has title: How to diagnose a "resource is not available" error Apache Tomcat?
has comment: http://stackoverflow.com/comment/43109521
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27320036
has comment: http://stackoverflow.com/comment/43107846
has comment: http://stackoverflow.com/comment/43098838
tagged with: java
has comment: http://stackoverflow.com/comment/43098308
has comment: http://stackoverflow.com/comment/43110186
has body: I'm trying to set up a servlet that shows a simple HTML page but when I run the apache server I get the below error although the file is located in the project. Does anyone know how I can diagnose the problem? I don't see any stack trace or error list as usual with a java application The web.xnl file declaration: <?xml version="1.0" encoding="UTF-8"?> Hello HelloWorld Hello /HelloServlet Home.jsp This is the example I'm following: http://met.guc.edu.eg/OnlineTutorials/JSP%20-%20Servlets/A%20servlet%20example.aspx
type: Question
has answer: http://stackoverflow.com/a/27320036

http://stackoverflow.com/comment/43207863
comment on: http://stackoverflow.com/q/27373703
type: Comment
type: QuestionComment
score: 0
has text: I also think you need to post the whole code. It could hang inside releaseConnection, or somewhere in your ... part.

http://stackoverflow.com/q/27347299
upvote count: 1
tagged with: reference
favorite count: 0
has comment: http://stackoverflow.com/comment/43149367
has body: Possible Duplicate : Is Java “pass-by-reference” or “pass-by-value”? i am trying to do initialization of an array in this way - class Main { public static void main(String[] args) { int n = 4; int[] s = null; int[] f = null; init(n, s, f); System.out.println(s.length); } public static void init(int n, int[] s, int[] f) { s = new int[n]; f = new int[n]; } } but i am getting NullPointerException for the s.length. so this clear passing the parameter to another method is pass by value. therefor objects are not initialize. but when i do swap in to value in a different method then this is working. like - class Main { public static void main(String[] args) { int n = 4; int[] s = new int[n]; int[] f = new int[n]; s[0] = 10; f[0] = 20; System.out.println(s[0] + " " + f[0]); swap(s, f); System.out.println(s[0] + " " + f[0]); } public static void swap(int[] s, int[] f) { int t = s[0]; s[0] = f[0]; f[0] = t; } } on the other hand this isn't swap values. class Main { public static void main(String[] args) { Integer a = 10; Integer b = 20; swap(a , b); System.out.println(a + " " + b); } public static void swap(Integer a, Integer b) { int t = a; a = b; b = t; } } therefor i need some explanation whether java “pass-by-reference” or “pass-by-value”? this explanation could help me to understand why it is not possible to create object in another method. sorry for my bad English. thanks in advance.
has comment: http://stackoverflow.com/comment/43149371
has answer: http://stackoverflow.com/a/27347333
accepted answer: http://stackoverflow.com/a/27347333
linked to: http://stackoverflow.com/q/40480
tagged with: pass-by-reference
tagged with: object
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: methods
type: Question
answer count: 1
downvote count: 0
has title: Why it is not possible to create object of a reference in another method in java?

http://stackoverflow.com/comment/43211784
score: 2
comment on: http://stackoverflow.com/q/27381523
has text: What do you mean by "breaks"? If you mean there's a compile-time error, please include that in the question.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27369840
has answer: http://stackoverflow.com/a/27372022
has comment: http://stackoverflow.com/comment/43191658
has answer: http://stackoverflow.com/a/27371308
type: Question
score: 1
tagged with: java
has body: I'm trying to pass a value input to a textbox in a JSP page to a servlet that will store the value as a variable. But when I click the submit button the servlet isn't found. I get an error stating the requested resource is not available Servlet Class: //parse input from hello.jsp input box //and assign to fibNum variable @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // TODO Auto-generated method stub } } I've looked at some questions like this: <form action="/sampleServlet" giving me exception but changing the path didn't change the outcome. Does anyone know how to fix this problem calling of a servlet? Or is there a step I'm missing in linking up the servlet? Also this is the structure of my project tree:
has answer: http://stackoverflow.com/a/27371501
tagged with: servlets
linked to: http://stackoverflow.com/q/8198312
upvote count: 1
accepted answer: http://stackoverflow.com/a/27369932
tagged with: jsp
favorite count: 0
possible better answer: http://stackoverflow.com/a/27371308
linked to: http://stackoverflow.com/q/16683877
answer count: 5
has answer: http://stackoverflow.com/a/27369932
has title: Calling servlet from a JSP page's form action
has answer: http://stackoverflow.com/a/70658784
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/43191534

http://stackoverflow.com/comment/43119297
has text: Thank you. Didn't realize my silly mistake. I had declared "Pattern pattern" earlier and assumed compile was all I need to call afterwards.
type: AnswerComment
comment on: http://stackoverflow.com/a/27330698
score: 0
type: Comment

http://stackoverflow.com/a/40076750
answers question: http://stackoverflow.com/q/27316983
type: Answer
downvote count: 0
score: 1
has body: I agree with @Chris Pheby, you can fix it by upgrading Jadira version to 5.0.0.GA
upvote count: 1

http://stackoverflow.com/q/27314566
has comment: http://stackoverflow.com/comment/43089260
answer count: 1
has title: Spring JDBC & Oracle DB 12c: java.sql.SQLException: Invalid column type. Why?
tagged with: oracle12c
has answer: http://stackoverflow.com/a/27314838
tagged with: spring-jdbc
has body: I'm struggling with following exception: org.springframework.jdbc.UncategorizedSQLException: PreparedStatementCallback; uncategorized SQLException for SQL [update EVALUATION_SHEET set STATUS=?, LAST_EDITED=? where id=?]; SQL state [99999]; error code [17004]; Invalid column type; nested exception is java.sql.SQLException: Invalid column type Which is thrown here: jdbcTemplate.update("update E_SHEET set STATUS=?, LAST_EDITED=? where id=?", new Object[]{eSheet.getStatus().ordinal(), eSheet.getLastEditDate(), eSheet.getId()}, new Object[]{OracleTypes.NUMBER, OracleTypes.TIMESTAMP, OracleTypes.NUMBER}); The database table is created as follows: create table E_SHEET ( ID number not null unique, ID_POSITION number not null, STATUS number default 0 not null, ID_EXAMINER number not null, LAST_EDITED timestamp not null); I have no idea what is causing the problem. This method: eSheet.getLastEditDate() returns java.util.Date object. I am using Spring JDBC template with Spring Boot and Oracle DB 12c as a datasource.
tagged with: spring
has comment: http://stackoverflow.com/comment/43089237
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27314838
tagged with: spring-boot
tagged with: java
type: Question
score: 0

http://stackoverflow.com/q/27462383
has comment: http://stackoverflow.com/comment/43361956
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43361177
has comment: http://stackoverflow.com/comment/43361155
tagged with: http://stackoverflow.com/tag/xml
tagged with: netbeans
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/27462659
has comment: http://stackoverflow.com/comment/43361114
tagged with: java
has comment: http://stackoverflow.com/comment/43361725
has title: Assigning XML to .Java using java.R
has comment: http://stackoverflow.com/comment/43361332
type: Question
has body: so i'm working on an android web service app and have a java class called BookDetails.java located in the source packages and an Xml file named info.xml in the layout folder but when i implement setContentView(R.layout.info); i get an error saying cannot find symbol I feel as though im being an idiot not seeing how to fix this.

http://stackoverflow.com/q/27377412
answer count: 2
has answer: http://stackoverflow.com/a/27377714
tagged with: jsp
has answer: http://stackoverflow.com/a/27377719
tagged with: ajax
has body: I have a JSP page which receives a list from a servlet and displays it using JSTL.I want to send the request using ajax. How to get the list from the servlet and display using using ajax now. part of jsp page without ajax Screen Screen1 //remaining code here <c:forEach items="${statusdisplay}" var="statuslist"> Screen Total Seats A Total Seats B Show Class A Price Class B Price Start Time End Time //remaining code code Here is my servlet code request.setAttribute("statusdisplay", statuslist); RequestDispatcher requestdispatcher=request.getRequestDispatcher("/Status.jsp"); requestdispatcher.forward(request,response); how to send the form data to servlet using ajax and display the received arraylist using ajax and jstl.
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27377719
type: Question
linked to: http://stackoverflow.com/q/5414600
tagged with: jstl
has title: Ajax to display arraylist from the servlet in jsp
tagged with: servlets
possible better answer: http://stackoverflow.com/a/27377714
score: 0

late-binding
type: Tag
tags question: http://stackoverflow.com/q/27436200
tag name: late-binding

http://stackoverflow.com/comment/43139008
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27341612
has text: store the Couple objects in another Vector and put it in the Map outside while (entries.hasNext()) {...} this loop

http://stackoverflow.com/q/27465478
has comment: http://stackoverflow.com/comment/43367128
has comment: http://stackoverflow.com/comment/43367969
has comment: http://stackoverflow.com/comment/43367217
score: 2
downvote count: 0
tagged with: file
has body: I've made this method that goes through and finds every file inside a given directory, it then checks if it meets the requirements of a FileFilter and returns all the files that do in an array List. public static ArrayList&lt;File&gt; listFiles(File dir, FileFilter filter) { ArrayList&lt;File&gt; files = new ArrayList&lt;File&gt;(); if (filter == null) files = listFiles(dir, files); else files = listFiles(dir, filter, files); return files; } private static ArrayList&lt;File&gt; listFiles(File dir, ArrayList&lt;File&gt; files, FileFilter filter) { if (!dir.isDirectory() || !dir.exists()) return null; for (File file : dir.listFiles()) { System.out.println(file); if (filter.accept(file)) files.add(file); listFiles(file, filter, files); } return files; } but for some reason, it returns some files more than once... (this is a call to the top method, which then calls the bottom method, I'm not posting the version without the fileFilter because it fails in the exact same way. If you want to know the difference then just disregard the 'if (filter.accept(file))' statement. ArrayList&lt;File&gt; files = listFiles(new File("Notes"), new DirectoryFilter()); when I pass the above argument through, i get this in return Notes/JavaNotes Notes/JavaNotes/java Notes/JavaNotes/java/io Notes/JavaNotes/java/io/File Notes/JavaNotes/java/io/IOException Notes/JavaNotes/java/util Notes/JavaNotes/java/util/ArrayList Notes/JavaNotes/javax Notes/JavaNotes/javax/swing Notes/JavaNotes/javax/swing/JFrame Notes/JavaNotes Notes/JavaNotes/java Notes/JavaNotes/java/io Notes/JavaNotes/java/io/File The last four files are duplicates of the first four files. it is failing predictably too, only the first 4 line of files is added twice (so if there were only 2 files in a line before that directory hit an end then only 2 files would be duplicated). the directoryFilter is the reason why there is no actual .txt files in the results.
type: Question
has answer: http://stackoverflow.com/a/27465948
accepted answer: http://stackoverflow.com/a/27465948
tagged with: recursion
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43367294
tagged with: java
tagged with: duplicates
upvote count: 2
has title: recursive file list check is returning duplicates
answer count: 1
favorite count: 0

http://stackoverflow.com/comment/43140338
score: 0
comment on: http://stackoverflow.com/q/27342121
type: Comment
type: QuestionComment
has text: Try refreshing the project. Maybe your bytecodes doesn't correspond to your code if you didn't refresh.

http://stackoverflow.com/a/27395714
type: Answer
upvote count: 1
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27395684
has body: That Exception is telling you that the session attribute count is an Integer in the session. You could cast it to an Integer and let Java unbox it for you like, int count = (Integer) request.getSession().getAttribute("count"); Or (if you want to use it as a String) like, String counter = request.getSession().getAttribute("count").toString();

shared-secret
tag name: shared-secret
type: Tag
tags question: http://stackoverflow.com/q/27389249

http://stackoverflow.com/q/27325720
has body: I am working on a graphics project from university. I am trying to use the fillRect method from the java graphics class. The problem is the method takes in integer values: fillRect(int x, int y, int width, int height) I really need it to take in decimal values like double instead of integers. Is it even possible or is there a sneaky way to get pass this? Thanks
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43110631
type: Question
has title: Java Graphics fillrec() method with double parameters
tagged with: graphics
has answer: http://stackoverflow.com/a/27325761
answer count: 1
accepted answer: http://stackoverflow.com/a/27325761
type: AnsweredQuestion

http://stackoverflow.com/comment/43382378
has text: I was thinking how do I do this in the most efficient way and ended up uploading the whole project. I hope this helps to understand my problem: https://drive.google.com/folderview?id=0B2wRQ2r2rQGhbHotTU51WTFwWWc&usp=sharing
type: Comment
comment on: http://stackoverflow.com/a/27473561
score: 0
type: AnswerComment

http://stackoverflow.com/q/27350304
favorite count: 0
has answer: http://stackoverflow.com/a/27350337
type: UnansweredQuestion
has title: Java repaint doesn't update
tagged with: repaint
score: 1
tagged with: java
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43155083
has comment: http://stackoverflow.com/comment/43156293
answer count: 2
has body: I encountered a problem when I was coding, When I call repaint anywhere, it doesn't update the image but the program still keeps running: import java.applet.*; import java.awt.*; import java.awt.event.*; import java.awt.image.ImageObserver; import java.util.Random; import javax.swing.JFrame; import javax.swing.JPanel; public class mainMenu extends JPanel implements MouseListener{ Graphics g; Image playButton = Toolkit.getDefaultToolkit().getImage("game sprites/play_button.png"); private int part = 0; public static void main(String[] a) { mainMenu mm = new mainMenu(); mm.makeJFrame(); } public void makeJFrame(){ JFrame f = new JFrame(); f.setSize(1000, 600); f.add(new mainMenu()); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); f.addMouseListener(this); f.setTitle("MAIN MENU"); } public void paintComponent(Graphics g) { if(part == 0) System.out.println("0"); g.drawImage( playButton, 330, 200, 294, 102, this); if(part == 1) { System.out.println("1"); g.setColor(Color.RED); g.fillRect(0, 0, 40, 40); } } public void mouseClicked(MouseEvent e) {} public void mouseEntered(MouseEvent e) {} public void mouseExited(MouseEvent e) {} public void mousePressed(MouseEvent e) { int x = e.getX(); int y = e.getY(); if(part == 0) { if(x &gt; 330 &amp;&amp; x &lt; 624 &amp;&amp; y &gt; 232 &amp;&amp; y &lt; 334) { System.out.println("a"); part = 1; repaint(); } } } public void mouseReleased(MouseEvent e) {} } I tested lots of times, and the problem is with the repaint, the program works, but the image stays the same when it shouldn't. It prints out: 0 0 0 a (when I click on the button) and doesn't print out "a" again even if I click on the button, which it shouldn't since part is set to 1.
downvote count: 0
has answer: http://stackoverflow.com/a/27350342
tagged with: awt

http://stackoverflow.com/q/27332255
has answer: http://stackoverflow.com/a/27332272
accepted answer: http://stackoverflow.com/a/27332272
favorite count: 0
tagged with: interface
type: AnsweredQuestion
tagged with: java
has body: In both the JLS and JVM spec there is language that refers to direct superinterfaces of a class. This notion of a direct superinterface of a class is confusing, because a class cannot extend an interface. For example, from Section 9 of the JLS: A class necessarily implements all the interfaces that its direct superclasses and direct superinterfaces do. From section 5.4.3.2 of the JVM spec: Otherwise, field lookup is applied recursively to the direct superinterfaces of the specified class or interface C. Although, in section 9.1.3 of the JLS, the definition of direct superinterface is given as If an extends clause is provided, then the interface being declared extends each of the other named interfaces and therefore inherits the member types, methods, and constants of each of the other named interfaces. These other named interfaces are the direct superinterfaces of the interface being declared. And rigorously stated as Given a (possibly generic) interface declaration for I (n ≥ 0), the direct superinterfaces of the interface type I are the types given in the extends clause of the declaration of I if an extends clause is present. In both of these definitions, the notion of a direct superinterface is applied to the Interface type, not the class type. So what is meant by direct superinterfaces of a class?
type: Question
has title: What is meant by "direct superinterface" of a class?
has comment: http://stackoverflow.com/comment/43122143
score: 0
upvote count: 1
answer count: 1
downvote count: 1

http://stackoverflow.com/q/27460541
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/43358802
type: Question
tagged with: pdfbox
answer count: 1
has body: I'm trying to convert PDF pages to BufferedImage instances using the Apache PDFBox library. Why is the following code not working? try { PDDocument doc = PDDocument.load(pdfFile); // pdfFile is file path to pdf List&lt;PDPage&gt; pgeLst = document.getDocumentCatalog().getAllPages(); for(PDPage pge : pgeLst) { final PDRectangle mediaBox = pge.getMediaBox(); mediaBox.setUpperRightX(mediaBox.getUpperRightX() * scale); mediaBox.setUpperRightY(mediaBox.getUpperRightY() * scale); BufferedImage img = page.convertToImage(); // Image should now be scaled, // but isn't. } } catch(Exception e) { e.printStackTrace(); } Maybe the solution is very easy, though I searched the web and the JavaDoc and didn't find any solution. I'm using PDFBox version 1.8.8, precisely pdfbox-app-1.8.8.jar. Thank you Tilman Hausherr for pointing that out :) Thanks in advance :)
downvote count: 0
has comment: http://stackoverflow.com/comment/43393847
favorite count: 0
has title: Scaling a PDF page using PDFBox
has answer: http://stackoverflow.com/a/27461254
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27461254
has comment: http://stackoverflow.com/comment/43395231
score: 1

http://stackoverflow.com/q/27371131
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/43193747
score: 2
upvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/43193874
tagged with: android-fragments
tagged with: java
tagged with: listview
has comment: http://stackoverflow.com/comment/43194018
has comment: http://stackoverflow.com/comment/43193813
downvote count: 0
answer count: 1
has title: Not Displaying Listview in Fragment extended Class
favorite count: 0
has answer: http://stackoverflow.com/a/27371229
has body: I follow androidhive tutorials and i want to combine fragment with listview activity. First i am so so new in android. Forgive me if i make mistake. The code goes like this, slidemenu draw using Fragment classes and i cannot change the extend class as a ListFragment. I want to have a listview in each Fragment in drawer. Thanks u so much for helping me. this is Fragment Class public class FindPeopleFragment extends Fragment { public FindPeopleFragment(){} @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_find_people, container, false); return rootView; } } This is xml file. &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;!-- Single List Item Design --&gt; &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/label" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dip" android:textSize="16dip" android:textStyle="bold" &gt; &lt;/TextView&gt; this is creating listview class. public class FindPeopleList extends ListActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // storing string resources into Array String[] list_people = getResources().getStringArray(R.array.list_people); // Binding Array to ListAdapter this.setListAdapter(new ArrayAdapter&lt;String&gt;(this, R.layout.fragment_find_people, R.id.label, list_people)); } } Main_Activity Class. the fragment classes are used. private void displayView(int position) { // update the main content by replacing fragments Fragment fragment = null; switch (position) { case 0: fragment = new HomeFragment(); break; case 1: fragment = new FindPeopleFragment(); break; default: break; } if (fragment != null) { FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.frame_container, fragment).commit(); // update selected item and title, then close…
tagged with: android-listview

http://stackoverflow.com/q/27465714
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27465741
answer count: 1
tagged with: user-interface
downvote count: 0
has body: I need a little help on java temperature conversion GUI so here is my code for result public class ResultsPanel extends JPanel { private JLabel result; private JPanel panel; final int WIDTH_CONST=120; final int HEIGHT_CONST=60; public ResultsPanel() { setPreferredSize(new Dimension(WIDTH_CONST, HEIGHT_CONST)); setBorder(BorderFactory.createTitledBorder("Result")); result = new JLabel(); add(result); } public void setResultLabel(String str) { result.setText(str); } public void setResultLabel() { result.setText(""); } } so what I'm trying to do is, that when i click on the convert button i want to label the result and here is my button handler class: private class ConvertButtonHandler implements ActionListener { public void actionPerformed (ActionEvent e) { //calculate and convert temperatures //convert the temperature into String ResultsPanel result = new ResultsPanel(); String temp; // temperature in string result.setResultLabel(temp); } } but it doesn't seem like it's printing out the result, any help appreciated, thanks update : here is my tempGUI class: public class TempGUI extends JFrame { private BannerPanel banner; private TypePanel type; private TemperaturePanel temperature; private ResultsPanel results; private JPanel buttonPanel; private JButton convert; private JButton clear; private JButton exit; public TempGUI() { setTitle("Temperature Concverter GUI"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new BorderLayout()); banner = new BannerPanel(); type = new TypePanel(); temperature = new TemperaturePanel(); results = new ResultsPanel(); buildButtonPanel(); add(banner, BorderLayout.NORTH); add(type, BorderLayout.WEST); add(temperature, BorderLayout.CENTER); add(results, BorderLayout.EAST); add(buttonPanel, BorderLayout.SOUTH); pack(); setVisible(true); } public void buildButtonPanel() { buttonPanel = new JPanel(); convert = new JButton("Convert"); clear = new JButton("Clear"); exit = new JButton("Exit"); convert.addActionListener(new ConvertBu…
favorite count: 0
has answer: http://stackoverflow.com/a/27465741
tagged with: jlabel
upvote count: 1
type: Question
type: AnsweredQuestion
has title: java GUI JLabel

event-handling
tag name: event-handling
tags question: http://stackoverflow.com/q/27344947
tags question: http://stackoverflow.com/q/27322260
type: Tag
tags question: http://stackoverflow.com/q/27410671

http://stackoverflow.com/q/27362159
possible better answer: http://stackoverflow.com/a/27362321
tagged with: excel
type: Question
has answer: http://stackoverflow.com/a/27362321
accepted answer: http://stackoverflow.com/a/27362276
score: 1
tagged with: java
has title: export CSV with Hebrew char that can be opened by Excel
answer count: 2
downvote count: 0
favorite count: 0
has body: I know there is a lot of similar question but I still cannot find a solution, my code: resp.setContentType("text/csv; charset=UTF-8"); resp.addHeader("Content-Disposition", "attachment; filename=file.csv"); resp.addHeader("Pragma", "no-cache"); resp.addHeader("Expires", "0"); resp.addHeader("Content-Encoding", "UTF-8"); resp.getWriter().write(sb.toString()); The result is opened as a gibrish text instead of hebrew in excell. How should I change this text so the result CSV can be opened in Excell (without importing it to excell)? i.e. what charset should I used, and what is the correct code to generate it?
tagged with: http://stackoverflow.com/tag/csv
has answer: http://stackoverflow.com/a/27362276
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/155097
upvote count: 1

http://stackoverflow.com/comment/43344305
score: 0
type: Comment
type: QuestionComment
has text: Why in the world would you use a RegEx for this?
comment on: http://stackoverflow.com/q/27452920

http://stackoverflow.com/comment/43271137
type: QuestionComment
has text: I used this site to guide me the above is in my manifest file http://www.excelsior-usa.com/articles/java-to-exe.html
comment on: http://stackoverflow.com/q/27413411
score: 0
type: Comment

http://stackoverflow.com/q/27339414
has comment: http://stackoverflow.com/comment/43135400
has body: I am trying to use System.exit(n) to return various error codes. I need to do this to access these numbers from a Unix shell script. So for instance in my java program I have System.exit(2). Then in my shell script I have: var=$(java myProgram arguments) Which when ran will exit the java program using System.exit(2), shouldn't it output the integer 2 to "var"? Because it doesn't. Am I missing something? What do I need to do to get it to give me the integer?
has answer: http://stackoverflow.com/a/27339452
tagged with: bash
type: AnsweredQuestion
tagged with: shell
tagged with: unix
favorite count: 0
score: -1
type: Question
downvote count: 2
accepted answer: http://stackoverflow.com/a/27339452
upvote count: 1
answer count: 1
has title: Using System.exit(n) to return value to Unix shell script
tagged with: java

performance
tags question: http://stackoverflow.com/q/27388103
tags question: http://stackoverflow.com/q/27399678
tags question: http://stackoverflow.com/q/27468042
tags question: http://stackoverflow.com/q/27340974
tags question: http://stackoverflow.com/q/27333465
tags question: http://stackoverflow.com/q/27320781
tags question: http://stackoverflow.com/q/27358881
tags question: http://stackoverflow.com/q/27353904
tags question: http://stackoverflow.com/q/27441311
tags question: http://stackoverflow.com/q/27355790
tags question: http://stackoverflow.com/q/27368264
tags question: http://stackoverflow.com/q/27409330
tags question: http://stackoverflow.com/q/27448556
tags question: http://stackoverflow.com/q/27456200
tags question: http://stackoverflow.com/q/27332056
tags question: http://stackoverflow.com/q/27330199
tags question: http://stackoverflow.com/q/27327958
tags question: http://stackoverflow.com/q/27448158
tags question: http://stackoverflow.com/q/27347282
tag name: performance
tags question: http://stackoverflow.com/q/27409922
type: Tag
tags question: http://stackoverflow.com/q/27462543
tags question: http://stackoverflow.com/q/27370630
tags question: http://stackoverflow.com/q/27345550
tags question: http://stackoverflow.com/q/27462297
tags question: http://stackoverflow.com/q/27461697

http://stackoverflow.com/comment/43260254
comment on: http://stackoverflow.com/q/27405413
has text: you are always saving new inputs to this string "favs" here `editor.putString("fav", item);` am i right? and you save the on memory one to an array..that works good.. but your persistent one is always over written.. do i make sense Sir?
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27353809
type: Question
tagged with: keyboard
has body: Problem: my own class which extends EditTextPreference a method within that class called "setInputType()" with this.getEditText().setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED); my xml with elements of my own EditText-class with title, summary, key, defaultValue, digits, nothing else. android:digits="1234567890" What i want is: the default value will always be numeric, but leading zeros have to be possible. so my thought was, that I have to either have a inputtype "phone" or "text", although i dont want letters to be allowed. as you see my problem: I can type the numbers from 0123456789, but my edittext opens with the normal keyboard. but when I tried to change it to numeric keyboard, I couldnt manage to make the 0 be allowed. Is there a clean solution? everything i found is either just making the numeric keyboard as default OR allowing my wanted digits. Thank you for your help :)
has answer: http://stackoverflow.com/a/27355991
tagged with: android
answer count: 1
has title: EditText with numeric keyboard but allowing alphanumeric values
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
tagged with: android-edittext
score: 0
tagged with: java

http://stackoverflow.com/comment/43318232
comment on: http://stackoverflow.com/q/27438481
score: 0
has text: @DaImTo "AnalyticsManagementFiltersFilterExpression" is an invalid expression and my IDE shows that it does not exist. I do not know why the code on that page is wrong. Also, I've tried the API Explorer demo on that page and it also gives me the same "Field id is required" error.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43210450
type: QuestionComment
comment on: http://stackoverflow.com/q/27375810
has text: This was reported previously, and an answer was accepted - but it's unclear to me if it was ever really resolved. See here: http://stackoverflow.com/questions/12516858/extracting-attachments-from-lotus-notes-api-using-embeddedobject-creating-eotm
score: 0
type: Comment

http://stackoverflow.com/q/27367566
score: 0
tagged with: http://stackoverflow.com/tag/csv
has body: I am writing a MapReduce code which will read the first line, last line and add some content to the string and the remaining lines are printed as they are. I am using a .csv file and extracting tabs. However, if I use this like a normal Java program it works, but how would I use this logic in the mapper section of the MR code as I dont understand how mapper looks for the lines. Below is the code. public void map(Object key, Text value, Context context) throws IOException, InterruptedException { String next, fileContent = value.toString(); for (boolean first = true, last = (fileContent == null); !last; first = false, fileContent = next) { last = ((next = value.toString()) == null); if (first) { String[] tab = fileContent.split(","); String line = "var trip = [" + "\n" + "[" + tab[2] + "," + tab[3] + "," + tab[8] + "," + tab[11] + "," + tab[15] + "," + tab[16] + "],"; text.set(line); } else if (last) { String[] tab = fileContent.split(","); String line = "[" + tab[2] + "," + tab[3] + "," + tab[8] + "," + tab[11] + "," + tab[15] + "," + tab[16] + "]" + "\n" + "];"; text.set(line); } else { String[] tab = fileContent.split(","); String line = "[" + tab[2] + "," + tab[3] + "," + tab[8] + "," + tab[11] + "," + tab[15] + "," + tab[16] + "],"; text.set(line); } } context.write(null, text); } }
has title: Identifying First and Last line of a .csv File
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43191734
tagged with: emr
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43187875
type: Question
tagged with: hadoop
has comment: http://stackoverflow.com/comment/43187674
tagged with: hadoop2
has comment: http://stackoverflow.com/comment/43189259

http://stackoverflow.com/q/27372571
has body: I have an installer which supports unattended mode of installation. When there is an error like (no sufficient space, no access,..), the error messages are shown properly in GUI mode. however, its not showing any error message during unattended mode. Is there a option to show the error messages during the unattended mode as well? Note: I have windows and Linux installers Thanks a lot for the help Cheers, Prabhu Senthamarai
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: java
tagged with: install4j
has title: Install4j: Error Message in unattended mode
type: Question
has answer: http://stackoverflow.com/a/27373724
score: 0
accepted answer: http://stackoverflow.com/a/27373724
answer count: 1
favorite count: 0

http://stackoverflow.com/q/27416650
type: Question
tagged with: java
has title: relative file path for writing file
has comment: http://stackoverflow.com/comment/43276945
score: 0
has comment: http://stackoverflow.com/comment/43276892
answer count: 1
tagged with: file-io
has body: I am trying to create a file using the following chunk of code String content = "This is the content to write into file"; File file = new File("/Users/abc/output.txt"); // if file doesnt exists, then create it if (!file.exists()) { try { file.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } FileWriter fw; try { fw = new FileWriter(file.getAbsoluteFile()); BufferedWriter bw = new BufferedWriter(fw); bw.write(content); bw.close(); } catch (IOException e) { e.printStackTrace(); } Everything is working as expected, but I want to create the file in a folder relative to my current html page, any idea how I can do that? This way I am writing/creating a file which is outside my workspace. Thanks in advance
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43277090
tagged with: path
has comment: http://stackoverflow.com/comment/43276874
has answer: http://stackoverflow.com/a/27416762
has comment: http://stackoverflow.com/comment/43276906
linked to: http://stackoverflow.com/q/204784

http://stackoverflow.com/q/27334650
type: Question
has comment: http://stackoverflow.com/comment/43127583
answer count: 1
downvote count: 0
has title: Calculating the average in Pig Latin
has comment: http://stackoverflow.com/comment/43127452
has body: Consider a data file: 4, 8, 2 5, 2, 5 3, 1, 7 I want to calculate the average of every column. What's the easiest way to do this? What if I have 20 columns, is there a loop, so that I don't have to calculate it for every column manually?
accepted answer: http://stackoverflow.com/a/27334901
favorite count: 0
tagged with: apache-pig
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27334901

http://stackoverflow.com/comment/43210301
score: 0
has text: you tried this ?? is it not displaying whole line ? sorry i am not not having jvm and ide with me right now
type: Comment
comment on: http://stackoverflow.com/a/27380378
type: AnswerComment

http://stackoverflow.com/a/27320078
has comment: http://stackoverflow.com/comment/43100649
has comment: http://stackoverflow.com/comment/43104527
has comment: http://stackoverflow.com/comment/43100325
has comment: http://stackoverflow.com/comment/43104432
score: 0
has comment: http://stackoverflow.com/comment/43104495
has comment: http://stackoverflow.com/comment/43100557
answers question: http://stackoverflow.com/q/27319529
type: Answer
has body: A Possible way (Pseudo-code) Initialize a counter (to keep track of the number of strings) int stringCounter = 0; Use a Reader or a Scanner Scanner scan = new Scanner(file); Loop over each line and Determine if the line is a number by trying to parse the value while(scan.hasNext()) { String currentLine = scan.nextLine(); try { Integer i = Integer.valueOf(currentLine); } catch (NumberFormatException nfe) { stringCounter++; } } Once you exit the loop your counter will have the answer
has comment: http://stackoverflow.com/comment/43104905
has comment: http://stackoverflow.com/comment/43104418

http://stackoverflow.com/q/27387307
has answer: http://stackoverflow.com/a/64569873
favorite count: 0
has body: I have a case where we have an inheritance strategy like this (this is an example of the jpa wiki, our real example is an other business case :)) @Entity @Inheritance @DiscriminatorColumn(name="PROJ_TYPE") @Table(name="PROJECT") public abstract class Project { @Id private long id; ... } @Entity @DiscriminatorValue("L") public class LargeProject extends Project { @OneToMany private Set&lt;Member&gt; members; } @Entity @DiscriminatorValue("S") public class SmallProject extends Project { } I have a bunch of projects in my database and want to fetch all the projects at once, but by doing this, i also want to fetch my list of members at once. Is there a way to do this with jpql? I know the TYPE annotation allows me to look at the type, but can I combine this with a JOIN FETCH? I'm using hibernate, but don't want to downgrade back to the hibernate api if I don't need to
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43243129
has comment: http://stackoverflow.com/comment/43235276
score: 3
has answer: http://stackoverflow.com/a/55875938
upvote count: 3
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/43238186
type: Question
answer count: 2
tagged with: jpa
downvote count: 0
has title: JPA fetch collection of subclass
tagged with: inheritance
tagged with: jpql
has comment: http://stackoverflow.com/comment/43242397

http://stackoverflow.com/a/27404697
score: 11
has body: The second case is explicitly allowed by the JLS as a special case. In JLS 5.2, which deals with narrowing conversions, it says: In addition, if the expression is a constant expression (§15.28) of type byte, short, char, or int: A narrowing primitive conversion may be used if the type of the variable is byte, short, or char, and the value of the constant expression is representable in the type of the variable. ... In other words, for the non-long integer-like values, you can implicitly narrow them iff the value you're narrowing is a constant that fits within the type you're specifying. I'm guessing the same trick isn't applied to floats because floating point values are trickier than integer values. For instance, 0.1 can't be exactly expressed in a floating point, while 1.0 can. That means that double d = 0.1 isn't actually putting the value 0.1 into d -- just a value that's very close to 0.1. Given that, the "does it fit exactly" rule doesn't apply even to floating point literals, and the question of "does it fit exactly when we narrow" becomes trickier. Your options would basically be: always allow it (which could cause some surprising behavior if a value is significantly different than its literal representation) only allow it if the value can be exactly put in. This would look highly inconsistent: float f1 = 1.0 and double d1 = 1.0 both work double d2 = 0.1 works, but float f2 = 0.1 doesn't -- confusing! never allow it (slightly inconvenient, because you have to type the f char in the literal) Given these options, it seems that the designers of the JLS chose the least of three not-great options.
answers question: http://stackoverflow.com/q/27404624
has comment: http://stackoverflow.com/comment/43254901
has comment: http://stackoverflow.com/comment/43254198
has comment: http://stackoverflow.com/comment/43254093
has comment: http://stackoverflow.com/comment/43254434
downvote count: 0
upvote count: 11
has comment: http://stackoverflow.com/comment/43254132
has comment: http://stackoverflow.com/comment/43254977
type: Answer

twilio
tag name: twilio
type: Tag
tags question: http://stackoverflow.com/q/27449378

http://stackoverflow.com/q/27451420
upvote count: 0
score: -2
has body: Quick question: I know a small amount of Java, and I'm working on my first very basic Android application. I just want it to say "Your device is: Build.MODEL" but I can't figure out how to get that string to display in the XML TextView.
answer count: 3
tagged with: android
tagged with: string
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/27451462
linked to: http://stackoverflow.com/q/2397613
has comment: http://stackoverflow.com/comment/43341333
has answer: http://stackoverflow.com/a/27451566
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27451619
has title: Android Studio Strings

http://stackoverflow.com/comment/43374697
type: QuestionComment
comment on: http://stackoverflow.com/q/27469802
type: Comment
has text: True! The file is not in the bin folder. I'm using eclipse, how to get the file to be copied?
score: 0

http://stackoverflow.com/comment/45456916
score: 2
type: AnswerComment
type: Comment
has text: still works with jdk1.7.0_76. i wish maven had a place for "last version compatible with java7", that's twice i've gotten burned with a newest version and searched around for usable versions. and, the github page now says douglas crockford is looking for a new maintainer as of 2015-02-06...
comment on: http://stackoverflow.com/a/27353987

http://stackoverflow.com/comment/43317943
type: Comment
type: QuestionComment
has text: in netbeans you can see classes
score: 1
comment on: http://stackoverflow.com/q/27439049

http://stackoverflow.com/comment/43245238
comment on: http://stackoverflow.com/q/27399762
type: QuestionComment
has text: When need to get data from database open database for read and put data to database open database for write like : getReadableDatabase() and getWritableDatabase()
type: Comment
score: 0

http://stackoverflow.com/q/27385585
has answer: http://stackoverflow.com/a/27385639
type: AnsweredQuestion
has title: Cannot Resolve Method 'deleteCharAt()'
has answer: http://stackoverflow.com/a/39565862
tagged with: java
type: Question
upvote count: 2
has body: What is the alternative for 'deleteCharAt()'? Is there a library? I wanted to delete a specific character on a String. Here is my current code: public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); EditText name1; EditText name2; Button button = (Button) findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v){ EditText name1; EditText name2; TextView textout2; TextView textout; int sum; name1 = (EditText)findViewById(R.id.editText); name2 = (EditText)findViewById(R.id.editText2); int totalLength = 0; int total; String inputText1 = name1.getText().toString(); String inputText2 = name2.getText().toString(); totalLength = name1.length() + name2.length(); Toast toast = new Toast(getApplicationContext()); toast.setGravity(Gravity.TOP | Gravity.LEFT,0, 0); for (int i = 0; i &lt; name1.length(); i++) { char ch = inputText1.charAt(i); for (int j = 0; j &lt; name2.length(); j++) { if (ch == inputText2.charAt(j)) { inputText1.deleteCharAt(); inputText2.deleteCharAt(); } } } }); }
possible better answer: http://stackoverflow.com/a/27385639
has comment: http://stackoverflow.com/comment/43219497
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/27385670
accepted answer: http://stackoverflow.com/a/27385670
has answer: http://stackoverflow.com/a/39565619
answer count: 4
score: 2
downvote count: 0

http://stackoverflow.com/a/27332308
score: 1
type: Answer
upvote count: 1
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27314664
has body: I checked with: @Override public void configure() { from("direct:start") .onCompletion() .process(new Processor() { @Override public void process(final Exchange exchange) throws Exception { LOG.info("Hello, {}", exchange.getIn().getHeader("myHeader")); } }) .end() .setHeader("myHeader").constant("World!"); } } This prints Hello, World! Thus, the header myHeader is still available in onCompletion. So, I guess that your header is never properly set?
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27314664

http://stackoverflow.com/a/27398189
has body: The error is basically telling you that maven is looking for the dependency "com.sun.jersey:jersey-grizzly:jar:1.0" in the repository "http://download.java.net/maven/glassfish" that is your pom.xml and it can not find it. Do you try it with the Maven Central Repository??
upvote count: 1
answers question: http://stackoverflow.com/q/27372940
downvote count: 0
has comment: http://stackoverflow.com/comment/43275801
type: Answer
score: 1

http://stackoverflow.com/comment/43096063
has text: Java and JavaScript are not the same thing you have the tag JavaScript and the title Java
type: QuestionComment
comment on: http://stackoverflow.com/q/27318280
score: 0
type: Comment

http://stackoverflow.com/comment/43168779
type: Comment
type: AnswerComment
has text: Glad it helped! Anyway, returning a function is not what I suggested. What I suggested is writing a self-contained application, say popup.js, and including that in your host application with a ` ` element. This way you don't need cross-application authentication
comment on: http://stackoverflow.com/a/27356673
score: 0

http://stackoverflow.com/q/27437071
score: 0
tagged with: fileinputstream
answer count: 1
has title: SV.DOS.ARRSIZE: Unvalidated user input 'sigFileInputStream.available()' in Klocwork for following line
tagged with: klocwork
type: UnansweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/28776272
has body: I am using klocwok to review my code. For the given line of code: byte sigToVerify = new byte[sigFileInputStream.available()]; I am getting the following error report: SV.DOS.ARRSIZE: Unvalidated user input sigFileInputStream.available() used for array size - attacker can specify a large number leading to high resource usage on the server and a DOS attack Please help me resolve this issue.
tagged with: inputstream

http://stackoverflow.com/comment/43245824
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27400300
has text: See [Understanding Class Members](https://docs.oracle.com/javase/tutorial/java/javaOO/classvars.html) in Oracle's Java Tutorials.
score: 0

http://stackoverflow.com/a/27459065
upvote count: 1
type: Answer
has body: Instead of implementing OnClick to RadioButton just implement RadioGroup setOnCheckedChangeListener : RadioGroup from = (RadioGroup) rootView.findViewById(R.id.from); from.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { public void onCheckedChanged(RadioGroup arg0, int id) { if (id==R.id.km) { x=1; }else if(id==R.id.m){ x=2; }else if(id==R.id.cm) x=3; } }); Also apply same way setOnCheckedChangeListener for (to) RadioGroup and remove OnClick from xml.
answers question: http://stackoverflow.com/q/27458965
downvote count: 0
score: 1

http://stackoverflow.com/comment/43358510
has text: And, I guess you should check the difference between request and prototype scope http://stackoverflow.com/questions/6480005/spring-request-and-prototype-scope
comment on: http://stackoverflow.com/q/27460872
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27338064
answer count: 2
has title: How to fix "Exception in thread "main" java.lang.NullPointerException"
has answer: http://stackoverflow.com/a/27338169
has comment: http://stackoverflow.com/comment/43132900
score: 0
has comment: http://stackoverflow.com/comment/43132775
has answer: http://stackoverflow.com/a/27338120
tagged with: exception
type: UnansweredQuestion
tagged with: swing
has comment: http://stackoverflow.com/comment/43132777
tagged with: java
has body: I'm writing a java program, messed around with it trying to make a new panel and somehow screwed it up and won't let me run the program. I rolled back to the last point in which it was working but still no good. I don't know where I went wrong. From the error I can only assume that I messed u somewhere between the main method and the makeGUI method, but I can't see anything wrong. The error I got was; Exception in thread "main" java.lang.NullPointerException at java.awt.Container.addImpl&lt;Container.java:1090&gt; at java.awt.Container.add&lt;Container.java:966&gt; at assignment2g2.buildGUI&lt;assignment2g2.java:47&gt; at assignment2g2.&lt;init&gt;&lt;assignment2g2.java:31&gt; at assignment2g2.main&lt;assignment2g2.java:124&gt; and My code is ... import javax.swing.*; import javax.swing.border.LineBorder; import javax.swing.event.MouseInputListener; import java.awt.*; import java.awt.event.*; public class assignment2g2 extends JFrame implements MouseInputListener { JPanel mousePanel, actionsPanel; JLabel mouseLabel; JLabel topLeft,topMid,topRightMid,topRight,midLeft,midMid,midRightMid,midRight,btmLeft,btmMid,btmRightMid,btmRight; ImageIcon circle = new ImageIcon("circle.jpg"); ImageIcon square = new ImageIcon("square.jpg"); ImageIcon triangle = new ImageIcon("triangle.jpg"); //JButton button1=new JButton("?"); //JButton button2=new JButton("?"); public assignment2g2() { buildGUI(); buildActionsPanel(); mousePanel.add(actionsPanel); getContentPane().add(mousePanel); setSize(800,400); setVisible(true); } public void buildGUI() { mousePanel = new JPanel(); mousePanel.setLayout(new BorderLayout()); mousePanel.add(mouseLabel,BorderLayout.SOUTH); mousePanel.addMouseListener(this); mousePanel.addMouseMotionListener(this); mouseLabel = new JLabel(); mouseLabel.setBorder(new LineBorder(Color.BLACK)); mouseLabel.setForeground(Color.RED); mouseLabel.setText("Please select an answer"); actionsPanel = new JPanel(); actionsPanel.setLayout(new GridLayout(3,3)); } public void build…
has comment: http://stackoverflow.com/comment/43132768
type: Question

http://stackoverflow.com/a/27454483
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27450944
type: Answer
has comment: http://stackoverflow.com/comment/43358652
upvote count: 2
has body: When you call first(), you cause the first element of the RDD to be copied to the driver process. For that to happen, it has to be serializable, and by default that means implement java.io.Serializable. My guess is that this custom class does not.
score: 2
answers question: http://stackoverflow.com/q/27450944
has comment: http://stackoverflow.com/comment/43362736
type: AcceptedAnswer

http://stackoverflow.com/q/27337075
type: Question
has comment: http://stackoverflow.com/comment/43131756
has title: Thread imageView update speeds up
linked to: http://stackoverflow.com/q/11536938
has comment: http://stackoverflow.com/comment/43131389
score: 0
has comment: http://stackoverflow.com/comment/43132639
type: UnansweredQuestion
tagged with: multithreading
tagged with: android
has body: I have a thread that is used to spin an imageview as other things happen in the background. It works great for spinning, but I've noticed as I turn it on and off (based on the spinningMain variable) the button starts to spin faster and faster and faster. I'm unsure what the cause of this is as the thread is told to sleep every 100ms. If it helps I also have another thread (runnable thread) which runs the main code in between, which I was wondering whether it was disrupting the thread? The imageView update thread is: final Thread t = new Thread() { @Override public void run() { try { while (!isInterrupted()) { Thread.sleep(100); runOnUiThread(new Runnable() { @Override public void run() { if (spinningMain == true) { // update TextView here! if (spinningAngleMain &gt;= 360) { spinningAngleMain = 0; } else { spinningAngleMain += 5; } imageButton.setRotation(spinningAngleMain); } } }); } } catch (InterruptedException e) { } } }; t.start(); And the Second thread is pretty much made as follows new Thread(new Runnable() { @Override public void run() { if (searchStateButton == true) { //do all my stuff } My boolean variables are set to volatile if that helps as well.
answer count: 0
tagged with: java

http://stackoverflow.com/comment/43148922
comment on: http://stackoverflow.com/q/27346907
has text: output is 1 if I do that
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43225391
has text: @JGerulskis do something simple: add `if (x[i] == null) { System.out.println("x[" + i + "] is null!"); }`. That would help more than the debugger.
comment on: http://stackoverflow.com/a/27388704
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/43196638
type: Comment
comment on: http://stackoverflow.com/a/27371696
has text: That would be awesome if you link me
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43237788
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27395704
has text: @Dude: Yes, if you just want the day of month. It's not that `Calendar` and `Date` don't work - it's that their APIs are painful to use.
score: 0

http://stackoverflow.com/comment/43307146
has text: Because the javadocs stated so!!
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27432742

javadoc
tags question: http://stackoverflow.com/q/27462652
tags question: http://stackoverflow.com/q/27455476
type: Tag
tags question: http://stackoverflow.com/q/27398324
tag name: javadoc
tags question: http://stackoverflow.com/q/27457031
tags question: http://stackoverflow.com/q/27392535

http://stackoverflow.com/a/27342643
downvote count: 0
score: 1
type: Answer
upvote count: 1
has body: This might be a usable start for a memory game in fx. It uses an own extension of ImageView to do the turn and focus animations and to deal with a common backside image. Its only graphics, no game logic. public class MemoryGame extends Application { final int rows = 4; final int columns = 4; CardView views[][] = new CardView[rows][]; public static class CardView extends ImageView { static final double scale = 0.95; static DropShadow shadowhoover = new DropShadow(5, 4, 4, Color.rgb(50, 60, 50)); static DropShadow shadowdown = new DropShadow(2, 2, 2, Color.rgb(50, 60, 50)); static Image backside = null; public static void setbackside(Image image) { backside = image; } public CardView(Image image) { super(backside); setRotationAxis(new Point3D(0, 200,0)); setScaleX(scale); setScaleY(scale); setEffect(shadowdown); setOnMouseEntered(m -&gt; { setEffect(shadowhoover); setScaleX(scale*1.01); setScaleY(scale*1.01); }); setOnMouseExited(m -&gt; { setEffect(shadowdown); setScaleX(scale); setScaleY(scale); }); setOnMouseClicked(m -&gt; { RotateTransition r1 = new RotateTransition(Duration.millis(300), this); r1.setByAngle(90); r1.setOnFinished(e -&gt; setImage(image)); RotateTransition r2 = new RotateTransition(Duration.millis(300), this); r2.setByAngle(-90); RotateTransition r3 = new RotateTransition(Duration.millis(300), this); r3.setByAngle(90); r3.setOnFinished(e -&gt; setImage(backside)); RotateTransition r4 = new RotateTransition(Duration.millis(300), this); r4.setByAngle(-90); new SequentialTransition(r1, r2, new PauseTransition(Duration.millis(1000)), r3, r4).play(); }); } } @Override public void start(Stage gameStage) throws Exception { GridPane grid = new GridPane(); grid.setBackground(new Background(new BackgroundFill(Color.rgb(140, 200, 140), new CornerRadii(0), new Insets(0)))); grid.setHgap(5); grid.setVgap(5); Image back = new Image(MemoryGame.class.getResource("card-back.png").toExternalForm(), 140, 200, true, true); Image front = new Image(MemoryGame.class.get…
answers question: http://stackoverflow.com/q/27338544

http://stackoverflow.com/a/27324689
score: 4
accepted answer of: http://stackoverflow.com/q/27324527
answers question: http://stackoverflow.com/q/27324527
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/43108517
downvote count: 0
has body: The problem is that the code will execute correctly if the default locale is english, otherwise will throw an exception. You can solve it adding the correct Locale. //Locale locale = new Locale("en-US"); Locale locale = Locale.US; SimpleDateFormat format = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss z", locale); Date date = format.parse("Sun, 11 May 2014 23:11:51 +0430"); Probably the android device has a different language setting. Consider using a constant Locale as RC stated in the comment, in that case you wouldn't need the extra variable, use the constant directly in the constructor.
type: AcceptedAnswer

http://stackoverflow.com/a/27407654
score: 0
answers question: http://stackoverflow.com/q/27407361
type: Answer
has body: Your JAR file includes foo/ReadCSV.class, but your MainClass is set to foo.ReadCSVTest. You'll need to fix your Main-Class attribute in META-INF/MAINIFEST.MF

http://stackoverflow.com/comment/43448088
type: Comment
has text: isInstance taking "Object" class as argument how can we provide it with primitive
comment on: http://stackoverflow.com/a/27402828
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43217272
type: Comment
type: QuestionComment
has text: @DonBottstein ternary for the win!
comment on: http://stackoverflow.com/q/27384191
score: 0

http://stackoverflow.com/a/27359407
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27354902
has body: Do this if you have a swing application: f.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { } @Override public void keyPressed(KeyEvent e) { if ((e.getKeyCode() == KeyEvent.VK_D) &amp;&amp; ((e.getModifiers() &amp; KeyEvent.CTRL_MASK) != 0)) { System.out.println("woot!"); } } @Override public void keyReleased(KeyEvent e) { } }); you can read more here and here If you have a console application then use: Read Input until control+d
downvote count: 0
type: Answer

http://stackoverflow.com/comment/75651668
type: Comment
has text: If i want to use this code in Android Studio What will i need to do?
type: AnswerComment
comment on: http://stackoverflow.com/a/27455172
score: 0

http://stackoverflow.com/a/27362694
type: Answer
upvote count: 2
answers question: http://stackoverflow.com/q/27347379
score: 2
has body: Recent Java versions have "fixed" URLConnection to hide cookies that are marked HttpOnly, and I don't think there's a setting to disable that. I would recommend using HttpClient from Apache HttpComponents.
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27347379

http://stackoverflow.com/q/27407697
score: 1
tagged with: reference
favorite count: 0
tagged with: weak-references
has comment: http://stackoverflow.com/comment/43265993
answer count: 0
type: UnansweredQuestion
tagged with: garbage-collection
upvote count: 1
has comment: http://stackoverflow.com/comment/43289638
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43261528
has body: Say I have 2 Java classes, A and B that look like this: public static class A { } public static class B { private A parent; public B(A parent) { this.parent = parent; } } Now, I have an instance of class A (call it 'xa') and an instance of class B ('yb'). I would like a general way to prevent 'yb' from being garbage collected until 'xa' is eligible for GC. Assume I cannot modify the code for either class. Basically, I want to achieve the exact same behavior that would occur if 'xa' had a direct reference to 'yb' (via a field). I've explored trying to use PhantomReferences + ReferenceQueues, but I always seem to run into a dead end where 'yb's direct reference to 'xa' ends up preventing both objects from being GC'd... FYI, my actual use-case is a weak listener that only needs to exist for as long as another object does.
linked to: http://stackoverflow.com/q/11445822
downvote count: 0
has title: How to simulate a direct reference from one Java object to another?
duplicate of: http://stackoverflow.com/q/11445822

http://stackoverflow.com/q/27336084
has title: Why does java.util.HashMap use a linked list internally
has answer: http://stackoverflow.com/a/27336136
accepted answer: http://stackoverflow.com/a/27338258
possible better answer: http://stackoverflow.com/a/27336136
type: AnsweredQuestion
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43132843
tagged with: hashmap
has comment: http://stackoverflow.com/comment/43128978
has body: My conceptual understanding of a java.util.HashMap is as follows: Its main asset over other Map implementations is constant lookup time, assuming there are no collisions. For this reason the underlying implementation uses an array of fixed length - the only data structure in computer science that has O(1) lookup. The fixed length array used to store the Map entries is initialised to a given size upon instantiation and expanded (by expanded, I mean a larger array is created and the values copied across) as the size of the Map approaches the length of the fixed length array. When a value is put into the Map, the key value pair are put into an internal linked list implementation for the given key. When there is a collision subsequent key value pairs are appended to the list. When getting from the Map, the hashCode() of the key is used to derive the array index of the internal linked list implementation and you either have your value if the list has size 1, or you iterate through the list calling equals() on the key of each element until you find your values. Based on point 2, HashMap has to expand an array, an operation which is surely linear. Why does it use an internal linked list implementation (O(n) lookup) for collision resolution? Why doesn't it use a datastructure with O(log n) lookup, like a binary or red black tree, to enhance performance?
has comment: http://stackoverflow.com/comment/43132700
has comment: http://stackoverflow.com/comment/43128983
has answer: http://stackoverflow.com/a/27338258
score: 0
answer count: 2

http://stackoverflow.com/comment/43364129
type: QuestionComment
comment on: http://stackoverflow.com/q/27463919
has text: @aioobe I think I agree with your 1st statement. Unfortunately I didn't get your 2nd.
score: 0
type: Comment

http://stackoverflow.com/q/27466033
possible better answer: http://stackoverflow.com/a/27466074
has answer: http://stackoverflow.com/a/27466087
accepted answer: http://stackoverflow.com/a/27466087
downvote count: 1
has comment: http://stackoverflow.com/comment/43368206
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43368147
has body: I have two definitions from some college notes I'm reading. "dequeue(): Remove the object from the front of the queue and return it; an error occurs if the queue is empty" "front(): Return the front object in the queue, BUT DO NOT remove it; an error occurs if the queue is empty" I understand the dequeue method but the front method has me a bit perplexed. Just wondering if someone has a good example of the front method being used so I can get my head around the difference between the two. Thanks.
tagged with: java
score: -1
tagged with: queue
type: Question
answer count: 2
has title: Whats the difference between dequeue() and front() in Java Queue?
has comment: http://stackoverflow.com/comment/43369618
upvote count: 0
has answer: http://stackoverflow.com/a/27466074
favorite count: 0
has comment: http://stackoverflow.com/comment/43368165
has comment: http://stackoverflow.com/comment/43368094
has comment: http://stackoverflow.com/comment/43368070

http://stackoverflow.com/a/27507096
has comment: http://stackoverflow.com/comment/43455592
accepted answer of: http://stackoverflow.com/q/27471426
has body: In such cases, you have jar version conflicts. Check Jackson library you are using, and the one required by Spring Social. You can know requirements, by checking related pom.xml (For example through mvnrepository.com http://mvnrepository.com/artifact/org.springframework.social/spring-social-facebook/1.1.1.RELEASE) Latest version of Spring Social Facebook - 1.1.1.RELEASE, for example depends on JSON Lib com.fasterxml.jackson.core jackson-annotations 2.3.2 JSON Lib com.fasterxml.jackson.core jackson-core 2.3.2 JSON Lib com.fasterxml.jackson.core jackson-databind 2.3.2
answers question: http://stackoverflow.com/q/27471426
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/27332953
type: AnsweredQuestion
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/7520432
has comment: http://stackoverflow.com/comment/43123281
answer count: 3
downvote count: 0
favorite count: 0
tagged with: binary-tree
has answer: http://stackoverflow.com/a/27333617
tagged with: operator-keyword
has answer: http://stackoverflow.com/a/27333273
has body: I'm filling up a binary tree, and afterwards I try to get the parent of a certain leaf, trough a recursive method. Each node contains the String data; and let's say i'll only initialize the String data with "*" for each leaf. In that method, i'm traversing trough the tree, until the given node(leaf) has been found, so I can return the parent. After finding a leaf, I want to check if the node(leaf) is identical to the target I was searching for. Sadly, this is not the case, and the method returns the parent first found leaf. I have used .equals() method and the "==" operator, but none of them work. Does anyone know how to solve this problem? BinaryNode root = new BinaryNode("root",2); BinaryNode na = new BinaryNode("a",2); BinaryNode naLeaf1= new BinaryNode("*",0); BinaryNode naLeaf2 = new BinaryNode("*",0); na.addChild(naLeaf1); na.addChild(naLeaf2); BinaryNode nb = new BinaryNode("b",2); BinaryNode nbLeaf1= new BinaryNode("*",0); BinaryNode nbLeaf2 = new BinaryNode("*",0); nb.addChild(nbLeaf1); nb.addChild(nbLeaf2); root.addChild(na); root.addChild(nb); This is the recursive method that traverses trough the binary tree. public BinaryNode getParent(BinaryNode root, BinaryNode target) { if(root!=null) { for(BinaryNode ni: root.childeren) { if(!ni.data.equals("*")) { return getParent(ni, target); }else { if(ni.equals(target)) { return root; } } } } return root; } I have added an override for the .equals method, but that doesn't seem to solve the problem. @Override public boolean equals(Object target) { if(target==null) return false; if(target==this) return true; if(!(target instanceof BinaryNode)) return false; return false; }
possible better answer: http://stackoverflow.com/a/27333222
has comment: http://stackoverflow.com/comment/43123318
has title: Objects differ, but get trough .equals function and '==' operator
has comment: http://stackoverflow.com/comment/43123277
has answer: http://stackoverflow.com/a/27333222
upvote count: 1
accepted answer: http://stackoverflow.com/a/27333617
has comment: http://stackoverflow.com/comment/43123423
type: Question
tagged with: recursion

http://stackoverflow.com/comment/43116888
type: AnswerComment
has text: 12-06 12:32:34.945: I/RAE(15596): FirstLogin 12-06 12:32:34.955: I/RAE(15596): CheckFirst 12-06 12:32:34.955: I/RAE(15596): checkUrlhttp://www.example.com:8090/folder 12-06 12:32:34.965: I/RAE(15596): urlDatahttp://www.example.com:8090/folder 12-06 12:32:55.067: I/RAE(15596): inside socket 12-06 12:32:55.067: I/RAE(15596): after urldata1
type: Comment
comment on: http://stackoverflow.com/a/27329052
score: 0

http://stackoverflow.com/comment/43175536
type: QuestionComment
comment on: http://stackoverflow.com/q/27361247
score: 0
has text: @user90283 Can you help me with this method? And also my addMen method the on that is supposed to add men to each regiment.
type: Comment

http://stackoverflow.com/q/27376254
type: Question
tagged with: cardlayout
tagged with: layout
answer count: 1
downvote count: 0
has title: JFrame getLayout method does not return set cardLayout
favorite count: 0
tagged with: jframe
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/27376552
type: AnsweredQuestion
score: 1
accepted answer: http://stackoverflow.com/a/27376552
tagged with: java
has body: I am setting a CardLayout as the a JFrame's layout but when I call the getLayout method a border layout is returned. import java.awt.CardLayout; import javax.swing.JFrame; public class SSCCE { public static void main(String[] args) { JFrame frame = new JFrame(); CardLayout cl = new CardLayout(); frame.setLayout(cl); System.out.println(cl); System.out.println(frame.getLayout()); } } This is printed to console: java.awt.CardLayout[hgap=0,vgap=0] java.awt.BorderLayout[hgap=0,vgap=0]

http://stackoverflow.com/a/27384063
has body: I currently can't check the code but AFAIK you'd need to assign the result of camera.unproject() to some variable and then query that. Currently you're setting tmp to screen coordinates and then use the unaltered vector as world coordinates. The solution might be: Vector3 worldCoords = camera.unproject(tmp.set(...)); world.QueryAABB(query, worldCoords.x, worldCoords.y, worldCoords.x, worldCoords.y); A few other hints: Check whether the camera correctly translates mouse/screen coords into viewport coords. If the viewport is scaled and you don't take this into account, you might get the wrong coords right at the start. I'm not that experienced with Box2D but in general I'd not do a AABB collisition but a ray cast (at least in 3D - in 2D with orthographic projections it would be checking a single point). In some cases a point-sized AABB (width and height are 0) might cause problems.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27383622

http://stackoverflow.com/comment/43117667
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27327694
has text: @user2474562 sorry for long response. Please post where you use `getCroppedBitmap`

apache-spark
tags question: http://stackoverflow.com/q/27333909
tags question: http://stackoverflow.com/q/27375581
tags question: http://stackoverflow.com/q/27367814
tag name: apache-spark
tags question: http://stackoverflow.com/q/27339555
tags question: http://stackoverflow.com/q/27458600
tags question: http://stackoverflow.com/q/27316042
tags question: http://stackoverflow.com/q/27406150
tags question: http://stackoverflow.com/q/27438591
tags question: http://stackoverflow.com/q/27334694
tags question: http://stackoverflow.com/q/27385980
tags question: http://stackoverflow.com/q/27356157
tags question: http://stackoverflow.com/q/27385808
tags question: http://stackoverflow.com/q/27334839
type: Tag
tags question: http://stackoverflow.com/q/27323426
tags question: http://stackoverflow.com/q/27450944

http://stackoverflow.com/a/27441512
has body: Probably you have less than 652 lines. file.readLine() returns null when there is no more line to read.
answers question: http://stackoverflow.com/q/27441459
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/27384192
has body: @Required implies that you are using setter injection, instead of constructor injection. These are designed to be two options - not to do both options at the same time. Note this from Spring's blog - @ Required allows you to instruct Spring to check required dependencies for you. In case you are not in the position to use constructor injection, or for whatever other reasons, you prefer setter injection, @ Required is the way to go. Setter Injection vs Constructor Injection . More recently, @ Required Marks a method (typically a JavaBean setter method) as being 'required': that is, the setter method must be configured to be dependency-injected with a value. RequiredAnnotation So, you're marking it as having to be dependency injected - not constructor injected.
answers question: http://stackoverflow.com/q/27383245
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27383245
type: Answer
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/43217142
upvote count: 3

http://stackoverflow.com/q/27402877
has comment: http://stackoverflow.com/comment/43250390
has title: Error: Could not find or load mail class? (Java)
has body: I'm fully aware that this topic has already been touched upon so many times already. Yet, having browsed through many of them couldn't solve my problem so here I am asking for your opinion. package email1; import java.io.IOException; import java.util.Date; import java.util.Properties; import javax.mail.Authenticator; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Multipart; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; public class EmailAttachmentSender { public static void sendEmailWithAttachments(String host, String port, final String userName, final String password, String toAddress, String subject, String message, String[] attachFiles) throws AddressException, MessagingException { // sets SMTP server properties Properties properties = new Properties(); properties.put("mail.smtp.host", host); properties.put("mail.smtp.port", port); properties.put("mail.smtp.auth", "true"); properties.put("mail.smtp.starttls.enable", "true"); properties.put("mail.user", userName); properties.put("mail.password", password); // creates a new session with an authenticator Authenticator auth = new Authenticator() { public PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(userName, password); } }; Session session = Session.getInstance(properties, auth); // creates a new e-mail message Message msg = new MimeMessage(session); msg.setFrom(new InternetAddress(userName)); InternetAddress[] toAddresses = { new InternetAddress(toAddress) }; msg.setRecipients(Message.RecipientType.TO, toAddresses); msg.setSubject(subject); msg.setSentDate(new Date()); // creates message part MimeBodyPart messageBodyPart = new MimeBodyPart(); messageBodyPart.setContent(message, "t…
score: 0
has comment: http://stackoverflow.com/comment/43250480
tagged with: java
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/26825497
tagged with: class
has comment: http://stackoverflow.com/comment/43250481
tagged with: program-entry-point
duplicate of: http://stackoverflow.com/q/26825497
answer count: 0
type: Question
has comment: http://stackoverflow.com/comment/43250373
tagged with: email
tagged with: load

http://stackoverflow.com/q/27426182
answer count: 1
has title: Access Related Module Entries in SugarCRM, using JAVA AXIS SOAP Client
has answer: http://stackoverflow.com/a/27499545
tagged with: soap
has body: I have a one to many relationship between 2 custom modules. For each entry in Module 1, I want to be able to fetch the entries in Module 2, related to it. I tried get_Relationships function, but the return type is get_relationships_result. How do i access the records??
type: UnansweredQuestion
type: Question
tagged with: java
tagged with: sugarcrm
score: 0
tagged with: axis

http://stackoverflow.com/comment/43203368
type: QuestionComment
has text: @Rami the data i want to pass,is i am getting from response,see my previous question
comment on: http://stackoverflow.com/q/27376387
score: 0
type: Comment

http://stackoverflow.com/q/27336293
score: -1
tagged with: listview
has body: hi everybody i need help i have an application with contact in list wich we can select, i want to get de value selected in the listview and send it in my second activity named View_2.xml i put the code at the end ( apologize my english i'm french). i know that i must use the PutExtra and GetExtra, but i need to get the value with the get(position) method but i don't know how. here is my mainactivity.java package com.example.messagegroupe2; import android.app.Activity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.content.Intent; import android.view.View; import android.view.View.OnClickListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; public class MainActivity extends Activity { private String[] mStrings = { "Thomas", "Audrey", "Pierre", "Paul", "Jacques", }; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ArrayAdapter&lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_multiple_choice, mStrings); ListView listView = (ListView) findViewById(R.id.listview); listView.setAdapter(adapter); final Button okButton = (Button) findViewById(R.id.Mybutton); okButton.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v) { Intent intent = new Intent(MainActivity.this, View_2.class); intent.putExtra(mStrings[position], ); 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 =…
answer count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/27336386
type: UnansweredQuestion
has title: how to get listview value and send in other activity
tagged with: android
has answer: http://stackoverflow.com/a/27336356
tagged with: java
downvote count: 1
type: Question
tagged with: android-layout
upvote count: 0

http://stackoverflow.com/q/27377971
answer count: 1
downvote count: 1
favorite count: 0
type: UnansweredQuestion
has title: JLabel instance is not showing
has answer: http://stackoverflow.com/a/27378121
tagged with: swing
has comment: http://stackoverflow.com/comment/43205401
has comment: http://stackoverflow.com/comment/43205739
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43229803
has body: I am new to Java Swing and I have a code that I want to modify. I just want to add another button; the way it is shown below in code 1, but at run time it does not show. code1 it is the code I want to add to code 2. code 1 JLabel process = new JLabel ("process:"); final JTextField Tprocess = new JTextField ("Process", 40); final JButton btn_ProcessFile = new JButton ("ProcessFile"); Code 2 JLabel Ldatei = new JLabel ("Datei auswählen:"); final JTextField Tdatei = new JTextField ("", 20); final JButton Bsearch = new JButton ("Datei wählen");
score: 0
upvote count: 1

http://stackoverflow.com/q/27326361
answer count: 0
type: UnansweredQuestion
has body: Please is there any native class that has functions for usb printer port updating and control? I'd like to queue print jobs, update and modify print files. Most especially I am hoping java has the solutions cos I'd like to read the data from a mailbox/website and queue them for printing, changing the queue jobs if so desired, even during the printing process
has comment: http://stackoverflow.com/comment/43655044
has comment: http://stackoverflow.com/comment/43118018
tagged with: java
type: Question
has title: Printer port class
has comment: http://stackoverflow.com/comment/43598958
score: 0
has comment: http://stackoverflow.com/comment/43633018
has comment: http://stackoverflow.com/comment/43111889
has comment: http://stackoverflow.com/comment/43598976

http://stackoverflow.com/comment/76142870
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27448184
type: AnswerComment
has text: @cschneider you could update your answer with the latest state of https://ops4j1.jira.com/wiki/display/PAXJDBC/PostgreSQL+Driver+Adapter given postgresql jdbc is now a valid OSGi bundle providing a DataSourceFactory

http://stackoverflow.com/q/27470825
tagged with: java
has body: I'm creating a Java Application that represents a school. My aim is to keep the application open for new features, so I'm trying to apply some Design Patterns to it. What I have so far is a HSQLDB connected to my program. In the database one can store pupils courses years exams grades The current structure is as follows: there are classes for each of the objects that contain the attributes + setters and getters for each object there is a DAO that manages the CRUD operations on the DB each DAO implements a GenericDAO interface If i want to create a new pupil i can call: PupilDao pupil = new PupilDao(); pupil.connectToDB(); pupil.add(new Pupil(name, age,...)); pupil.disconnectDB(); Every DAOs connectToDB() and disconnectDB() methods point to a DBuser-Classes connect() and disconnect() methods. So if I want to change the connection, there's only one place to do so. So far, those operations work. My questions are the: 1.) Is the current design a proper use of DAOs? I'm asking because i would rather have one Dao for all objects because right now there's a lot of repetitive code in the DAOs. (e.g. get, update, delete...) Now that the DB-Access works, I want to create a GUI using Swing. I have some experience doing this although not with the MVC-Pattern. 2.) As far as I understand, the DAOs + my object classes would be the Model here. Is that correct? 3.) My understanding of MVC is that in my View-Class (i.e. the GUI) I set listeners for my actions which point to different Controller-Classes implementing the ActionListener interface and in my Controller-Classes I would for example have a actionPerformed() that creates a new Pupil (using the DAO / Model - Classes). Am I on the right track here? 4.) Is it favourable to have one big Controller managing all actions over having different Controllers? I'm asking those questions because I read/watched a lot about patterns/OO-Design and want to make sure my understanding is correct. Furthermore I highly appreciate your thoughts on…
type: AnsweredQuestion
tagged with: user-interface
downvote count: 0
score: 1
favorite count: 0
tagged with: dao
accepted answer: http://stackoverflow.com/a/27574644
type: Question
has title: How to put DAO and GUI together with MVC
upvote count: 1
tagged with: swing
answer count: 1
tagged with: model-view-controller
has answer: http://stackoverflow.com/a/27574644

http://stackoverflow.com/comment/43352938
comment on: http://stackoverflow.com/q/27457930
score: 0
has text: what is parent layout of all images means is it Linear or Relative ?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43231585
type: QuestionComment
comment on: http://stackoverflow.com/q/27391622
has text: I'm trying to emulate the wearable. The error comes up when it tried to run the module. I've been going off some open source code, so if they used a different support library I might have missed it. I'm still very new at this so I wouldn't be surprised.
type: Comment
score: 0

http://stackoverflow.com/q/27432041
has title: Printing tree using GraphViz
favorite count: 0
tagged with: tree
accepted answer: http://stackoverflow.com/a/27783046
type: AnsweredQuestion
tagged with: java
upvote count: 1
type: Question
tagged with: graph
has body: I have written an ID3 and it prints the data. Example of output: if( Outlook == "Sunny") { if( Humidity == "High") { PlayTennis = "No"; } else if( Humidity == "Normal") { PlayTennis = "Yes"; } } else if( Outlook == "Overcast") { PlayTennis = "Yes"; } else if( Outlook == "Rain") { if( Wind == "Weak") { PlayTennis = "Yes"; } else if( Wind == "Strong") { PlayTennis = "No"; } } I have found that I could use graphviz to get the output graphically, something like below However, how can I get a dot file from the output I am getting ?
tagged with: graphviz
has answer: http://stackoverflow.com/a/27783046
tagged with: id3
downvote count: 0
answer count: 1
score: 1

http://stackoverflow.com/comment/43175756
score: 0
has text: On a side note: Your `addMen2()` is broken. It adds nothing, it only computes. Looking at how you use it you probably want to remove the declaration of `men` from it (change `int men = 1050 - (regNumber * 50);` to `men = 1050 - (regNumber * 50);`).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27361247

http://stackoverflow.com/comment/43250622
type: QuestionComment
has text: You need to ass the mappings of your entities. That's where the problem might be.
score: 0
comment on: http://stackoverflow.com/q/27396002
type: Comment

user-interface
tags question: http://stackoverflow.com/q/27381297
tags question: http://stackoverflow.com/q/27315026
tags question: http://stackoverflow.com/q/27459804
tags question: http://stackoverflow.com/q/27362063
tags question: http://stackoverflow.com/q/27345835
tags question: http://stackoverflow.com/q/27462094
tags question: http://stackoverflow.com/q/27331768
tags question: http://stackoverflow.com/q/27322845
tags question: http://stackoverflow.com/q/27322409
tags question: http://stackoverflow.com/q/27346855
tags question: http://stackoverflow.com/q/27456037
tags question: http://stackoverflow.com/q/27371331
tags question: http://stackoverflow.com/q/27436349
tags question: http://stackoverflow.com/q/27470825
tags question: http://stackoverflow.com/q/27459510
tags question: http://stackoverflow.com/q/27422422
tags question: http://stackoverflow.com/q/27318354
tags question: http://stackoverflow.com/q/27366614
tags question: http://stackoverflow.com/q/27366982
tags question: http://stackoverflow.com/q/27318486
tags question: http://stackoverflow.com/q/27410152
type: Tag
tags question: http://stackoverflow.com/q/27384000
tags question: http://stackoverflow.com/q/27466517
tags question: http://stackoverflow.com/q/27465714
tags question: http://stackoverflow.com/q/27415192
tags question: http://stackoverflow.com/q/27431362
tags question: http://stackoverflow.com/q/27329039
tags question: http://stackoverflow.com/q/27378702
tags question: http://stackoverflow.com/q/27377472
tags question: http://stackoverflow.com/q/27348650
tags question: http://stackoverflow.com/q/27455126
tags question: http://stackoverflow.com/q/27410868
tags question: http://stackoverflow.com/q/27459720
tags question: http://stackoverflow.com/q/27366310
tags question: http://stackoverflow.com/q/27392714
tags question: http://stackoverflow.com/q/27423907
tags question: http://stackoverflow.com/q/27455775
tags question: http://stackoverflow.com/q/27355958
tags question: http://stackoverflow.com/q/27390392
tags question: http://stackoverflow.com/q/27337159
tags question: http://stackoverflow.com/q/27382934
tags question: http://stackoverflow.com/q/27332859
tags question: http://stackoverflow.com/q/27458047
tags question: http://stackoverflow.com/q/27329223
tags question: http://stackoverflow.com/q/27333820
tags question: http://stackoverflow.com/q/27461325
tags question: http://stackoverflow.com/q/27466305
tags question: http://stackoverflow.com/q/27376524
tags question: http://stackoverflow.com/q/27462728
tags question: http://stackoverflow.com/q/27408649
tags question: http://stackoverflow.com/q/27438629
tags question: http://stackoverflow.com/q/27454475
tags question: http://stackoverflow.com/q/27382397
tags question: http://stackoverflow.com/q/27411589
tags question: http://stackoverflow.com/q/27343359
tags question: http://stackoverflow.com/q/27338765
tags question: http://stackoverflow.com/q/27419376
tags question: http://stackoverflow.com/q/27318866
tags question: http://stackoverflow.com/q/27344395
tags question: http://stackoverflow.com/q/27474418
tags question: http://stackoverflow.com/q/27337559
tags question: http://stackoverflow.com/q/27457816
tag name: user-interface
tags question: http://stackoverflow.com/q/27338690
tags question: http://stackoverflow.com/q/27331733
tags question: http://stackoverflow.com/q/27393158
tags question: http://stackoverflow.com/q/27338604
tags question: http://stackoverflow.com/q/27396074
tags question: http://stackoverflow.com/q/27330229
tags question: http://stackoverflow.com/q/27449347
tags question: http://stackoverflow.com/q/27332934

http://stackoverflow.com/comment/43293338
comment on: http://stackoverflow.com/a/27424351
type: Comment
score: 1
type: AnswerComment
has text: @KaterinaA. the process is a clean new environment, it wont use anything of the current environment... this is the same with you open a prompt and enter de command

http://stackoverflow.com/q/27386578
upvote count: 1
has answer: http://stackoverflow.com/a/27386815
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/27386815
has body: I would like to ask about how to make a program that should be generating three words with the length of 10 characters with first letter in uppercase and then those three words should merge so that only the first letter is in uppercase. There is a note that says to make the first letter in uppercase you should do toLowerCase and after that increase the first letter using substring.
score: 0
answer count: 3
favorite count: 0
has comment: http://stackoverflow.com/comment/43221434
has comment: http://stackoverflow.com/comment/43221437
has title: Generating random words in NetBeans IDE?
has answer: http://stackoverflow.com/a/27387186
has answer: http://stackoverflow.com/a/27395990
type: AnsweredQuestion
tagged with: netbeans
tagged with: java
accepted answer: http://stackoverflow.com/a/27387186

http://stackoverflow.com/comment/101306580
type: Comment
comment on: http://stackoverflow.com/a/27379155
score: 1
has text: Beware though that this is performance-wise probably not the optimal solution. commons-io (at least up to v2.5) uses [IOUtils](https://github.com/apache/commons-io/blob/commons-io-2.5/src/main/java/org/apache/commons/io/FileUtils.java#L753) which in turn does a (byte-wise read)[https://github.com/apache/commons-io/blob/commons-io-2.5/src/main/java/org/apache/commons/io/IOUtils.java#L2563] (at least on a buffered stream, though). If the difference is far down a large file, your performance might suffer.
type: AnswerComment

http://stackoverflow.com/q/27319423
linked to: http://stackoverflow.com/q/22360737
upvote count: 7
favorite count: 0
has comment: http://stackoverflow.com/comment/43103949
answer count: 0
type: UnansweredQuestion
tagged with: android
downvote count: 0
score: 7
tagged with: java
linked to: http://stackoverflow.com/q/26368748
has comment: http://stackoverflow.com/comment/43099386
tagged with: gradle
has comment: http://stackoverflow.com/comment/43103994
has body: I'm migrating an Android multi-module project from Ant to Gradle. We have some jars in the repo in the libs directory of a library module. The dependency is as follows: AppModule depends on LibModule. The code in AppModule cannot access contents of the library jar that is in LibModule. Although it can access from-source classes of LibModule (proving that the dependency in general is established). Gradle documentation says, that all dependencies are transitive by default, but this experience seems to invalidate such claim. Is this a bug or is there some legitimate reason? I've managed to hack it by adding a workaround dependency in AppModule: compile fileTree(dir: '../LibModule/libs', include: ['*.jar']) // HACK! But there should be a more DRY way to do this, right? Gradle version: 2.1. Interestingly, Android Studio appears to respect the transitiveness of the jar and does not signal an error. The error occurs when I'm building using ./gradlew assembleDebug Thy typical java error is signalled: error: package net.jcip.annotations does not exist import net.jcip.annotations.NotThreadSafe; ^ I know I can also specify deps in a maven-ish style, but we would like to be able to work with jars-in-the-repo as well, for our purposes. TIA, Karol
type: Question
has comment: http://stackoverflow.com/comment/43100542
has title: Gradle transitive dependency to JAR inside of a library module
tagged with: jar

http://stackoverflow.com/a/27442303
score: 1
has comment: http://stackoverflow.com/comment/43327054
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: Try to use webSocket API. For example it is available in Sails based on node.js There is also a java EE websocket implementation.
has comment: http://stackoverflow.com/comment/43392041
type: Answer
accepted answer of: http://stackoverflow.com/q/27442252
has comment: http://stackoverflow.com/comment/43373726
has comment: http://stackoverflow.com/comment/43326504
has comment: http://stackoverflow.com/comment/43393786
answers question: http://stackoverflow.com/q/27442252

http://stackoverflow.com/q/27415980
has answer: http://stackoverflow.com/a/27416028
answer count: 3
favorite count: 0
type: UnansweredQuestion
has title: Writing code - Class - Is this correct/Grade my code
score: -3
upvote count: 1
has body: Requirement: Write a class, BankAccount, that has two instance variables for the name of the owner (of type String) and the balance (of type double). Add to this class the following methods: A constructor that initializes the BankAccount instance variables to the values in two parameters, the name of the owner and the initial balance (>=0.0). deposit: Given an amount (>0.0) to deposit, this method deposits it into the account. withdraw: Given an amount (>0.0 and &lt;= current balance) to withdraw, this method withdraws it from the account. getName: This method returns the owner name. getBalance: This method returns tth current balance. (Don't try to format a number-just take the default.) Include appropriate checks in your methods to ensure that the amounts deposited and withdrawn satisfy the constraints specified. Use good encapsulation guidelines. Did I interpret this correctly and execute it correctly and if not what needs fixed and how. Any help is appreciated. Code: import java.util.*; public class BankAccount { static Scanner in = new Scanner (System.in); private static String name; private static double balance; public BankAccount(String n, double b){ System.out.println("Enter your name: "); n = in.nextLine(); name = n; System.out.println("Enter your current balance: "); b = in.nextDouble(); balance = b; } public void deposit(){ System.out.println("Enter the amount you would like to deposit: "); double deposit = in.nextDouble(); if(deposit &gt; 0.0){ balance = balance + deposit; } } public void withdraw(){ System.out.println("Enter the amount you would like to withdraw: "); double withdraw = in.nextDouble(); if(withdraw &gt; 0.0 &amp;&amp; withdraw &lt;= balance){ balance = balance - withdraw; } } public static String getName(){ return name; } public static double getBalance(){ return balance; } }
tagged with: java
has comment: http://stackoverflow.com/comment/43276041
has answer: http://stackoverflow.com/a/27416208
tagged with: methods
type: Question
has answer: http://stackoverflow.com/a/27416074
downvote count: 4
has comment: http://stackoverflow.com/comment/43275957
tagged with: class

http://stackoverflow.com/comment/43135238
comment on: http://stackoverflow.com/q/27328754
score: 0
type: Comment
type: QuestionComment
has text: we implemented an if statement in the client to only display the image when it is not null and to print when the image received is/is not null. The first image has data. Every one after that is null. For some reason only one image is sent then it's all null.

http://stackoverflow.com/a/27593299
answers question: http://stackoverflow.com/q/27415449
type: Answer
score: 2
downvote count: 0
upvote count: 2
has body: Use XPath and be in peace package xml; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import javax.xml.xpath.XPathFactory; import org.w3c.dom.Document; import org.w3c.dom.NodeList; public class XPathTest { public static void main(String[] args) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); // never forget this! DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.parse("sample.xml"); XPathFactory xpathfactory = XPathFactory.newInstance(); XPath xpath = xpathfactory.newXPath() XPathExpression expr = xpath.compile("string(/menu/day[@name='monday']/meal[@name='BREAKFAST']/counter/@name))"); Object result = expr.evaluate(doc, XPathConstants.NODESET); return (String)result; } }

http://stackoverflow.com/comment/103807668
type: Comment
has text: if one of set is null how do you deal with that
type: AnswerComment
comment on: http://stackoverflow.com/a/27358390
score: 0

http://stackoverflow.com/q/27342377
type: Question
tagged with: spring-mvc
has body: I know that this question has been asked an incredible amount of times, but I have followed all answers (at least that's how it feels) and still cannot figure out what is wrong and why I am getting these exceptions. I am trying to build a simple Spring MVC webapp using Maven where I would have users in the database who would be able to log in. Followed several tutorials to do so, and everything seems to be right to me. This is my console output: Dec 06, 2014 10:37:53 PM org.springframework.web.context.ContextLoader initWebApplicationContext SEVERE: Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'helloController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: public vermilion.calendar.service.UserService vermilion.calendar.controller.HelloController.userService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: public vermilion.calendar.dao.UserDAO vermilion.calendar.service.UserServiceImpl.userDAO; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDAO': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: public org.hibernate.SessionFactory vermilion.calendar.dao.UserDAOImpl.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.springframework.jdbc.datasource.DataSourceUtils.doCloseConnec…
has comment: http://stackoverflow.com/comment/43140472
tagged with: java
has comment: http://stackoverflow.com/comment/43140801
score: 0
has answer: http://stackoverflow.com/a/27342893
has comment: http://stackoverflow.com/comment/43140875
answer count: 1
tagged with: tomcat
accepted answer: http://stackoverflow.com/a/27342893
has title: org.springframework.beans.factory.BeanCreationException in Spring MVC Maven project
tagged with: spring
type: AnsweredQuestion
tagged with: maven

http://stackoverflow.com/comment/43124035
comment on: http://stackoverflow.com/a/27333035
score: 0
type: Comment
has text: If you're inserting the UUID as it is, then it will be in plain text only. If you want to encrypt it, you can use built-in MySQL hash functions like SHA1(), MD5(), etc. A complete reference can be found here: [link](http://dev.mysql.com/doc/refman/5.5/en/encryption-functions.html)
type: AnswerComment

http://stackoverflow.com/comment/43635681
score: 1
has text: After I updated the CXF version to 3.0.3 and fixed the xsd's in the `avengers-hulc-flow-context.xml` it worked. thanks @Jeff.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27512440

http://stackoverflow.com/q/27445045
accepted answer: http://stackoverflow.com/a/27445096
tagged with: ibatis
tagged with: multithreading
tagged with: jdbc
type: AnsweredQuestion
has title: Can two different database framework for single application share the same connection object?
tagged with: java
has answer: http://stackoverflow.com/a/27445096
type: Question
tagged with: database
has body: I have an application in which a.jar is using jdbc framework and b.jar is using ibatis framework for database connectivity,a database operation on a.jar is taking 10 mins for executing as it is having large rows,so can a data base oparation on b.jar will also take time? According to my knowledge both will have different connection object,but sometimes i mean very intermittenty this issue in which execution of query on b.jar will result in wait because of large query execution in a.jar resulting in entire jvm hung. So my question is:are both the frameworks are using the same connection object because of which threads are hanging?Please help me,we are facing these issues in production.
score: 0
answer count: 1

http://stackoverflow.com/comment/43324352
type: AnswerComment
comment on: http://stackoverflow.com/a/27437001
type: Comment
has text: @FereRes: I added a full example
score: 0

http://stackoverflow.com/a/27416562
downvote count: 0
answers question: http://stackoverflow.com/q/27414282
has body: well,I solved this problem by using google precompiled WebP utilities and library.It just need libWebp,you can find other version to match your system in http://downloads.webmproject.org/releases/webp/index.html. Then execute it in java,then is the code: //the "dwebp.exe"'s path String str1 = "D:/workspace/demo/Test/libwebp-1.3.0-windows-x64/bin/dwebp.exe"; //the webp picture's path String str2 = "D:/workspace/demo/Test/unnamed.webp"; //the converted picture's path String str3 = "D:/workspace/demo/Test/xixi.png"; args = new String[]{str1, str2, "-o", str3}; try { Runtime.getRuntime().exec(args); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } It can convert webp to PNG, JPEG, TIFF, WebP or raw Y'CbCr samples.
score: 10
upvote count: 10
type: Answer

http://stackoverflow.com/comment/43216633
has text: From looking for a reference in their documentation, it looks like it is designed to enforce required properties by either the @Required OR by using constructor injection. "@ Required allows you to instruct Spring to check required dependencies for you. In case you are not in the position to use constructor injection, or for whatever other reasons, you prefer setter injection, @ Required is the way to go." http://spring.io/blog/2007/07/11/setter-injection-versus-constructor-injection-and-the-use-of-required/ (yes, I realize that is old).
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27383245
score: 0

http://stackoverflow.com/comment/43238582
comment on: http://stackoverflow.com/q/27381732
has text: passing the pdf through the thread...see my update
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27378527
has comment: http://stackoverflow.com/comment/43206453
has body: I have read that synchronized void f() { /* body */ } is equivalent to void f() { synchronized (this) { /* body */ } }. So when we do a synchronization of a singleton's get method what object are we synchronizing on. Is it the Class or is it the Object? public class YourObject { private static YourObject instance; private YourObject() { } public static synchronized YourObject getInstance() { if (instance == null) { instance = new YourObject(); } return instance; } } Is this equivalent to - public static YourObject getInstance() { synchronized (this) { /* body */ } } or public static YourObject getInstance() { synchronized (YourObject.class) { /* body */ } }
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43206826
has comment: http://stackoverflow.com/comment/43206413
has comment: http://stackoverflow.com/comment/43206495
score: 0
tagged with: java
tagged with: concurrency
has answer: http://stackoverflow.com/a/27378587
accepted answer: http://stackoverflow.com/a/27378587
possible better answer: http://stackoverflow.com/a/27379634
tagged with: singleton
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43206435
has answer: http://stackoverflow.com/a/27379634
linked to: http://stackoverflow.com/q/15329731
tagged with: synchronization
has comment: http://stackoverflow.com/comment/43206627
has title: What is a Singleton instance synchronized on?

http://stackoverflow.com/q/27356139
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43167688
has body: I need to import 2 or more values from excel and compare the value which i have in my li's , the code i have used is FileInputStream input=new FileInputStream(new File("TestCase.xls")); HSSFWorkbook workbook=new HSSFWorkbook(input); HSSFSheet sheet=workbook.getSheet("KeywordFramework"); System.out.println("i am in"); int rowNum = sheet.getLastRowNum() + 1; System.out.println(rowNum); int colNum = sheet.getRow(0).getLastCellNum(); System.out.println(colNum); String data [][] = new String[rowNum][colNum]; for(int i =1 ; i&lt; rowNum;i++) { System.out.println("1"); HSSFRow row = sheet.getRow(i); for(int j = 0; j&lt;= colNum;j++) { System.out.println("2"); HSSFCell cell = row.getCell(j); String Cellvalue = cellToString(cell); System.out.println("cellvalue === "+Cellvalue); switch(j) { `case 1: case 2: ExpectedOP=Cellvalue; System.out.println("Expected output (value to be compared) = "+ExpectedOP); int LastRow = 1; List &lt;WebElement&gt; we = driver.findElements(By.xpath(".//*[@id='stepList']/li"));//Getting list of elements in steplist ul for(int i1=2;i1&lt;=we.size();i1++) { String sr [] =new String [10]; sr [i1]=driver.findElement(By.xpath(".//*[@id='stepList']/li["+i1+"]")).getText().trim();//Getting required li text data (example : abc) for (String j1:sr) { if(j1 != null) { String [] parts = sr [i1].split("/");//Spliting to get the required data String parta = parts [0].trim();//Triming the whitespaces System.out.println("Step value = "+parta); if(ExpectedOP.equals(parta))//Comparing value in Excel with value got in excel { System.out.println("compare pass"); String status="PASS"; [Write into excel]; break; } else { System.out.println("compare pass"); String status="Fail"; [Write into excel]; break; }//Close else }//Close if j1 null }//Close for j1 }//Close i1 for loop }//Close Switch(j) }}}//Close the rest` The value of Excel is not getting incremented once i get the next value , i.e., say if the first value from excel was abc and abc is compared with the value in…
has title: how to compare two or more values in excel with values in li and report pass or fail in same excel using apache poi selenium webdriver java
has comment: http://stackoverflow.com/comment/43166547
tagged with: apache-poi
type: UnansweredQuestion
score: 1
has comment: http://stackoverflow.com/comment/43166617
tagged with: java
tagged with: selenium
upvote count: 1
tagged with: excel
type: Question
has comment: http://stackoverflow.com/comment/43166809
has comment: http://stackoverflow.com/comment/43166717
has comment: http://stackoverflow.com/comment/43167011
has comment: http://stackoverflow.com/comment/43166172
has answer: http://stackoverflow.com/a/27357723
has comment: http://stackoverflow.com/comment/43167451
answer count: 1

http://stackoverflow.com/q/27365642
upvote count: 1
answer count: 1
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43183981
has answer: http://stackoverflow.com/a/27365724
downvote count: 1
tagged with: average
has comment: http://stackoverflow.com/comment/43184481
tagged with: arrays
has comment: http://stackoverflow.com/comment/43183400
has body: Does anyone know how to display the average race time for participants in this simple program? It would also be great to display the associated runners name with the time. I think that I have the arrays structure properly and have taken in the user input. Thanks for any assistance you can provide. Here's my code... import java.util.Scanner; public class RunningProg { public static void main (String[] args) { int num; Scanner input= new Scanner (System.in); System.out.println("Welcome to Running Statistical Analysis Application"); System.out.println("******************************************************************* \n"); System.out.println("Please input number of participants (2 to 10)"); num=input.nextInt(); // If the user enters an invalid number... display error message... while(num&lt;2|| num &gt;10) { System.out.println("Error invalid input! Try again! \nPlease input a valid number of participants (2-10)..."); num=input.nextInt(); } // declare arrays double resultArray [] = new double [num]; // create result array with new operator String nameArray [] = new String [num];// create name array with new operator // Using the num int will ensure that the array holds the number of elements inputed by user // loop to take in user input for both arrays (name and result) for (int i = 0 ; i &lt; nameArray.length ; i++) { System.out.println ("Please enter a race participant Name for runner " + (i+1) ); nameArray[i] = input.next(); System.out.println ("Please enter a race result (time between 0.00 and 10.00) for runner " + (i+1) ); resultArray[i] = input.nextDouble(); }
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43183344
has title: Average of an array and associate with name
has comment: http://stackoverflow.com/comment/43183529
favorite count: 0
type: Question

http://stackoverflow.com/q/27470910
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/43376833
tagged with: jaxb
type: Question
has comment: http://stackoverflow.com/comment/43376910
has answer: http://stackoverflow.com/a/27471572
downvote count: 0
has title: How to ignore a field from binding to XML with JAXB
accepted answer: http://stackoverflow.com/a/27471572
score: 3
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
has body: I have a simple class that looks like this import nl.hu.pf.coproco.model.Observeable; @XmlRootElement (name = "Purpose") @XmlAccessorType (XmlAccessType.FIELD) public class Purpose implements Observeable{ private String name; private ArrayList<Observer> observers; @XmlElement (name = "subPurpose") private ArrayList subPurposes; //methods } But Observable is an interface so I get an exception because JAXB can'ty handle interfaces. I tried figuring out how to ignore the field with the ArrayList<Observer> so it wont be exported to xml. I tried using the @XmlTransient annotation but the I get the following eception javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"purpose"). Expected elements are <{}Purpose> This happens when Unmarshalling but I want to Marshall that class too Sample xml <?xml version="1.0" encoding="UTF-8" standalone="yes"?> All Purposes Creational Structural Behavioral Behavioral 1 Behavioral 2 The interface Observable looks like this: public interface Observeable { public void registerObserver(Observer o); public void removeObserver(Observer o); public void notifyObservers(Object o, String arg); }
has comment: http://stackoverflow.com/comment/43376813
type: AnsweredQuestion

http://stackoverflow.com/comment/43224876
type: AnswerComment
score: 0
has text: Also, read OP's question again: **I am not allowed to use a concurrent hash map.**
type: Comment
comment on: http://stackoverflow.com/a/27388478

http://stackoverflow.com/comment/43209496
score: 0
comment on: http://stackoverflow.com/q/27368074
type: Comment
type: QuestionComment
has text: You don't use a redis client library? Like Jedis?

http://stackoverflow.com/comment/43364595
type: Comment
type: QuestionComment
has text: It's unlikely to make a difference whether a method is static or non static when it comes to recursion. Could you give an example of a method where you think it would?
score: 0
comment on: http://stackoverflow.com/q/27464200

http://stackoverflow.com/q/27353368
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has title: Where do those beans returned by Spring getBean method come from?
type: Question
tagged with: dependency-injection
accepted answer: http://stackoverflow.com/a/27353573
tagged with: aop
answer count: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/27353772
has body: Could you please list all possible sources of getBean? BTW, If I just write context.getBean(SomeInterface.class), can I get the implementation of the interface class?
has answer: http://stackoverflow.com/a/27353772
tagged with: spring
has answer: http://stackoverflow.com/a/27353573

http://stackoverflow.com/q/27446383
possible better answer: http://stackoverflow.com/a/27447550
has comment: http://stackoverflow.com/comment/43332246
upvote count: 1
has comment: http://stackoverflow.com/comment/43331781
has answer: http://stackoverflow.com/a/27466666
accepted answer: http://stackoverflow.com/a/27466666
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27447550
answer count: 2
tagged with: android-mediaplayer
has comment: http://stackoverflow.com/comment/43333772
tagged with: arrays
downvote count: 0
favorite count: 0
tagged with: android
has body: I create an Array of sound and then I need to play them but I can hear just first sound : This my Array : public static class Marrays{ public static String[] Zero(){ String[] OK = new String[] {"num1.mp3" , "increment.amr", "num1.mp3"}; return OK; } } And : String[] a = Marrays.Zero(); And I use from above array : for (int i = 0; i &lt; a.length; i++) { try { AssetFileDescriptor afd = getAssets().openFd(a[i]); mediaPlayer.stop(); mediaPlayer.release(); mediaPlayer = new MediaPlayer(); mediaPlayer.setDataSource(afd.getFileDescriptor(),afd.getStartOffset(),afd.getLength()); mediaPlayer.prepare(); mediaPlayer.start(); } catch (IllegalArgumentException e) { Toast.makeText(getApplicationContext(), e.toString() , Toast.LENGTH_SHORT).show(); } catch (IllegalStateException e) {Toast.makeText(getApplicationContext(), e.toString() , Toast.LENGTH_SHORT).show(); } catch (IOException e) { Toast.makeText(getApplicationContext(), e.toString() , Toast.LENGTH_SHORT).show();} }
has title: How I can play an array from sounds ? - Android

http://stackoverflow.com/comment/43142736
has text: i would not like to read these words `ExecutorService` `Future` with the level of knowledge i have about java threads. thank you
comment on: http://stackoverflow.com/a/27343697
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27343743
accepted answer: http://stackoverflow.com/a/27543372
tagged with: android
has comment: http://stackoverflow.com/comment/43145069
has comment: http://stackoverflow.com/comment/43149870
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: multithreading
type: Question
score: 3
has body: I'm having an issue with my Android application. When the application tries to save a ParseObject sometimes it blocks UI and generates ANR. According to the generated traces.txt, only one of the method I've written is involved, that is saveClimbing. This method simply calls onSaveBackground on a ParseObject: public static void saveClimbing(final ParseObject p_climbing, final Climbing l_climbing){ p_climbing.saveInBackground(new SaveCallback() { @Override public void done(ParseException ex) { if(ex == null){ //no problems l_climbing.setSaved(true); ClimbApplication.climbingDao.update(l_climbing); Log.i(getClass().getName(), "Climbing correctly saved in Parse"); }else{ l_climbing.setSaved(false); ClimbApplication.climbingDao.update(l_climbing); Log.e(getClass().getName(), ex.getMessage()); } } }); } The other involved method is ParseUser.saveCurrentUserAsync and it causes starvation, but I cannot understand when it is called and it is causing this. Am I doing something wrong? This is the first part of the traces.txt: JNI: CheckJNI is off; workarounds are off; pins=0; globals=180 (plus 1 weak) DALVIK THREADS: (mutexes: tll=0 tsl=0 tscl=0 ghl=0) "main" prio=5 tid=1 MONITOR | group="main" sCount=1 dsCount=0 obj=0x41700578 self=0x4009c120 | sysTid=26943 nice=0 sched=0/0 cgrp=apps handle=1074999292 | state=S schedstat=( 0 0 0 ) utm=3698 stm=442 core=0 at com.parse.ParseUser.getSessionToken(ParseUser.java:~439) - waiting to lock &lt;0x41fec980&gt; (a java.lang.Object) held by tid=21 (Task.BACKGROUND_EXECUTOR-thread-47) at com.parse.ParseUser.getCurrentSessionToken(ParseUser.java:963) at com.parse.ParseObject.saveAsync(ParseObject.java:1348) at com.parse.ParseObject$9.then(ParseObject.java:1337) at com.parse.ParseObject$9.then(ParseObject.java:1333) at com.parse.TaskQueue.enqueue(TaskQueue.java:58) at com.parse.ParseObject.saveAsync(ParseObject.java:1333) at com.parse.ParseObject.saveInBackground(ParseObject.java:1424) at org.unipd.nbeghin.climbtheworld.util.ParseUtils.saveC…
has comment: http://stackoverflow.com/comment/43244666
has title: ParseUser and ParseObject in threads cause ANR
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27543372
favorite count: 0
tagged with: parse-platform
has comment: http://stackoverflow.com/comment/43244898

http://stackoverflow.com/q/27385820
has answer: http://stackoverflow.com/a/27385913
has comment: http://stackoverflow.com/comment/43220084
type: Question
type: AnsweredQuestion
has title: Error implementing my interface?
accepted answer: http://stackoverflow.com/a/27385913
score: 0
tagged with: interface
answer count: 1
has comment: http://stackoverflow.com/comment/43219907
has comment: http://stackoverflow.com/comment/43220185
tagged with: java
has body: im a beginner in java and have been coding for about 4 months now. I was given an assignment where i had to create an interface and a custom class that calls that interface and inside of this interface is a getmethod that calculates carbonfootprints of things. I am at a loss at what to do and have attempted to code some stuff. When i created my interface and tried to implement it, it gave me this error: "Project11D is not abstract and does not override abstract method getcarbonfootprint() in carbonfootprint" My interface is probably wrong but this is what i have. (It isn't much but i would appreciate any help). Interface public interface CarbonFootprint{ public abstract double getCarbonFootprint() ; } } Custom class public class project11D implements CarbonFootprint { public project11D () { } }
has comment: http://stackoverflow.com/comment/43219960

http://stackoverflow.com/q/27323346
has answer: http://stackoverflow.com/a/27323443
has body: I have a string which can vary : String filePath = "/this/is/my/file.txt"; I need to get this string to other strings that information : "/this/is/my" and "file.txt" I tried this method but it failed(crash) : int counter = 0; filePath = "/this/is/my/file.txt"; String filePath2 = filePath.substring(filePath.lastIndexOf("/") + 1); // return "file.txt" for (int i = 0; i &lt; filePath2.length(); i++) { counter++; // count number of char on filePath2 } String filePath3 = filePath3.substring(filePath.lastIndexOf("") + counter); // Remove "file.txt" from filePath2 depending of character numbers on filePath2 backwards Anyone know a better method? Thanks! 12-05 15:53:00.940 11102-11102/br.fwax.paulo.flasher E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: br.fwax.paulo.flasher, PID: 11102 java.lang.RuntimeException: Unable to start activity ComponentInfo{br.fwax.paulo.flasher/br.fwax.paulo.flasher.MFlasher}: java.lang.StringIndexOutOfBoundsException: length=21; index=29
accepted answer: http://stackoverflow.com/a/27323443
has comment: http://stackoverflow.com/comment/43105992
has answer: http://stackoverflow.com/a/27323489
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27323457
tagged with: java
type: Question
score: 0
tagged with: string
has comment: http://stackoverflow.com/comment/43106121
answer count: 3
has answer: http://stackoverflow.com/a/27323457
tagged with: android
has title: Get specific characters in a string

http://stackoverflow.com/comment/43134328
comment on: http://stackoverflow.com/a/27338815
has text: If I still wanted to put it in an anonymous inner class, would I have to use a try/catch block, or is there another way to do it?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43249040
type: Comment
has text: In addition, I want to ask how do I interpret `<? extends E> c` ?
comment on: http://stackoverflow.com/a/27401983
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43139718
type: AnswerComment
has text: Actually this option you ll find in your Android device you are deploying the application.
score: 0
comment on: http://stackoverflow.com/a/27333669
type: Comment

http://stackoverflow.com/comment/43203983
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27375902
score: 1
has text: 26 characters does not include a space. So, how do you think this could work? In all seriousness. Either you have 26chars + space or you don't have spaces. In fact, why on earth should one want to limit this to only letters? There are punctuation, braces, parenthesis and there are non-english texts (and even in English é is a valid character)

timezone
tags question: http://stackoverflow.com/q/27427530
type: Tag
tag name: timezone
tags question: http://stackoverflow.com/q/27320200
tags question: http://stackoverflow.com/q/27398906
tags question: http://stackoverflow.com/q/27416464
tags question: http://stackoverflow.com/q/27366947

http://stackoverflow.com/q/27346103
type: Question
accepted answer: http://stackoverflow.com/a/27346317
has body: I use a program called TexturePacker to pack individual image assets into a single texture atlas for use in-game. My usual workflow is to add/change the assets, then manually re-pack the images using the GUI or command line, with the output being sent to the projects resource folder where it remains under source control. This works, but it's tedious. At any rate, it feels more "right" to have the individual assets be within the project's root folder under source control, and have the "pack to textureAtlas" step be an automated part of of the build. Analogous to how we keep source code under VC but not the build-related files. So my question becomes, how can I do this with gradle? As far as I can tell the steps would be: .gitignore the output folder (easy) Hook into the subproject's Clean task, and delete the output folder (in main/resources) Hook into subproject's build task (or wherever's most appropriate), and run the JAR from gradle. I found an article about running JARs from gradle and it seems straightforward, but the rest baffles me. I realize this is probably a really basic question, I just have some sort of mental block with gradle, I just can't wrap my head around it for some reason. Anyway, my question is how to best approach this problem; hopefully that'll help me get a handle on gradle in general. Thanks for reading!
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27346317
has title: Extending a gradle subproject's clean and build behavior
type: AnsweredQuestion
tagged with: java
tagged with: gradle

http://stackoverflow.com/q/27332545
has comment: http://stackoverflow.com/comment/43122611
has comment: http://stackoverflow.com/comment/43122799
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27332704
tagged with: java
type: Question
upvote count: 4
downvote count: 0
has body: I am very new to Java and I have code like this: public class Puzzle { public static void main(String... args) { System.out.println("Hi Guys!"); // Character myChar = new Character('\u000d'); } } You can see the line: Character myChar = new Character('\u000d'); is commented out. But still, I get an error like this when I run javac: Puzzle.java:9: error: unclosed character literal // Character myChar = new Character('\u000d'); ^ 1 error In this blog post I found the reason for the exception. The blog says: Java compiler, just before the actual compilation strips out all the unicode characters and coverts it to character form. This parsing is done for the complete source code which includes the comments also. After this conversion happens then the Java compilation process continues. In our code, the when Java compiler encounters \u000d, it considers this as a newline and changes the code as below, public class Puzzle { public static void main(String... args) { System.out.println("Hi Guys!"); // Character myChar = new Character(' '); } } With this I have two questions: Why does Java parse the unicode first? Are there any advantages to it? Because the line is still commented, Java is trying to parse it! Is this the only case it does? Or does it generally parse the commented lines too? I'm confused. Thanks in advance.
score: 4
tagged with: unicode
has comment: http://stackoverflow.com/comment/43122765
linked to: http://stackoverflow.com/q/13761848
has title: Why is the java compiler stripping all unicode characters before the actual compilation?
answer count: 1
has answer: http://stackoverflow.com/a/27332704
has comment: http://stackoverflow.com/comment/43122616
tagged with: parsing
favorite count: 0
duplicate of: http://stackoverflow.com/q/13761848
has comment: http://stackoverflow.com/comment/43122621

http://stackoverflow.com/comment/43266435
comment on: http://stackoverflow.com/q/27410318
score: 0
type: Comment
type: QuestionComment
has text: is your device rooted?

http://stackoverflow.com/comment/43338139
type: Comment
comment on: http://stackoverflow.com/a/27399776
has text: Somehow it must work! See [https://play.google.com/store/apps/details?id=com.jiubang.goscreenlock](https://play.google.com/store/apps/details?id=com.jiubang.goscreenlock)
score: 0
type: AnswerComment

http://stackoverflow.com/q/27419360
has answer: http://stackoverflow.com/a/28047425
tagged with: maven
linked to: http://stackoverflow.com/q/18210389
score: 3
upvote count: 3
tagged with: java
type: Question
tagged with: maven-module
has body: I have a complex scenario of packaging my EAR projects, below is the sort of visual description to fully understand it: ProjA.ear |-- ProjA.war |-- Util.war | |-- WEB-INF | | |-- classes | | | -- log4j.properties Similarly, I have another project whose structure is: ProjB.ear |-- ProjB.war |-- Util.war | |-- WEB-INF | | |-- classes | | | -- log4j.properties Util.war is a common project (except log4j.properties) for both ProjA and ProjB. Below is how I have specified the dependency of Util.war in both ProjA and ProjB: abc xyz ${project.version} war Now the question is: As I have different versions of log4j.properties file for each project, how can I configure Maven to add ProjA specific file while packaging ProjA and use the other version when packaging ProjB? Please let me know if you don't understand the jumbled scenario :). Regards,
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/12191794
tagged with: maven-war-plugin
has title: Exclude properties file from a WAR type sub-module in Maven
type: UnansweredQuestion

http://stackoverflow.com/q/27460201
has comment: http://stackoverflow.com/comment/43357215
has body: I need to get the number of frames captured of a video using OpenCV with Java. I'm capturing the video through a webcam. I tried to use: CV_CAP_PROP_POS_MSEC in capture.get() but it seems like it is not working. I found a similar question here but didn't get any successful way to do this. I'm using OpenCV 2.4.8. Can anyone please give me any idea of how to do this? Thanks in advance!
answer count: 0
has comment: http://stackoverflow.com/comment/43357104
tagged with: video-processing
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43357712
has title: How to get the number of frames captured in a video stream?
tagged with: opencv
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/21066875
score: 0

http://stackoverflow.com/comment/43173330
score: 1
type: Comment
has text: Also, [the JDK](https://docs.oracle.com/javase/8/docs/api/java/util/StringTokenizer.html) says: "StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use the split method of String or the java.util.regex package instead."
type: QuestionComment
comment on: http://stackoverflow.com/q/27360633

http://stackoverflow.com/q/27454608
type: UnansweredQuestion
has body: I'm trying to iterate over a Map in Java ... it looks good to me but it's not. The error I'm getting is Required: java.util.Map.Entry &lt;java.lang.Integer, com.model.Horse&gt; Found: java.lang.Object Here's my code public Map loadHorses() { Map&lt;Integer, Horse&gt; horses = new HashMap&lt;Integer, Horse&gt;(); // static set of horses, no reason not to hardcode them horses.put(1, new Horse("That Darn Gray Cat", 5, false)); horses.put(2, new Horse("Fort Utopia", 10, false)); horses.put(3, new Horse("Count Sheep", 9, false)); horses.put(4, new Horse("Ms Traitour", 4, false)); horses.put(5, new Horse("Real Princess", 3, false)); horses.put(6, new Horse("Pa Kettle", 5, false)); horses.put(7, new Horse("Gin Stinger", 6, false)); return horses; } public void displayHorses(Map horses) { StringBuilder sb = new StringBuilder(); sb.append("Horses:\n"); for(Map.Entry&lt;Integer, Horse&gt; horse : horses.entrySet()){ sb.append(horse.getKey() + ", " + horse.getValue().getName() + ", " + horse.getValue().getOdds() + ", " + horse.getValue().isWon()); } } What am I doing wrong?
tagged with: dictionary
tagged with: foreach
has comment: http://stackoverflow.com/comment/43347536
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43347226
type: Question
tagged with: hashmap
duplicate of: http://stackoverflow.com/q/2770321
score: 0
linked to: http://stackoverflow.com/q/2770321
has comment: http://stackoverflow.com/comment/43347233
has title: Iterate over a Map

http://stackoverflow.com/comment/43220426
type: Comment
comment on: http://stackoverflow.com/a/27322751
has text: I figured out what I did, I did forget to initialize it. Thanks!
type: AnswerComment
score: 0

http://stackoverflow.com/a/27319708
score: 0
answers question: http://stackoverflow.com/q/27319672
type: Answer
has body: You must put the variable declaration outside the loop and if. Declare that way: public E getFromResults(int o) { Node tempNode = head; E result = null; for(int i=1; i&lt;= size; i++) { if(i==o) { result = (E) tempNode.getElement(); break; } tempNode=tempNode.getNext(); } return result; } Because it is not guaranteed that it will go through the loop and if so the result variable can never exist at some point.

http://stackoverflow.com/q/27367322
has title: getting a ComplianceException
tagged with: java
score: 0
type: Question
tagged with: weblogic
tagged with: ejb
accepted answer: http://stackoverflow.com/a/27382590
tagged with: build-process
has body: when trying to run weblogic.appc on my app I get the following error: "In EJB CallerEJB, the throws clause for method hasBalance(java.lang.String) in the bean class contains exceptions that are NOT in the throws clause of the corresponding remote interface method." This is the method in my remote interface: public boolean hasBalance(String sin) throws RemoteException, NamingException, CreateException, XrefAccountNumberException, AccountNotFoundException, AccountBadFormatException, ExclusiveLockException, ValidationException; This is the method in the bean class: public boolean hasBalance(String sin) throws RemoteException, NamingException, CreateException, XrefAccountNumberException, AccountNotFoundException, AccountBadFormatException, ExclusiveLockException, ValidationException{ ... } I don't understand why weblogic thinks they have different exceptions.
answer count: 1
tagged with: exception
has answer: http://stackoverflow.com/a/27382590
type: AnsweredQuestion

http://stackoverflow.com/a/27447921
accepted answer of: http://stackoverflow.com/q/27427423
answers question: http://stackoverflow.com/q/27427423
score: 0
type: AcceptedAnswer
type: Answer
has body: It was the org.apache.cxf.impl dependency that I was missing, now everything works great !

http://stackoverflow.com/a/27460806
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/27460751
has body: public class MainThread { public static Thread t; public static void main(String[] args) { t = new Thread(new WorkerThread()); t.start(); } } public class StopThread { public static void main(String[] args) { MainThread.t.interrupt(); } } It is not safe to call Thread.stop() it is listed as deprecated in JavaDocs Also this may be just for the sake of this question, but why does your program have two main methods?
score: 1
has comment: http://stackoverflow.com/comment/43358025
upvote count: 2
has comment: http://stackoverflow.com/comment/43358060

http://stackoverflow.com/q/27402803
possible better answer: http://stackoverflow.com/a/27408705
has title: No qualifying bean of type [services.ExportService] found for dependency
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27408705
type: Question
accepted answer: http://stackoverflow.com/a/27403185
linked to: http://stackoverflow.com/q/4093504
has body: I get an error on a simple Spring project and I don't know the cause of this error - No qualifying bean of type [services.ExportService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'helloController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [services.ExportService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.annotation.Resource(shareable=true, mappedName=, description=, name=, type=class java.lang.Object, authenticationType=CONTAINER)} at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:306) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1146) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628) at org.springframework.context.support.AbstractApplicationContext.fin…
tagged with: java
has answer: http://stackoverflow.com/a/27403185
score: 0
answer count: 2

http://stackoverflow.com/q/27405071
answer count: 0
has title: How to convert a byte array into a PDF file?
tagged with: java
tagged with: inputstream
type: Question
tagged with: jakarta-ee
upvote count: 2
has comment: http://stackoverflow.com/comment/43255706
has comment: http://stackoverflow.com/comment/43256880
has comment: http://stackoverflow.com/comment/43255899
has body: I have the following problem trying to create a PDF from an array of byte recovered from a Web Services output object. So I have the following situation: OutFat outFat = callServizioContabRighe(dataEM, esercizio, importo, bolla, numDoc, oda, pIva, contratto); byte[] pdfByteArray = outFat.getPDF(); ByteArrayOutputStream osPdf = new ByteArrayOutputStream(); if(pdfByteArray != null) { InputStream is = new ByteArrayInputStream(pdfByteArray); sun.misc.BASE64Decoder base64Decoder = new BASE64Decoder(); byte[] byteArray64DecodePdf = null; try { byteArray64DecodePdf = base64Decoder.decodeBuffer(is); } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } try { osPdf.write(byteArray64DecodePdf); } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } } if(osPdf != null &amp;&amp; pdfByteArray != null){ req.getSession().setAttribute("PdfEM", osPdf); // Usa il PDF recuperato dal WS } else { req.getSession().setAttribute("PdfEM", createPdfEM.createPdf()); // Crea il PDF } if(osPdf != null &amp;&amp; pdfByteArray != null){ this.baos = osPdf; } else { this.baos = createPdfEM.createPdf(); // CREA IL PDF } Ok so I have the pdfByteArray that is the byte array retrieved from the outFat object (the webservice output object) and that represent my PDF. Now I have to use it to build a PDF and show it into a view. So to create the PDF I do the following steps: I create an InputStream object using the pdfByteArray retrieved by the WS. I decode it (it is in base64 so I need to decode it). I write the decoded byteArray64DecodePdf into the osPdf outpustream object. Then, if the previous steps are successful, I put it into my view (otherwise I create my PDF in an alternative way but this is not related to this question). The problem is that in my view I can't see the content of my PDF but I only see a grey square rather than it. What could be the problem? What c…
tagged with: http://stackoverflow.com/tag/pdf
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: pdf-generation
score: 2

http://stackoverflow.com/q/27386193
answer count: 2
upvote count: 1
favorite count: 0
has title: making a subClass do something whenever any of the super class' constructor is called
tagged with: constructor
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43220608
has body: I want to extend JPanel. class VisiblePanel extends JPanel{ } How can I make VisiblePanel call setVisible(true); whenever it is instanciated, without overriding all of the constructors one by one?
tagged with: superclass
downvote count: 0
score: 1
tagged with: java
linked to: http://stackoverflow.com/q/1644317
has answer: http://stackoverflow.com/a/27387551
type: Question
has answer: http://stackoverflow.com/a/27386221

http://stackoverflow.com/comment/43288607
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27421174
has text: @RobBaillie oh. I'm just loading a file, slicing it up along `.` characters then take the last of the splitted string array and that's the extension.
type: AnswerComment

http://stackoverflow.com/q/27370489
answer count: 1
has answer: http://stackoverflow.com/a/27372359
tagged with: text-files
tagged with: text
type: UnansweredQuestion
type: Question
tagged with: java
has body: I'm trying to make a method search, edit and/or delete a specific word in a text file private void modifyShow() throws FileNotFoundException, IOException { Scanner input = new Scanner(System.in); System.out.println("Please search for a TV Show\nExample: Simpsons"); String tvSearch = input.nextLine(); System.out.println("Displaying results for: " + tvSearch); String searchTerm = tvSearch; searchTerm = searchTerm.toLowerCase(); int count = 0; Scanner show = new Scanner(new File("src/TVShows.txt")); while (show.hasNext()) {// loop if (show.equals(searchTerm)) { // find System.out.println(show);// display } } } So it doesn't actually search the file but it opens it I believe but the while statement is throwing it off. So once it finds the word it needs to print say System.out.println("Enter a new name for " + tvSearch + "."); And have an input for the show and then replace it.
has title: Search modify and delete from text file
tagged with: replace
score: 0

http://stackoverflow.com/comment/43360695
has text: What about gun and bullets. Is it composition or aggregation or association?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27462034
type: Comment

http://stackoverflow.com/a/27447569
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27447304
accepted answer of: http://stackoverflow.com/q/27447304
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: There are many ways to do String manipulation in Java. One of the quickest ways might be using REGEX. But I am showing you using loop and checking each characters. String answer = "hello"; String hidden = answer.replaceAll(".", "*"); //let hidden fill with * char guess = 'e'; //Get this from scanner for(int x=0; x&lt;answer.length(); x++) if(answer.charAt(x) == guess) hidden = hidden.substring(0,x) + guess + hidden.substring(x+1);

http://stackoverflow.com/comment/43151480
type: Comment
has text: A simpler solution could be to loop over the string and have a test on each character whether it is a blank. If so, append a newline character to the result string, otherwise the character itself.
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/27348378

http://stackoverflow.com/comment/101846354
has text: @GraemeMoss my understanding is that you can't rely on the locations of the objects to be the same between runs - so using the lock id to identify the objects wont work.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27416441
type: AnswerComment

http://stackoverflow.com/comment/43309227
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27433906
type: Comment
has text: I dont mean to be rude, but this is a place to help you figure out solutions to your problems, not ask other people to do your work for you.

http://stackoverflow.com/comment/43219385
comment on: http://stackoverflow.com/q/27383126
score: 0
type: Comment
type: QuestionComment
has text: @TheLostMind You're right, as I just checked, the entire data is coming in as one line. How would I separate that one line into multiple lines as it should be so I can read each?

http://stackoverflow.com/comment/43238413
type: Comment
type: QuestionComment
has text: You decorate your `Socket`'s `OutputStream` with a `DataOutputStream`. You then discard it and use the underlying `OutputStream`. `DataOutputStream` has a buffer, which you never flush. This is likely causing the corruption. I would recommend you avoid decorating and then discarding, and simply use the `DataOutputStream` to do all of your output. Further, there is no need to read the _entire file_ into memory! I also cannot see where you read the file size header at the other end...
comment on: http://stackoverflow.com/q/27395929
score: 0

http://stackoverflow.com/a/27403605
score: 0
has body: This is the main feature of TestBench library. To make TestBench library work, you have to use/instantiate TestBenchDriverProxy. FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("focusmanager.testmode", true); driver = TestBench.createDriver(new FirefoxDriver(profile)); Then calling these two methods one after another should do fine.
type: Answer
answers question: http://stackoverflow.com/q/27375253

http://stackoverflow.com/comment/43329145
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27445075
has text: I only need the abstract implementation of the concrete classes to use in the method and I can't change the arguments to get the Abstract from another place.

padding
tags question: http://stackoverflow.com/q/27348665
tag name: padding
tags question: http://stackoverflow.com/q/27338844
type: Tag

http://stackoverflow.com/q/27317870
type: UnansweredQuestion
tagged with: tomcat
tagged with: wildcard
type: Question
has title: Using spring wildcards on tomcat
score: 0
has comment: http://stackoverflow.com/comment/43096146
tagged with: spring
tagged with: java
has body: I have a war which contains many JARs inside, and most of them have properties files inside them. My goal is to load all those properties files in spring context, but apparently it doesn't work on tomcat somehow. classpath*:/**/*.properties Lets say i have module testWebapp which is war so every property file in this module will end up in <filename>.war/WEB-INF/classes/... And i also have testProperty.jar which is placed in /WEB-INF/lib/ and this jar contains some property files. With configuration above only property files from testWebapp are being loaded. How to config it to get properties files from jars placed in lib dir also (ofcourse without need to explicite put every filename in spring context) ? Current: INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@203feeda: defining beans [test.NoMessagesPropertiesFactoryBean#0]; root of factory hierarchy Dec 05, 2014 3:01:54 PM org.springframework.core.io.support.PropertiesLoaderSupport loadProperties INFO: Loading properties file from file [D:\dev\apache-tomcat-7.0.57\webapps\test\WEB-INF\classes\test\testWebapp.properties] Expected: INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@2ac302a0: defining beans [test.NoMessagesPropertiesFactoryBean#0]; root of factory hierarchy Dec 05, 2014 3:15:28 PM org.springframework.core.io.support.PropertiesLoaderSupport loadProperties INFO: Loading properties file from file [D:\dev\apache-tomcat-7.0.57\webapps\test\WEB-INF\classes\test\testWebapp.properties] Dec 05, 2014 3:15:28 PM org.springframework.core.io.support.PropertiesLoaderSupport loadProperties INFO: Loading properties file from class path resource [test2/test2.properties] Context started
has comment: http://stackoverflow.com/comment/43095458
has comment: http://stackoverflow.com/comment/43096011
answer count: 0

http://stackoverflow.com/q/27455392
answer count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43349991
has title: Parse Android Tried to serialize a command referencing a new, unsaved object
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43681570
score: 0
has body: I am new to Parse for Android and when I run the sample project, my logcat constantly outputs the following error: java.lang.IllegalStateException: Tried to serialize a command referencing a new, unsaved object. Does anyone know what is causing this error? Here is my Activity Code: public class ParseStarterProjectActivity extends Activity { EditText mTaskInput; ListView mListView; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ParseAnalytics.trackAppOpenedInBackground(getIntent()); mTaskInput = (EditText) findViewById(R.id.task_input); mListView = (ListView) findViewById(R.id.task_list); ParseObject.registerSubclass(Task.class); } public void createTask(View v) { if (mTaskInput.getText().length() &gt; 0){ Task t = new Task(); t.setDescription(mTaskInput.getText().toString()); t.setCompleted(false); t.saveInBackground(); mTaskInput.setText(""); } } } And here is my Application class: public class ParseApplication extends Application { @Override public void onCreate() { super.onCreate(); // Initialize Crash Reporting. ParseCrashReporting.enable(this); // Add your initialization code here Parse.initialize(this, APPLICATION_ID, CLIENT_KEY); ParseUser.enableAutomaticUser(); ParseACL defaultACL = new ParseACL(); // If you would like all objects to be private by default, remove this line. defaultACL.setPublicReadAccess(true); ParseACL.setDefaultACL(defaultACL, true); } }
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/43349112

http://stackoverflow.com/comment/43241495
type: Comment
type: QuestionComment
has text: @Buzzy, The HP's support forum.... do people actually still use that? The formatting is terrible and it's full of black-white-only [WOTS](https://www.google.com.sg/search?q=wall+of+text&rlz=1C1FDUM_enSG613SG613&es_sm=93&source=lnms&tbm=isch&sa=X&ei=4RaIVPOqIs7UuQS2hoCYBg&ved=0CAgQ_AUoAQ&biw=1366&bih=675) slamming right into our eyeballs.
score: 1
comment on: http://stackoverflow.com/q/27389152

http://stackoverflow.com/comment/43155083
type: Comment
has text: Missing {} around the body of your if statement in paintComponent
type: QuestionComment
comment on: http://stackoverflow.com/q/27350304
score: 0

http://stackoverflow.com/a/27359931
has body: If the JAR is never used: Will the JIT still compile the classes contained in the JAR to machine code in the initialization phase (first phase of the JVM running the app)? Or like DLLs the JARs are loaded during run time only if we actually called a method from one of the classes in the JAR? ANS:JARs are loaded run time only, even class from JAR is loaded first time the class in referenced. method compilation usually happen based on hotspot principle. If the answer to 1. was when we actually called a method from one of the classes in the JAR: What is then the benefit of using the JIT then? The JIT is supposed to improve run time by doing the heavy lifting during the application start up phase. ANS:JIT usually compile heavily used method. this heavy usage is determined from runtime information. JIT dosent decrease startup time. Does the JIT has to compile all the classes in the JAR, for example if we use: ANS: NO ClassB.MethodB(); will ClassA and ClassC will be compiled as well because they are in the same JAR? ANS NO What about the rt.jar containing the basic java framework classes: for example if I call: System.out.println(""); Will the System.class also be compiled to machine code (whether at start up at run time or when we actually call the method during run time) or is there some sort of already cached machine code for these classes? ANS: NO, JIT Compile only highly used method. it doesn't compile all other method in same class.
has comment: http://stackoverflow.com/comment/43177365
score: 0
has comment: http://stackoverflow.com/comment/43174651
has comment: http://stackoverflow.com/comment/43201209
type: Answer
answers question: http://stackoverflow.com/q/27344989
has comment: http://stackoverflow.com/comment/43195256
has comment: http://stackoverflow.com/comment/43202833

http://stackoverflow.com/comment/43092135
score: 0
type: QuestionComment
type: Comment
has text: Same here. @FurkanAktaş what are you getting for it?
comment on: http://stackoverflow.com/q/27316047

http://stackoverflow.com/comment/43163061
type: QuestionComment
comment on: http://stackoverflow.com/q/27354895
has text: Print the String before conversion, will let you know whether actual date is available or not.
score: 0
type: Comment

http://stackoverflow.com/q/27457930
has answer: http://stackoverflow.com/a/27458037
answer count: 1
has body: I am trying to dynamically creating imageview but it is not visible my code is: RelativeLayout layout = (RelativeLayout)findViewById(R.id.MultiQuesRelaLayOut); final ImageView[] im=new ImageView[10]; for(int img=0; img&lt;2.length; img++) { im[img]=new ImageView(this); RelativeLayout.LayoutParams params=new RelativeLayout.LayoutParams ((int)LayoutParams.WRAP_CONTENT,(int)LayoutParams.WRAP_CONTENT); params.leftMargin=25; params.topMargin=(img+1)*(35+add); im[img].setId(img); im[img].layout(5,5,5,5); im[img].setVisibility(View.VISIBLE); im[img].setBackgroundColor(color.background_dark); im[img].setPadding(5, 15, 5, 15); im[img].setLayoutParams(params); layout.addView(im[img]); im[img].setOnClickListener(ImageOnClick(im[img])); } How to view imageview on form by changnig it s background image or some thing like that ? Hopes for your suggestion Thanks
linked to: http://stackoverflow.com/q/19461191
has comment: http://stackoverflow.com/comment/43352953
tagged with: android
tagged with: android-imageview
accepted answer: http://stackoverflow.com/a/27458037
type: AnsweredQuestion
tagged with: dynamic
tagged with: java
type: Question
has title: Dynamic ImageView Not visible Android (My code attached)
tagged with: imageview
linked to: http://stackoverflow.com/q/19004096
has comment: http://stackoverflow.com/comment/43352938
has comment: http://stackoverflow.com/comment/43353070
score: 0

http://stackoverflow.com/a/27413857
has comment: http://stackoverflow.com/comment/43272013
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43272367
answers question: http://stackoverflow.com/q/27413794
upvote count: 1
type: AcceptedAnswer
has body: You should download jstl jar. Then include it in your /WEB-INF/lib folder See this for more info.
accepted answer of: http://stackoverflow.com/q/27413794
has comment: http://stackoverflow.com/comment/46887525
has comment: http://stackoverflow.com/comment/43271821
has comment: http://stackoverflow.com/comment/43272169
type: Answer

http://stackoverflow.com/comment/43170339
comment on: http://stackoverflow.com/q/27358994
type: Comment
type: QuestionComment
has text: ill give you very personal opinion, I needed to support nasty piece of code, where majority of methods were static. Believe me, it was hell on earth or even something worst. Hence, avoid statics if you can, they are good for utilities method bt thats all
score: 3

http://stackoverflow.com/a/27330828
type: Answer
score: 2
upvote count: 2
has body: Almost all applications can cope with short pauses. Rather than asking what applications can cope with a pause, you should really be asking what applications cannot cope with a pause. Applications that can't cope with a pause are ones that have to directly interact with the real world and have to do so in real time. Machines and robots are the best example of this. For instance, you don't want the ABS on a car to be paused for a garbage collection when you slam on your brakes in an emergency. Having said that, a typical example of an application that can cope with a pause is a desktop application. That extra fraction of a second it takes to display a menu or respond to a button click is likely to go unnoticed by the user.
accepted answer of: http://stackoverflow.com/q/27330661
answers question: http://stackoverflow.com/q/27330661
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27347347
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43151020
has comment: http://stackoverflow.com/comment/43151058
type: Question
has title: hierarchical tree with java and wicket
tagged with: wicket
has body: I am new at wicket. I have a problem needs a solution. I have a data table and it contains "subject codes" like 10,10.1,10.1.2,10.10.1.3,... and also these subject codes have corresponding "subject names". What I need to do is: In my application user enters a subject code as input text area and application returns max 20 correponding subject codes as a list. User chooses one of the codes and application shows this code and it's related name at a hierarchical tree. For instance user chooses 10.1.2, tree shows this selected code as a tree. I was able to list max 20 codes and user choses one of the codes but I could not create the tree. Did anyone do something like that by using wicket?
score: 0
answer count: 1
tagged with: tree
has answer: http://stackoverflow.com/a/27353591
tagged with: java
type: UnansweredQuestion

http://stackoverflow.com/comment/43357016
has text: You have to include it in the plugin project
score: 0
comment on: http://stackoverflow.com/q/27460053
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43394029
type: QuestionComment
comment on: http://stackoverflow.com/q/27440408
has text: The word is not 'emotions' but 'emoticons'.
type: Comment
score: 0

http://stackoverflow.com/q/27439227
has comment: http://stackoverflow.com/comment/43329109
type: UnansweredQuestion
tagged with: vaadin7
has comment: http://stackoverflow.com/comment/43377757
has comment: http://stackoverflow.com/comment/43318734
linked to: http://stackoverflow.com/q/27483684
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43418660
tagged with: vaadin
has comment: http://stackoverflow.com/comment/43318918
type: Question
has comment: http://stackoverflow.com/comment/43322532
has comment: http://stackoverflow.com/comment/43334379
has comment: http://stackoverflow.com/comment/43328469
has title: vaadin table auto refreshing according to database
score: 0
has comment: http://stackoverflow.com/comment/43320612
has body: hi i have a Vaadin table that display data stored in Hibernate database, is there a way to auto refreshing when a new record has inserted in the database, using indexedContainer? thank you for help

http://stackoverflow.com/comment/43111782
has text: @MilenYanchev, you need to specify the schema name besides the name of the table.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27326123
type: Comment

http://stackoverflow.com/q/27453057
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43344716
accepted answer: http://stackoverflow.com/a/27527106
has comment: http://stackoverflow.com/comment/43344813
tagged with: java
upvote count: 1
tagged with: sleep
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43344784
tagged with: for-loop
downvote count: 0
has comment: http://stackoverflow.com/comment/43345292
has comment: http://stackoverflow.com/comment/43344832
tagged with: while-loop
has answer: http://stackoverflow.com/a/27527106
possible better answer: http://stackoverflow.com/a/27453556
score: 1
has comment: http://stackoverflow.com/comment/43344621
has body: I have a for loop inside a while (1) and I want the loop to average approx 2 minutes through each entire for loop cycle. This requires sleeping between each iteration for a different time based on execution time of the iteration and time remaining in my 2 minute shot clock. Any ideas. I was moving towards something while(true) { unsigned long begin_loop = OCX::micro_stamp(); for (int i = 0; i &lt; _vector.size(); i++) { unsigned long start = OCX::micro_stamp(); unsigned long avg = ( ( begin_loop - start) / ( i + 1 ) ); usleep ( ( 120000000 - ( (_vector.size() - i) * avg ) ) / ( _vector.size() - i ) ); try { } catch { } } }
has answer: http://stackoverflow.com/a/27453556
favorite count: 0
has title: sleep in for loop for total iteration time of 2 minutes

http://stackoverflow.com/comment/43244136
score: 0
type: Comment
has text: Why go for Maven ? why we can't use ant? could you Please reply?
comment on: http://stackoverflow.com/a/27398143
type: AnswerComment

http://stackoverflow.com/q/27452064
has answer: http://stackoverflow.com/a/27452108
score: 0
answer count: 3
favorite count: 0
tagged with: priority-queue
type: UnansweredQuestion
upvote count: 1
tagged with: java
has body: I have the following Java code, which creates a PriorityQueue and adds some elements to it: public class Main { public static void main(String[] args) { PrintWriter out = new PrintWriter(System.out); PriorityQueue&lt;Integer&gt; q = new PriorityQueue&lt;&gt;(); Integer[] integers = new Integer[10]; Integer[] integers1 = new Integer[10]; for (int i = 0; i &lt; 10; i++) { integers[i] = i; integers1[i] = i + 10; } for (int i = 0; i &lt; integers.length; i++) { q.add(integers[i]); q.add(integers1[i]); } out.println(q.size()); for(int i = 0; i &lt; integers.length; i++) out.println(q.poll()); out.close(); } } In this code segment q.size() return the size of the queue, which is 20. However, when I retrieve elements using the poll() function in the last loop, it only retrieves the first 10 elements. However, when I use an Iterator to access the elements, it retrieves all the elements from the queue. It seems like the poll() method always retrieves half of the elements in the queue. What's going on here?
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27452105
has title: Why can I see PriorityQueue elements with an Iterator, but not with poll?
has answer: http://stackoverflow.com/a/27452145

http://stackoverflow.com/q/27434893
type: Question
tagged with: split
has comment: http://stackoverflow.com/comment/43310703
upvote count: 1
possible better answer: http://stackoverflow.com/a/27434939
has comment: http://stackoverflow.com/comment/43310748
favorite count: 0
has answer: http://stackoverflow.com/a/27435003
accepted answer: http://stackoverflow.com/a/27434945
has title: Why am I not being able to split a String in java given that I have a string containing filename?
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27434945
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43310725
tagged with: java
has answer: http://stackoverflow.com/a/27434947
has body: Basically there are some images in my folder called Patterns. All images are in png file format. Below is the code I'm using: import java.io.File; public class IMG_List { public static void main(String [] args){ File file = new File("C:/images/Patterns"); String[] str = file.list(); for(String f_name : str){ String[] str_name = f_name.split("."); System.out.println(str_name[0]); } } } When i use the above code I get: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at IMG_List.main(IMG_List.java:11) However when i use the following code i get no error import java.io.File; public class IMG_List { public static void main(String [] args){ File file = new File("C:/images/Patterns"); String[] str = file.list(); for(String f_name : str){ String[] str_name = f_name.split("png"); System.out.println(str_name[0]); } } } Why am I not being to split the string with the dot ? Thank you, MMK.
has answer: http://stackoverflow.com/a/27434939

http://stackoverflow.com/comment/43129879
has text: @sidi no worries. Everyone need to start to some where. I too crossed this stage. You can follow ZouZou answer. I will update the answer as well. Hope it will helpful
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27336386
type: Comment

soap
tags question: http://stackoverflow.com/q/27318330
tags question: http://stackoverflow.com/q/27319489
tags question: http://stackoverflow.com/q/27374546
type: Tag
tags question: http://stackoverflow.com/q/27398060
tags question: http://stackoverflow.com/q/27388459
tags question: http://stackoverflow.com/q/27426182
tags question: http://stackoverflow.com/q/27427509
tags question: http://stackoverflow.com/q/27389129
tags question: http://stackoverflow.com/q/27377020
tags question: http://stackoverflow.com/q/27395782
tags question: http://stackoverflow.com/q/27374656
tags question: http://stackoverflow.com/q/27327018
tags question: http://stackoverflow.com/q/27377578
tags question: http://stackoverflow.com/q/27460513
tags question: http://stackoverflow.com/q/27404406
tags question: http://stackoverflow.com/q/27417363
tags question: http://stackoverflow.com/q/27441363
tag name: soap
tags question: http://stackoverflow.com/q/27385469

http://stackoverflow.com/a/27354274
has body: You need both MToolItem and MMenuItem before the first execution. You can find MToolItem via EModelService in a @PostConstruct method. private MMenuItem menuItem; private MToolItem toolItem; @PostConstruct protected void initControls(MApplication app) { setToolItem((MToolItem) modelService.find("tool.item.id", app)); } As for menu item, it cannot be found in such a way via EModelService (in Eclipse 4.3 Kepler, not sure for Luna). That is how we do that in the same @PostConstruct method: ... MUIElement window = modelService.find("main.window.id", app); setMenuItem((MHandledMenuItem) findMenuElement("menu.item.id", window)); ... public static MMenuElement findMenuElement(String id, MUIElement searchRoot) { if (id == null) { throw new IllegalArgumentException("id is null!"); } if (id.length() == 0) { throw new IllegalArgumentException("Empty string is not allowed in id."); } if (searchRoot instanceof MMenuElement &amp;&amp; id.equals(searchRoot.getElementId())) { return (MMenuElement) searchRoot; } if (searchRoot instanceof MTrimmedWindow) { MMenuElement findMenu = findMenuElement(id, ((MTrimmedWindow) searchRoot).getMainMenu()); if (findMenu != null) { return findMenu; } } else if (searchRoot instanceof MPart) { List&lt;MMenu&gt; menus = ((MPart) searchRoot).getMenus(); for (MMenu mm : menus) { MMenuElement findMenu = findMenuElement(id, mm); if (findMenu != null) { return findMenu; } } } else if (searchRoot instanceof MMenu) { List&lt;MMenuElement&gt; children = ((MMenu) searchRoot).getChildren(); for (MMenuElement me : children) { MMenuElement findMenu = findMenuElement(id, me); if (findMenu != null) { return findMenu; } } } return null; }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43172123
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27323735
score: 1
answers question: http://stackoverflow.com/q/27323735
type: Answer
has comment: http://stackoverflow.com/comment/43169143
upvote count: 1

http://stackoverflow.com/a/27466689
has comment: http://stackoverflow.com/comment/43369669
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43598277
score: 1
accepted answer of: http://stackoverflow.com/q/27465934
type: AcceptedAnswer
has body: First This is actually space-time tradeoff (the computation time can be reduced at the cost of increased memory use). Why does the author say pure recursive solution slow (in fact it's exponential time complexity)? It comes from repeated recursion and because of that, it computes the same values again and again. So what can you do? You can store the value you already computed. Next time you want this value again, just look up in a table. This is called caching, when the values are cached, you can treat every recursive call inside the function as it would run in O(1) time complexity. The core idea is don't calculate the same things twice. Second In the case s2.charAt(0) == s3.charAt(0) &amp;&amp; s1.charAt(0) == s3.charAt(0).
answers question: http://stackoverflow.com/q/27465934

http://stackoverflow.com/comment/43201356
score: 0
type: Comment
type: QuestionComment
has text: Post your code you have tried..!!
comment on: http://stackoverflow.com/q/27375722

http://stackoverflow.com/q/27393755
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/43235693
favorite count: 0
has body: here is the code package com.simplecode.excel; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.Iterator; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; public class XlstoCSV { static void xlsx(File inputFile, File outputFile) { // For storing data into CSV files StringBuffer data = new StringBuffer(); try { FileOutputStream fos = new FileOutputStream(outputFile); // Get the workbook object for XLSX file XSSFWorkbook wBook = new XSSFWorkbook(new FileInputStream(inputFile)); // Get first sheet from the workbook XSSFSheet sheet = wBook.getSheetAt(0); Row row; Cell cell; // Iterate through each rows from first sheet Iterator&lt;Row&gt; rowIterator = sheet.iterator(); while (rowIterator.hasNext()) { row = rowIterator.next(); // For each row, iterate through each columns Iterator&lt;Cell&gt; cellIterator = row.cellIterator(); data.append("\r\n"); while (cellIterator.hasNext()) { cell = cellIterator.next(); switch (cell.getCellType()) { case Cell.CELL_TYPE_BOOLEAN: data.append(cell.getBooleanCellValue() + ","); break; case Cell.CELL_TYPE_NUMERIC: data.append(cell.getNumericCellValue() + ","); break; case Cell.CELL_TYPE_STRING: data.append(cell.getStringCellValue() + ","); break; case Cell.CELL_TYPE_BLANK: data.append("\r\n" + ","); break; default: data.append(cell + ","); } } } fos.write(data.toString().getBytes()); fos.close(); } catch (Exception ioe) { ioe.printStackTrace(); } } //testing the application public static void main(String[] args) { //reading file from desktop File inputFile = new File("C:/Users/1479420/Desktop/Book1.xlsx"); //writing excel data to csv File outputFile = new File("C:/Users/1479420/Desktop/Book.csv"); xlsx(inputFile, outputFile); } }
has comment: http://stackoverflow.com/comment/43234783
has comment: http://stackoverflow.com/comment/43235175
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/43235746
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27393853
accepted answer: http://stackoverflow.com/a/27393853
has comment: http://stackoverflow.com/comment/43234873
has title: when i tried to convert my xlsx file to csv then "Exception in thread "main" java.lang.OutOfMemoryError: Java heap space"

http://stackoverflow.com/comment/43124571
comment on: http://stackoverflow.com/a/27333611
type: AnswerComment
score: 0
type: Comment
has text: Thanks, since retrieved data is big, but still may be stored completely in RAM.

http://stackoverflow.com/a/27339888
has comment: http://stackoverflow.com/comment/43136178
accepted answer of: http://stackoverflow.com/q/27339873
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27339873
has comment: http://stackoverflow.com/comment/43136208
upvote count: 1
has comment: http://stackoverflow.com/comment/43136174
has body: s.substring() doesn't actually throw a method if you call an index 1 above the last index. This is very helpful, because then you don't need to worry with forloops like this: for(int i = 0; i &lt; string.length - 1; i++) { System.out.println(s.substring(i, i+1)); } No need to have a special check for the very last index, it'll just work. You can see the Java Docs for the more technical answer - s.substring() will only throw an error if the index is greater than the LENGTH of the string, not just the number of indices. See this question for more info too.
type: Answer
has comment: http://stackoverflow.com/comment/43136187
has comment: http://stackoverflow.com/comment/43136186
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43136222

http://stackoverflow.com/q/27470190
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43376285
tagged with: java
tagged with: hibernate
type: Question
has answer: http://stackoverflow.com/a/32236268
has body: I wanted to migrate our Java servlet to use Hikari Connection Pool instead of C3P0. However, I have encountered a strange bug - during the Hibernate bootup, the servlet crashes with : Method org.postgresql.jdbc4.Jdbc4Connection.isValid(int) is not yet implemented. This is a weird behaviour, as we are using the newest JDBC41 postgresql driver, excerpt from our pom.xml: org.postgresql postgresql 9.3-1102-jdbc41 and according to the changelog of JDBC driver, the isValid() method should already be properly implemented in 9.3-1102. We were using this version of the driver with C3P0 and had absolutely no problems. We have also tried using the Pgsql-NG JDBC driver which was working correctly, but was buggy when handling the PostGIS datatypes. I also tried setting up the connectionTestQuery in the Hikari configuration to SELECT 1 to force Hikari not to use the isValid(), but this had no effect. Has anyone some experiences with this problem or some workarounds?
has comment: http://stackoverflow.com/comment/43377758
tagged with: hikaricp
tagged with: postgresql
has title: Newest Postgres JDBC41 not working with HikariCP and Hibernate: isValid() not implemented
score: 2
tagged with: jdbc
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 2

http://stackoverflow.com/comment/43202772
comment on: http://stackoverflow.com/q/27361223
type: QuestionComment
has text: Question already asked here: http://forum.jogamp.org/How-to-correctly-clean-up-Java3D-tp4033725.html Moreover, Java3D 1.5.2 is obsolete and unmaintained (for years), it shouldn't be used.
type: Comment
score: 0

http://stackoverflow.com/comment/43204862
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27373902
has text: I couldn,t solve this problem yet
score: 0

http://stackoverflow.com/a/27451310
downvote count: 0
has comment: http://stackoverflow.com/comment/43341205
has comment: http://stackoverflow.com/comment/43341197
has comment: http://stackoverflow.com/comment/43341239
has comment: http://stackoverflow.com/comment/43341731
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43341339
has body: Try something to the effect of lists.sort(new Comparator&lt;Employee&gt;() { @Override public int compare(Employee o1, Employee o2) { if (o1.getName().equals("BOSS")) { if (o2.getName().equals("BOSS")) { return 0; } else { return -1; } } else if (o2.getName().equals("BOSS")) { return 1; } else { return o1.getName().compareTo(o2.getName()); } } }); Here, we use an anonymous comparator class on Employee, where we first check whether either employee being compared is the "BOSS", and if so, force the value that would put the "BOSS" first. Otherwise, we do a simple compare on the names of the the employees.
type: Answer
accepted answer of: http://stackoverflow.com/q/27451257
score: 2
answers question: http://stackoverflow.com/q/27451257

http://stackoverflow.com/a/27472358
has body: !"null".equals(a.get(i)) will just check if the string returned by a.get(i) does not equal "null". I think what you wanna do is check a.get(i) == null, which will not work since requesting an item from a List that is at an index that is bigger than the list's size will throw a java.lang.IndexOutOfBoundsException. To properly iterate over a List, use a foreach loop: for(Object o : list) { //Execute your code }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27472293

http://stackoverflow.com/q/27397921
has title: Can we use YouTube Analytics Api using Java and Eclipse?
tagged with: youtube-api
type: Question
has body: I tried reading google tutorials and doing the YouTube Analytics Api example. But, I am unable to make the code. Can someone help me to make it (using Java and Eclipse) ? it shows an error in Import file import com.google.api.services.youtube.YouTube; import com.google.api.services.youtube.model.Channel; import com.google.api.services.youtube.model.ChannelListResponse; import com.google.api.services.youtubeAnalytics.YoutubeAnalytics; import com.google.api.services.youtubeAnalytics.model.ResultTable; import com.google.api.services.youtubeAnalytics.model.ResultTable.ColumnHeaders; import com.google.common.collect.Lists; Example : package com.google.api.services.samples.youtube.cmdline.youtube_analytics_cmdline_report_sample; import java.io.File; import java.io.IOException; import java.io.PrintStream; import java.math.BigDecimal; import java.util.List; import com.google.api.client.auth.oauth2.Credential; import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp; import com.google.api.client.extensions.java6.auth.oauth2.FileCredentialStore; import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver; import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow; import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.services.youtube.YouTube; import com.google.api.services.youtube.model.Channel; import com.google.api.services.youtube.model.ChannelListResponse; import com.google.api.services.youtubeAnalytics.YoutubeAnalytics; import com.google.api.services.youtubeAnalytics.model.ResultTable; import com.google.api.services.youtubeAnalytics.model.ResultTable.ColumnHeaders; import com.google.common.collect.Lists; public class Samp { /** * Demo displaying YouTu…
score: 0
accepted answer: http://stackoverflow.com/a/27398143
linked to: http://stackoverflow.com/q/20755437
answer count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27398143
tagged with: java

http://stackoverflow.com/comment/43118374
has text: @Emz yes thats what i need to do
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27329988
score: 0

http://stackoverflow.com/a/27430187
accepted answer of: http://stackoverflow.com/q/27430092
has comment: http://stackoverflow.com/comment/43338831
has comment: http://stackoverflow.com/comment/43301563
has comment: http://stackoverflow.com/comment/43302041
has body: Yes, this method can be used in cryptography. RSA encryption involves the finding of huge prime numbers, sometimes on the order of 1024 bits (about 300 digits). The security of RSA depends on the fact that factoring a number that consists of 2 of these prime numbers multiplied together is extremely difficult and time consuming. But for it to work, they must be prime. It turns out that proving these numbers prime is difficult too. But the Miller-Rabin primality test, one of the primality tests uses by isProbablePrime, either detects that a number is composite or gives no conclusion. Running this test n times allows you to conclude that there is a 1 in 2n odds that this number is really composite. Running it 100 times yields the acceptable risk of 1 in 2100 that this number is composite.
upvote count: 69
has comment: http://stackoverflow.com/comment/43416354
has comment: http://stackoverflow.com/comment/43353739
score: 69
has comment: http://stackoverflow.com/comment/43301723
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43323137
has comment: http://stackoverflow.com/comment/43301602
type: Answer
answers question: http://stackoverflow.com/q/27430092
has comment: http://stackoverflow.com/comment/43301654
has comment: http://stackoverflow.com/comment/43302002

http://stackoverflow.com/comment/46842831
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27342600
type: QuestionComment
has text: Rather than this program, it would be easy if you look at CountingMapData program initially(Its three or fours pages after this program). The use of AbstractSet makes this program complicated to a novice. Instead of AbstractSet , it can use a LinkedHashSet or any other Set. Look with that point, then it would be easy to understand....

http://stackoverflow.com/q/27366428
has answer: http://stackoverflow.com/a/27366521
favorite count: 0
has comment: http://stackoverflow.com/comment/43184793
tagged with: time
possible better answer: http://stackoverflow.com/a/27366478
has comment: http://stackoverflow.com/comment/43184909
has body: Im trying to convert milliseconds to seconds with System.currentTimeMillis(); System.out.println((int) System.currentTimeMillis() / 1000); The output is 730750 and increasing by 1. How can i get seconds starting from 0? **UPDATE: Now i understand the problem and thank you for answering it.
has answer: http://stackoverflow.com/a/27366478
answer count: 4
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27366462
upvote count: 3
tagged with: java
tagged with: milliseconds
has title: Java currentTimeMillis() conversion to seconds not working?
downvote count: 1
type: Question
tagged with: seconds
has answer: http://stackoverflow.com/a/27366477
accepted answer: http://stackoverflow.com/a/27366462

http://stackoverflow.com/q/27403218
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27403599
tagged with: java
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43252779
has title: Java Segment Big array Data
upvote count: 0
score: -1
has body: I have a huge data in the below format TIME STAMP Sum of T2I Obj 11/17/2014 00:02:13 a 0.524 11/17/2014 00:05:49 a 2.104 11/17/2014 00:09:06 a 3.245 11/17/2014 00:14:25 a 13.427 11/17/2014 00:15:36 a 2.832 11/17/2014 00:17:13 a 3.098 11/17/2014 00:20:49 a 0.751 11/17/2014 00:24:16 a 0.884 Full Input: https://docs.google.com/spreadsheets/d/168ejowAajGfXv-JBQKm7u3_G8-oPM8Mfn1TC-3MzXsA/edit?usp=sharing Processed File Output: (see Last sheet one hour output and need to change that to eight hour) MY FULL CODE Tried: https://drive.google.com/file/d/0BzTX2wIhk3Wza1lGVmhHcFZQX0k/view?usp=sharing As you can see the above file has date time in one column and values in other column. I want to segment all the single data to combined data for 8hr interval. ie TIME STAMP Average 11/17/2014 08 0.524 (AVG of all the data between 00hr -8hr) 11/17/2014 16 2.104 (AVG of all the data between 08hr -16hr) 11/17/2014 24 3.245 (AVG of all the data between 16hr -24hr) Any help from the Java experts!!
has comment: http://stackoverflow.com/comment/43252770
answer count: 1
has comment: http://stackoverflow.com/comment/43251468

http://stackoverflow.com/q/27337345
tagged with: android-intent
has body: I have 3 activities A, B, C. And I want to set them in a certain hierarchy and use the setParentActivity so I can get the default android back button automatically. So first off if there is a way to get the default android back button that would solve my problem. I have download the android developer tools icons. And there are back button but not like this one and then i have to use actionBar.setIcon('icBackButton') so I can not set my own icon. I am talking about this back button if you are not sure what I am talking about. This is what I want: This is what I have tried, the other problem with this is I don't want all the text to be selected when back is pressed it should just be the back button. I can use setParentActivity to do this but when I have tried I haven't been able to get it to work correctly. Here is how I want the hierarchy to work. If here is what the visual is saying A is launcher activity and it can go to B or C. And then B can go to C. And at C when back is hit I always want it to go back to the perivious activity. I how this all makes sense I tried to explain it clearly as I could. Thanks for the help in advance.
score: 2
tagged with: java
type: Question
answer count: 2
has title: Android - Set parent activity android manifest
has answer: http://stackoverflow.com/a/27337568
downvote count: 0
favorite count: 0
tagged with: back
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27337590
tagged with: android

http://stackoverflow.com/q/27348678
has body: I'm trying to add a new element to my empty JList but it doesn't appear. I'm running it on the EDT (I've very low information on that subject) public void populateProjectsList(List&lt;Project&gt; projectsList2) { EventQueue.invokeLater(new Runnable() { @Override public void run() { DefaultListModel&lt;String&gt; listModel = (DefaultListModel) projectsList.getModel(); listModel.clear(); for (Project project : projectsList2) { System.out.println(project.id + ") " + project.name); listModel.addElement(project.id + ") " + project.name); } } }); } System.out.println works, I see the correct output that I wish to be added but the list is still empty as it is. I tried listModel.addElement in an action listener and it worked.
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43152526
type: Question
tagged with: jlist
has answer: http://stackoverflow.com/a/27349219
has title: Adding element to JList does not work
score: 0
has comment: http://stackoverflow.com/comment/43162481
tagged with: swing
answer count: 1
tagged with: java

http://stackoverflow.com/q/27391467
upvote count: 1
has answer: http://stackoverflow.com/a/27391614
possible better answer: http://stackoverflow.com/a/27391623
type: Question
has body: Given a string which is HTML (possibly malformed), how can I find the title? This would seem quite simple yet I'm struggling to do so. UPDATE: As requested, here are some URLs whose HTML Jsoup can't seem to find the title from. I collected their HTML about a month ago, so some may have changed. http://www.miamitodaynews.com/news/050113/crossword.shtml () http://www.miamitodaynews.com/news/081218/cal-highlights.shtml/feed/ () http://www.miashoes.com/mia-limited-edition/flats.html?refineclr=2125%2C2136 () http://www.mica.edu/News/Workshop_on_111809_Archive_and_Inventory_Your_Image_Collections.html () http://www.michaelgeist.ca/2011/10/daily-digital-lock-15/ () http://www.michaelkors.com/bags/_/N-283g?cmCat=cat000000cat144cat44301cat44302&amp;index=9&amp;isEditorial=false () http://www.michaelkors.com/watches/_/N-28c2?cmCat=cat000000cat145cat35701cat30001&amp;index=39&amp;isEditorial=false () http://www.michaelkors.com/watches/_/N-28c2?cmCat=cat000000cat145cat7502&amp;index=92&amp;isEditorial=false () http://www.michaelmillerfabrics.com/catalog/seo_sitemap/product/?p=2 () http://www.michaels.com/10104250.html () http://www.menseffects.com/PROMETHEUS-2-Switchblade-Automatic-Knife-p/att00176a.htm (http://www.menseffects.com/PROMETHEUS-2-Switchblade-Automatic-Knife-p/att00176a.htm) http://www.menstennisforums.com/misc.php?do=whoposted&amp;t=16764 (http://www.menstennisforums.com/misc.php?do=whoposted&amp;t=16764) http://www.menstennisforums.com/showpost.php?p=12242018&amp;postcount=115 (http://www.menstennisforums.com/showpost.php?p=12242018&amp;postcount=115) http://www.menstennisforums.com/showpost.php?p=12623891&amp;postcount=13 (http://www.menstennisforums.com/showpost.php?p=12623891&amp;postcount=13) http://www.menstennisforums.com/showpost.php?p=13010289&amp;postcount=5476 (http://www.menstennisforums.com/showpost.php?p=13010289&amp;postcount=5476) http://www.menstylepower.com/category/blog/page/14/ () http://www.menstylepower.com/tag/mens-loafers/ () http://www.mem…
accepted answer: http://stackoverflow.com/a/27392119
has comment: http://stackoverflow.com/comment/43230694
linked to: http://stackoverflow.com/q/1732348
answer count: 3
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/43230690
downvote count: 0
has title: Java - How to find the title of an HTML string
favorite count: 0
has answer: http://stackoverflow.com/a/27392119
tagged with: html-parsing
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27391623
linked to: http://stackoverflow.com/q/2168610
score: 1
tagged with: java

http://stackoverflow.com/comment/43220495
type: AnswerComment
has text: @Zéychin I don't see any compilation errors.. :/
comment on: http://stackoverflow.com/a/27386096
type: Comment
score: 0

http://stackoverflow.com/comment/43250417
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27402861
score: 0
has text: If the name is the key then use an map like Map<String,int> myMap = HashMap<String,int>(); Or if you realy need an array you can use an object which holds the variables.

http://stackoverflow.com/comment/43141721
type: Comment
type: QuestionComment
has text: Could you share your code which do not work?
score: 4
comment on: http://stackoverflow.com/q/27343120

http://stackoverflow.com/a/27330120
has body: Here is the answer: Intent intent = new Intent(getBaseContext(), SignoutActivity.class); intent.putExtra("EXTRA_SESSION_ID", sessionId); startActivity(intent) For more information check this link.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27330081

http://stackoverflow.com/q/27333173
has comment: http://stackoverflow.com/comment/43139889
has answer: http://stackoverflow.com/a/27333220
has comment: http://stackoverflow.com/comment/43143787
downvote count: 0
has comment: http://stackoverflow.com/comment/43123735
tagged with: javascript
tagged with: jquery
linked to: http://stackoverflow.com/q/17093862
tagged with: struts2
has body: I creating a Java web application with an action file which generates data from database to a JSON array. Now, I want this JSON array to be passed to jQuery? How is that possible? FYI. I applied Struts 2, Spring and Hibernate frameworks. I am not using PHP for this app. Update: This is my Struts 2 action method: public static String jsonData = null; public String generateJson() throws Exception { JSONObject json = null; JSONArray jsonArray = new JSONArray(); this.records = this.recordManager.getAllRecords(); for (RecordEntity record : records) { json = new JSONObject(); json.put("id", record.getId()); json.put("firstname", record.getFirstName()); json.put("lastname", record.getLastName()); json.put("due", record.getDue()); json.put("email", record.getEmail()); json.put("website", record.getWebsite()); jsonArray.put(json); } System.out.println(jsonArray.toString()); jsonData = jsonArray.toString(); // jsonData will be passed to jQuery return SUCCESS; } And this is my jQuery. I am using BootstrapTable so this is the structure, and I want the value of jsonData to be passed to this jQuery: $('#record').bootstrapTable({ method : 'get', data: jQuery.parseJSON(VALUE_OF_jsonData_HERE), cache : ... ... ... });
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43123724
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/43123971
has title: How to pass JSON array from Struts 2 action class to jQuery?
has comment: http://stackoverflow.com/comment/43123687
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/43123744
type: Question

http://stackoverflow.com/q/27437177
tagged with: tcp
tagged with: java
has comment: http://stackoverflow.com/comment/43337909
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43320597
has title: Java Load balancing Tcp proxy server design
answer count: 2
has comment: http://stackoverflow.com/comment/43327362
has body: I want to design and implement a proxy server which accepts client requests and then reads host connection configurations from a property file and by using round robin algorithm selects available host and then passes client request to the selected host through creating a new socket between proxy server and host .My question is what should be the best practice and how to handle if available hosts are not reachable what should be the appropriate way. What is the most suitable design pattern that I should use
tagged with: distributed
favorite count: 0
has comment: http://stackoverflow.com/comment/43392127
has comment: http://stackoverflow.com/comment/43389616
has answer: http://stackoverflow.com/a/27457223
upvote count: 2
type: UnansweredQuestion
tagged with: architecture
tagged with: design-patterns
has answer: http://stackoverflow.com/a/27438744
has comment: http://stackoverflow.com/comment/43316127
score: 1

http://stackoverflow.com/comment/43365724
comment on: http://stackoverflow.com/a/27464260
has text: Was able to get it to do what I wanted using this (for this portion anyway) Thanks so much!
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/27364435
score: 0
type: Answer
has body: Since your submethod() is not handling FileNotFoundExceptionm exception. The caller of the method need to handle this exception which can be done by enclosing the method call in try catch block or by adding throws to your main method.
answers question: http://stackoverflow.com/q/27364351

http://stackoverflow.com/q/27412288
type: Question
tagged with: jpa
score: 0
has title: JPA inject where clause in queries
has comment: http://stackoverflow.com/comment/43281824
tagged with: sql
has body: I need help with JPA. I need to add dynamic subquery to the where clause in all my queries. Is there any way I can tap-in just before the query is executed and modify it. I want to create AOP-like feature to add some checks inside the queries. Thanks!
type: UnansweredQuestion
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43269221

http://stackoverflow.com/a/27421271
has comment: http://stackoverflow.com/comment/43285593
has comment: http://stackoverflow.com/comment/43285399
has comment: http://stackoverflow.com/comment/43285753
has comment: http://stackoverflow.com/comment/43287999
score: 0
has comment: http://stackoverflow.com/comment/43288656
type: Answer
has comment: http://stackoverflow.com/comment/43285233
has body: data: {jsonString:"jsonString", fd:"fd", fd1:"fd1"} in here you have to remove quotes from jsonString parameter value because you have setted your json object stringified. And add quotes to your first parameters. Here is your updated code. &lt;script type="text/javascript"&gt; function submitAllDetails(){ // Why usint [] brackets? not needed.. var jsonObj={ name:name, age:age, rollno:rollno, add:add, }; var jsonString=JSON.stringify(jsonObj); alert(jsonString); var fileInput=document.getElementById("Uploadfile"); var file=fileInput.files[0]; var fd = new FormData(); fd.append("fileUpload",file); var fileInput1=document.getElementById("Uploadfile2"); var file1=fileInput1.files[0]; var fd1 = new FormData(); fd1.append("fileUploadnew",file1); $.ajax({ url:contextPath +"/submitAllInfo", type:"POST", contentType: "application/json; charset=utf-8", data: {"jsonString":jsonString, "fd":fd, "fd1":fd1}, // you have setted json in jsonString varible async: false, cache: false, processData:false, success: function(response){ alert("in success***"); }, error: function(){ alert("error has occured"); } });
answers question: http://stackoverflow.com/q/27420992
has comment: http://stackoverflow.com/comment/43286560

http://stackoverflow.com/q/27426548
has comment: http://stackoverflow.com/comment/43294929
score: -1
has comment: http://stackoverflow.com/comment/43294955
has body: I am newbie in the java programming. Here I got a question since I don't know how to change the text in the text file. How to change the String pass in notepad. I am trying to insert a new password in password field which in order to change(pass) that is password in my text file. public void actionPerformed(ActionEvent e) { String inputUser = input1.getText(); String inputPass = input2.getText(); File loginf = new File("oop.txt"); if(e.getSource() == returnLP) { TrialGUI link = new TrialGUI(); dispose(); } try { if(e.getSource()==reset) { FileWriter fstream = new FileWriter("oop.txt"); BufferedWriter out = new BufferedWriter(fstream); Scanner read = new Scanner(new File("oop.txt")); while(read.hasNext()) { String user = read.next(); String pass = read.next(); if(inputUser.equals(user)){ break; } } read.close(); } catch(Exception e) { e.printStackTrace(); } }
accepted answer: http://stackoverflow.com/a/27426986
linked to: http://stackoverflow.com/q/2885173
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43295204
has comment: http://stackoverflow.com/comment/43295378
type: AnsweredQuestion
tagged with: oop
tagged with: java
has title: How to change the text in notepad
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43294906
upvote count: 0
has answer: http://stackoverflow.com/a/27426986

http://stackoverflow.com/comment/43261200
comment on: http://stackoverflow.com/q/27407588
type: Comment
type: QuestionComment
has text: There is no difference between an inherited `final` method (which must not be overridden) and an inherited non-`final` method (which just *happens* to not be overridden).
score: 0

http://stackoverflow.com/comment/43282267
type: AnswerComment
comment on: http://stackoverflow.com/a/27419597
type: Comment
has text: thanks .. MuGik. I will re-arrange my question. I need to find size of current monitor in use.
score: 1

ip
tags question: http://stackoverflow.com/q/27435857
tags question: http://stackoverflow.com/q/27403964
tags question: http://stackoverflow.com/q/27408806
tags question: http://stackoverflow.com/q/27455679
type: Tag
tag name: ip

http://stackoverflow.com/a/27387640
type: Answer
has comment: http://stackoverflow.com/comment/43259770
has comment: http://stackoverflow.com/comment/43230443
has comment: http://stackoverflow.com/comment/43266308
answers question: http://stackoverflow.com/q/27385516
has body: You could just add the play button within the init method, and have it call a method, you cannot use the start method, that just starts the thread. For example: public void init(){ //whatever you want here t1 = new Thread(this); play = new JButton("Play"); //setLocation, etc, etc. add(play); play.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ remove(play); repaint(); test(); } }); } public void test(){ t1.start(); } public void run(){ //whatever you want here } So what happens here is that you have a button, that when pressed, removes itself from the screen, calls paint (through repaint) to paint the screen, then calls a side method (cannot be start) to start the thread, which would start your animation.
score: 0
has comment: http://stackoverflow.com/comment/43266657

http://stackoverflow.com/q/27466277
has answer: http://stackoverflow.com/a/27466301
tagged with: external
favorite count: 0
tagged with: file-handling
has comment: http://stackoverflow.com/comment/43368545
type: AnsweredQuestion
has body: below is my code for a homework assignment where I need to read the contents of an external file and determine the number of words within it, number of 3-letter words, and percentage of total. I've got that part down just fine, but I also have to print the external file's contents prior to displaying the above information. Below is my current code: public class Prog512h { public static void main( String[] args) { int countsOf3 = 0; int countWords = 0; DecimalFormat round = new DecimalFormat("##.00"); // will round final value to two decimal places Scanner poem = null; try { poem = new Scanner (new File("prog512h.dat.txt")); } catch (FileNotFoundException e) { System.out.println ("File not found!"); // returns error if file is not found System.exit (0); } while (poem.hasNext()) { String s = poem.nextLine(); String[] words = s.split(" "); countWords += words.length; for (int i = 0; i &lt; words.length; i++) { countsOf3 += words[i].length() == 3 ? 1 : 0; // checks for 3-letter words } } while(poem.hasNext()) { System.out.println(poem.nextLine()); } System.out.println(); System.out.println("Number of words: " + countWords); System.out.println("Number of 3-letter words: " + countsOf3); System.out.println("Percentage of total: " + round.format((double)((double)countsOf3 / (double)countWords) * 100.0)); // converts value to double and calculates percentage by dividing from total number of words } } The statement while(poem.hasNext()) { System.out.println(poem.nextLine()); } is supposed to print the external file's contents. However, it doesn't. When I try moving it before my prior while loop, it prints, but screws up my printed values for the # of words, 3-letter words, percentage, etc. I'm not really sure what the issue is here. Could someone provide some assistance? Thank you in advance.
score: 1
tagged with: java
type: Question
tagged with: file-read
has title: Printing An External File's Contents
accepted answer: http://stackoverflow.com/a/27466301
upvote count: 1
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/43207439
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27378964
has text: `wait` and `notify` are discouraged and virtually deprecated, beginners should definitely not be directed to them. The concurrency helpers in `java.util.concurrent` are to be used instead, and even if nothing there works, there is the low-level `LockSupport` class, which is a one-for-one replacement for `wait-notify`, only with warts removed.

http://stackoverflow.com/a/27434882
has comment: http://stackoverflow.com/comment/43310686
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: In this case the "highest" or last element in the array is "TenthValue". i.e. you have an array of ten strings ( 0 is counted as 1 in arrays ) so the iMax variable keeps a record of the last element in the array as indexes are added to it. For more information on array have a look here *** (B) declare and create an array to contain at least 100 records / This part claims that you are required to have an array that contains at least 100 records, going by your example your array only has an initial capacity of 10 String arrayRec[] = new String[10]; should be: String arrayRec[] = new String[100]; For future reference an ArrayList would solve this problem much better but i presume this is a homework assignment for a beginner student? Latest Update Ive just realised what your question was asking. Basically you are asked to create an array of size 100 but not fill all of it, just a few indexes. To do this use the following code: //Create the variable which will hold the last element in the array int iMax = 0; String arrayRec[] = new String[100]; arrayRec[0] = "FirstValue"; arrayRec[1] = "SecondValue"; arrayRec[2] = "ThirdValue"; arrayRec[3] = "FourthValue"; arrayRec[4] = "FifthValue"; arrayRec[5] = "SixthValue"; arrayRec[6] = "SeventhValue"; arrayRec[7] = "EigthValue"; arrayRec[8] = "NinthValue"; arrayRec[9] = "TenthValue"; //Run through each index in the array to see how many are filled //All unfilled indexes will be pre filled with null values for( String s : arrayRec ) { if( s != null ) //if the index does not contain null { iMax++; //Add another one to the counter } } System.out.println("Highest element in array = " + iMax); //iMax variable will return ten for the ten values
upvote count: 1
has comment: http://stackoverflow.com/comment/43310699
score: 1
has comment: http://stackoverflow.com/comment/43310672
accepted answer of: http://stackoverflow.com/q/27434849
has comment: http://stackoverflow.com/comment/43311048
answers question: http://stackoverflow.com/q/27434849

http://stackoverflow.com/comment/43183981
has text: Hi David. Thanks for the help and encouragement! I think that my variable called num stores the number of participants (its the user input at the start of program). For clarity this is based on just one race
type: Comment
comment on: http://stackoverflow.com/q/27365642
score: 0
type: QuestionComment

http://stackoverflow.com/q/27333884
upvote count: 1
tagged with: box2d
type: Question
tagged with: libgdx
downvote count: 0
has title: LibGDX Sprite + Box2D CircleShape: Positioning while taking into account origin
has body: My problem is, that my Box2D Body has another position than the LibGDX Sprite I want to render for that body. In my render-loop, for each body, I'm setting the position of it's sprite to the one of the body, and then rendering it. When creating a Box2D Shape other than a circle, Box2D does not move it from it's origin, and neither does the LibGDX-sprite. If I now move or set the position of the body, my sprite will always follow it. But, unfortunately, this is not possible with CircleShapes: Since LibGDX's Sprite#setPosition does not take into account the origin of the sprite (Which is only used for scaling and rotating), the sprite is set by it's lowerleft corner. So here is the problem: The Box2D CircleShape is moved by taking into account the origin! So my sprite always starts in the origin of the shape. Does anyone know how to fix that? And, ultimately, I'd want to always move both while taking into account the origin. How do I do that?
answer count: 1
has comment: http://stackoverflow.com/comment/43197878
has answer: http://stackoverflow.com/a/30910626
favorite count: 0
tagged with: position
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43236386
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43215160

http://stackoverflow.com/q/27372252
has body: I keep getting this error when I try to generate a signed APK Error:Error: This class should provide a default constructor (a public constructor with no arguments) (com.STMReport.Viewer.FirmaDigital) [Instantiatable] Can anyone help me with some advice of what is causing this? I investigated about this issue and it has to do with the super() on the default constructor but when I tried to remove the line of code it gives me another error Error:(24, 42) error: no suitable constructor found for View(no arguments) constructor View.View(Context) is not applicable Here is my class: package com.STMReport.Viewer; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Path; import android.view.MotionEvent; import android.view.View; public class FirmaDigital extends View { private Bitmap mBitmap; private Canvas mCanvas; private Path mPath; private Paint mBitmapPaint; private Paint mPaint; private float mX, mY; private static final float TOUCH_TOLERANCE = 4; public FirmaDigital(Context context) { super(context); mPath = new Path(); mBitmapPaint = new Paint(Paint.DITHER_FLAG); mPaint = new Paint(); mPaint.setAntiAlias(true); mPaint.setDither(true); mPaint.setColor(0xFF000000); mPaint.setStyle(Paint.Style.STROKE); mPaint.setStrokeJoin(Paint.Join.ROUND); mPaint.setStrokeCap(Paint.Cap.ROUND); mPaint.setStrokeWidth(3); } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); mBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); mCanvas = new Canvas(mBitmap); } @Override protected void onDraw(Canvas canvas) { canvas.drawBitmap(mBitmap, 0, 0, mBitmapPaint); canvas.drawPath(mPath, mPaint); } private void touch_starto(float x, float y) { mPath.reset(); mPath.moveTo(x, y); mX = x; mY = y; } private void touch_mover(float x, float y) { float dx = Math.abs(x - mX); float dy = Math.abs(y - mY); if (dx &gt;= TOUCH_TOLERANCE || dy …
has comment: http://stackoverflow.com/comment/66524958
score: 0
linked to: http://stackoverflow.com/q/17420637
tagged with: android
linked to: http://stackoverflow.com/q/8302229
has answer: http://stackoverflow.com/a/27372329
type: Question
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27372360
tagged with: default-constructor
has answer: http://stackoverflow.com/a/27372360
tagged with: java
has title: Android Studio: Error when creating signed apk
answer count: 2
accepted answer: http://stackoverflow.com/a/27372329

http://stackoverflow.com/a/27473909
score: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/119617071
answers question: http://stackoverflow.com/q/27473727
type: Answer
accepted answer of: http://stackoverflow.com/q/27473727
has body: k this is typical have been working on this problem for like an hour but when i post the question the answer acours to me CAST IT TO A CHAR! this works buf.flip(); while (buf.hasRemaining()) { System.out.print((char) buf.get(); } System.out.println();
upvote count: 1

http://stackoverflow.com/comment/43206566
score: 0
type: AnswerComment
has text: thank you for label example! but i 'm make a bad description for my problem... i want to add differents images for each lines. I see tonight if i can make this with a Panel.
type: Comment
comment on: http://stackoverflow.com/a/27356156

http://stackoverflow.com/q/27427110
score: 4
has title: When is a Future task finished
possible better answer: http://stackoverflow.com/a/27428077
favorite count: 0
tagged with: future
has answer: http://stackoverflow.com/a/27428077
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27428800
accepted answer: http://stackoverflow.com/a/27428800
tagged with: concurrency
type: Question
upvote count: 4
has body: Is a Future task considered finished, isDone()==true when it hits the return statement? For example: ExecutorService executor = newSingleThreadExecutor(); Future&lt;&gt; result = executor.submit(new Runnable() { @Override public void run() { return; } } Is result considered done when it hits the return ?
answer count: 2
downvote count: 0

http://stackoverflow.com/a/27316196
has comment: http://stackoverflow.com/comment/43124367
accepted answer of: http://stackoverflow.com/q/27315203
type: AcceptedAnswer
has body: If it's just an example/student/test project I would say it is okay. The getConnection method can go into the DataSource class. And since you know you won't change the database, you won't be having problems. In a production environment it would be better, if you rename your DataSource to OracleDatasource and make it a singleton. It could implement an interface Datasource, which would define the method getConnection. That way you would decouple the DAO classes from the implementation of the datasource, meaning you could easily switch the OracleDatasource for example for a MySQLDatasource. Although this would be better, the best way to go would be with a Connection pool. You could implement your own, but I would suggest using one of many widely used and supported libraries on the internet. To name a few: C3P0, DBCP, HikariCP. Regarding the test and production database - the thing to do here is to have two (or more) properties files with connection parameters to each database. When deploying on a production environment you simply switch the properties file and this is it. Your implementation already supports that. If you are deploying on a Tomcat and you use the built in Connection pool, then you have to configure the JNDI resource on the production server and on the test server, so that they are pointing each to the right database. Once this is set up, you don't have to worry any more. If you are using a library and you read the connection parameters from a properties file, then you can put it in the lib folder in the root of the application server, since that folder is on the classpath of all deployed applications. Once that properties file is in place, the application will read it and connect to the defined database.
downvote count: 0
answers question: http://stackoverflow.com/q/27315203
has comment: http://stackoverflow.com/comment/43100435
type: Answer
has comment: http://stackoverflow.com/comment/43100578
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/43100297
has comment: http://stackoverflow.com/comment/43102739

http://stackoverflow.com/comment/43134799
score: 3
has text: I see good comments and questions here, but having all the code in place will really limit down the number of people that will actually read all the way through and provide an answer. Can you narrow the code down to where your issues are?
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27339097

http://stackoverflow.com/comment/43316593
comment on: http://stackoverflow.com/q/27437743
type: Comment
has text: @Maduri - have you imported ? package org.apache.http.impl.io;& package com.jai.http;
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43120456
score: 1
comment on: http://stackoverflow.com/q/27331289
type: Comment
type: QuestionComment
has text: See also: http://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this

http://stackoverflow.com/a/27460433
type: Answer
has body: A HashSet is indeed an unsorted set. This means you can't assume anything about the order it's iterated over (and printed) - the same way you can't assume it will be ordered, you also can't assume it won't be. The order is completely up to the internal implementation.
answers question: http://stackoverflow.com/q/27460387
score: 0

http://stackoverflow.com/comment/43223466
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27387631
has text: Is "houses" word just an example? , If you want to parse plural ends you need a dictionary for that otherwise you will ecounter the issues. Flies -> fly in this example singular form is not "fli"

http://stackoverflow.com/comment/43289450
type: AnswerComment
comment on: http://stackoverflow.com/a/27423511
type: Comment
score: 0
has text: Try calling ivEventGuide.setVisibility(View.GONE); first, and then ivEventGuide.startAnimation(growAndShrink);. Swap their places.

http://stackoverflow.com/comment/43110103
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27325427
has text: What is wrong? You try to read from a `Scanner` that is `null`...
score: 1

http://stackoverflow.com/q/27361404
upvote count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43175116
downvote count: 1
type: Question
tagged with: database
score: -1
tagged with: servlets
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27361643
has title: How to Add Values to a Java DB (Derby) Database from a Servlet
has body: How would I add a value to the Java DB database from a servlet?

http://stackoverflow.com/comment/43119751
has text: I've tried adding windowListener but i think there's something wrong on my codes that it won't allow it.
comment on: http://stackoverflow.com/a/27329150
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43307913
comment on: http://stackoverflow.com/q/27433291
type: QuestionComment
type: Comment
has text: Stupid idea: can you define a `com.acme.foo` package in your code, create `SomeEnum` in that package, and see if the rest of the ecosystem keeps working? I have never tested anything like this, I wonder if this could work.
score: 2

http://stackoverflow.com/a/27435356
has comment: http://stackoverflow.com/comment/43311692
answers question: http://stackoverflow.com/q/27434896
upvote count: 1
type: AcceptedAnswer
has body: The error seems quite clear :). There is only one "reference" being accessed in the line that's throwing the exception (myListManager.fetchArticles(new Handler(new MyListLoadingCallback(this, MyListManager)));) and it is myListManager, so it must be NULL. And looking at the code, you never initialize it to anything, so it is indeed NULL :)
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43311761
accepted answer of: http://stackoverflow.com/q/27434896

http://stackoverflow.com/a/27438744
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/27437177
score: 2
downvote count: 0
has body: This is a traditional question for balancing load between host according to some pattern, You mentioned your intention is to use 'Round Robbin', But there are a lot of load balancing patterns you can use, Apache camel does provide most of the services, if you want to implement pure load balancing, try camel source code, but instead you can use stable camel implementation.

http://stackoverflow.com/q/27327860
tagged with: java
has body: I'm trying to synchronize two folders and their sub directories between a client and a server. I have a modified version of this class which I've posted below. In my Client class, I create a WatchDir object and call its processEvents() method in an infinite loop. The method returns a myTuple object (a struct containing the event type and a path object) if an event is registered and null if not. The problem is that this only seems to work for the first event to happen in the directory (i.e. if I add a file to the watched folder, my WatchDir object.processEvents() returns one Tuple with an ENTRY_CREATE event and never returns another Tuple for other file additions/deletions/modifications that happen after). I'd like for processEvents to be continuously called (hence the infinite while) returning a Tuple each time some event occurs. My modified WatchDir: import static java.nio.file.StandardWatchEventKinds.*; import static java.nio.file.LinkOption.*; import java.nio.file.attribute.*; import java.io.*; import java.util.*; import java.util.concurrent.TimeUnit; public class WatchDir { private final WatchService watcher; private final Map&lt;WatchKey,Path&gt; keys; private final boolean recursive; private boolean trace = false; public WatchDir(Path dir, boolean recursive) throws IOException { this.watcher = FileSystems.getDefault().newWatchService(); this.keys = new HashMap&lt;WatchKey,Path&gt;(); //holds the key for each subdirectory this.recursive = true; registerAll(dir); } public void registerAll(Path start) throws IOException { Files.walkFileTree(start, new SimpleFileVisitor&lt;Path&gt;() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { register(dir); return FileVisitResult.CONTINUE; } }); } public void register(Path dir) throws IOException { WatchKey key = dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY); keys.put(key, dir); } public myTuple processEvents() { WatchKey key; //while (true) { tr…
has answer: http://stackoverflow.com/a/27330250
has title: Continuously reading java WatchEvents
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27330250
downvote count: 0
score: 1
favorite count: 0
type: Question
upvote count: 1
tagged with: file-watcher
answer count: 1

http://stackoverflow.com/q/27443157
score: 2
answer count: 1
has comment: http://stackoverflow.com/comment/43337592
favorite count: 0
type: UnansweredQuestion
upvote count: 3
tagged with: boost
has answer: http://stackoverflow.com/a/27444850
tagged with: java
has comment: http://stackoverflow.com/comment/87173615
has comment: http://stackoverflow.com/comment/43401250
downvote count: 1
type: Question
has body: Is there any equivalent to boost::graph for java? Or even an adaption of boost::graph (a wrapper?). I tried JGraphIT but there seem to be compilation errors on first sight. Any alternative? Any standard library for advanced tree-structures?
has title: Boost::graph equivalent for java?
has comment: http://stackoverflow.com/comment/43325806

http://stackoverflow.com/q/27331175
has answer: http://stackoverflow.com/a/27331278
downvote count: 1
has body: Suppose we have two BitSet objects in Java with values as //&lt;MSB....LSB&gt; B1:&lt;11000101&gt; B2:&lt;10111101&gt; How can we compare B1 and B2 to know that the value represented by B1 is greater than that by B2. are logical operators (>,&lt;,==) overloaded for BitSet? or Do I have to write my own implementation? Update: just found that "The operator > is undefined for the argument type(s) java.util.BitSet, java.util.BitSet". Is there any built-in way to do so?
linked to: http://stackoverflow.com/q/2473597
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/27331313
tagged with: java
type: Question
upvote count: 4
has title: Java: BitSet comparison
favorite count: 0
has comment: http://stackoverflow.com/comment/43120229
accepted answer: http://stackoverflow.com/a/27331313
answer count: 3
possible better answer: http://stackoverflow.com/a/27331250
tagged with: bitset
has answer: http://stackoverflow.com/a/27331250

http://stackoverflow.com/q/27338544
type: UnansweredQuestion
tagged with: gridpane
has title: JavaFX - Using for loops in GridPane?
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/43135027
tagged with: java
tagged with: javafx
has body: I am trying to use two for loops to automatically add ImageView nodes to each location. When using the for loops I receive an error. When I comment the for loop code out with only one statement to add an ImageView node the code seems to work can you use for loops to populate GridPane? If so what am I doing wrong? If not what could be used as a solution? My Class: import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.GridPane; import javafx.stage.Stage; public class GridCreation extends Application { @Override public void start(Stage gameStage) throws Exception { GridPane grid = new GridPane(); Image backOfCardsImg = new Image("images/naruto_shipuden_logo.png"); ImageView backOfCards = new ImageView(backOfCardsImg); for (int i = 0; i &lt; 4; i++) { for (int j = 0; j &lt; 4; j++) { grid.add(backOfCards, i, j); } } //grid.add(backOfCards, 1,1); Scene scene = new Scene(grid); gameStage.setTitle("MemoryGame"); gameStage.setScene(scene); gameStage.show(); } public static void main(String[] args) { launch(args); } } Edit: for the code: grid.add(backOfCards, i, j); I changed the line of code to grid.add(new ImageView(backOfCardImg), i, j); this seemed to solve the problem but can anyone explain to me why the first option wouldnt work?
type: Question
has comment: http://stackoverflow.com/comment/43134089
tagged with: for-loop
has comment: http://stackoverflow.com/comment/43139202
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27342643
favorite count: 0

http://stackoverflow.com/q/27459242
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: android-imageview
tagged with: dynamic
has body: i am getting error while getting imageview control with its id error is, 12-13 08:06:56.914: E/AndroidRuntime(1967): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=0, result=-1, data=Intent { dat=content://media/external/images/media/26 }} to activity {com.example.hakslogin/com.example.hakslogin.QuestionActivityDynamic}: java.lang.ClassCastException: android.widget.Button cannot be cast to android.widget.ImageView code for getting it is, public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { Uri selectedImageUri = data.getData(); selectedImagePath = getPath(selectedImageUri); System.out.println("Image Path : " + selectedImagePath); String imgid=String.valueOf(requestCode); img = (ImageView) findViewById(requestCode); img.setImageURI(selectedImageUri); } i have not mentioned here code for creating imageview dynamically but my imageview id is 0. getting error on line , img = (ImageView) findViewById(requestCode); Hopes for your suggestion
downvote count: 1
has answer: http://stackoverflow.com/a/27459351
type: Question
has title: Dynamic created ImageView can not be get by id Android?
tagged with: imageview
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/43355378
upvote count: 0

http://stackoverflow.com/a/27395487
upvote count: 0
score: -1
answers question: http://stackoverflow.com/q/27390289
type: Answer
has body: I'd suggest to consider something simpler as NavigableMap is a pretty rich interface and you may end up spending a lot of time on features you may not need. Even a plain Map has tons of methods and AbstractMap hardly helps as it provides only very rudimentary implementations (either inefficient or throwing UnsupportedOperationException). If you could use List (with sublist for "navigation"), you'd save yourself a lot of work. Anyway, look at guava-testlib for a good testsuite. If you really need a NavigableMap, I'm afraid, you're out of luck. I guess, there's no suitable base class as it's impossible to write something useful often enough. For instance, it seems like firstEntry of a sub/tail map could just call ceilingEntry(minKey) or higherEntry(minKey), depending on whether minKey is inclusive. Yes, but this is a rather simple case. And there may be a faster way for firstEntry for a given implementation.
downvote count: 1

http://stackoverflow.com/q/27457701
has body: I followed this tutorial on how to decode json with java: https://code.google.com/p/json-simple/wiki/DecodingExamples In my project i get info_string: {"server_ip":"http://localhost:3000/","device_id":14} that i would like to decode: I tried: System.out.println(info_string); =&gt; {"server_ip":"http://localhost:3000/","device_id":14} Object obj = JSONValue.parse(info_string); System.out.println(obj); =&gt; null JSONArray array=(JSONArray)obj; =&gt; null System.out.println(array); As you can see the array and obj variable are null and contain no data! What do i wrong? Thanks
has comment: http://stackoverflow.com/comment/43352665
has comment: http://stackoverflow.com/comment/43352652
has comment: http://stackoverflow.com/comment/43352710
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/43352555
has answer: http://stackoverflow.com/a/27457936
type: AnsweredQuestion
has title: Problems decoding JSON with json-simple
type: Question
accepted answer: http://stackoverflow.com/a/27457936
answer count: 1
linked to: http://stackoverflow.com/q/6198986

http://stackoverflow.com/a/27458657
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27458635
downvote count: 0
score: 1
has body: When the button is focused, under most look and feels the Enter will activate the button. You can, however, assign a button to be the "default" button for the window, which will be activated when the Enter key pressed, so long as the focused component does not consume it. See How to Use Root Panes and JRootPane#setDefaultButton for more details

http://stackoverflow.com/comment/43245673
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27399631
has text: For `tooltechnology` I don't have any other mapping.

http://stackoverflow.com/comment/43100325
has text: I updated it with my attempt. I can't get the two nameTotal variables linked though.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27320078
type: Comment

http://stackoverflow.com/comment/43152646
type: Comment
comment on: http://stackoverflow.com/a/27348905
score: 0
type: AnswerComment
has text: @Okan Well you have to copy the values in a new list and then reverse it. Basically a O(n) operation. This is not so bad but with my solution (Pojo + LinkedList + HashSet for key uniqueness), getting the conversation in the order you want wouldn't require to copy the values and reverse them, since you already got them in the right order (`LinkedList#addFirst` and `HashSet#contains` are constant time operation).

http://stackoverflow.com/q/27474457
tagged with: unique
favorite count: 0
has body: I have created a new class in which there is an attribute called Name. I am trying to make this attribute ‘unique’. I mean that if I create an object with the name "AA", it will not be possible to create another object named "AA". How can I manage to solve this problem? EDIT: The problem is that I have to create these objects in another class (let's called it "Main.java").
tagged with: attributes
score: 2
type: AnsweredQuestion
downvote count: 0
has title: Uniqueness of an attribute in an object
type: Question
has comment: http://stackoverflow.com/comment/43383308
tagged with: java
has answer: http://stackoverflow.com/a/27474483
accepted answer: http://stackoverflow.com/a/27474483
upvote count: 2
answer count: 1
has comment: http://stackoverflow.com/comment/43383215

http://stackoverflow.com/comment/43088429
has text: http://stackoverflow.com/questions/7357969/how-to-use-java-code-to-open-windows-file-explorer-and-highlight-the-specified-f
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27314113
type: QuestionComment

gmail
type: Tag
tags question: http://stackoverflow.com/q/27440241
tag name: gmail
tags question: http://stackoverflow.com/q/27423178

http://stackoverflow.com/comment/43279096
score: 0
type: Comment
has text: Chandra i am getting checkbox like [v]alue in this way how can i format it ?
comment on: http://stackoverflow.com/a/27416777
type: AnswerComment

http://stackoverflow.com/comment/43374922
type: QuestionComment
comment on: http://stackoverflow.com/q/27469909
score: 0
has text: @user3666220 Check [this](http://stackoverflow.com/questions/237159/whats-the-best-way-to-check-to-see-if-a-string-represents-an-integer-in-java) out
type: Comment

http://stackoverflow.com/comment/43131168
type: Comment
comment on: http://stackoverflow.com/q/27326873
type: QuestionComment
has text: @VGR - still coming in as a null. I also tried setting the Content-Type to "text/plain" - still no luck.
score: 0

http://stackoverflow.com/q/27328374
tagged with: annotations
has comment: http://stackoverflow.com/comment/43115677
type: Question
tagged with: java
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27328540
has comment: http://stackoverflow.com/comment/43115700
type: UnansweredQuestion
has title: @Async is not working in REST class
tagged with: spring
tagged with: asynchronous
has comment: http://stackoverflow.com/comment/43115673
has body: I am working on a WebService project built using Spring. All the configuration are done using Annotation. There is one method which sends the push notification. As there are many notifications to send, which causes delay in response. So, I apply @Async annotation to my "sendPushnotification" method. But, still no improvement in response. I have gone through some of the blogs and stackoverflow to find the solution. But, no success. I have applied following annotation to my Service class. @Component @Configuration @EnableAspectJAutoProxy @EnableAsync Method from which async called. @POST @Path("/sampleService") @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public Response sampleService(@FormParam ...) { ... List&lt;User&gt; commentors = &lt;other method to fetch commentors&gt;; sendPushnotification(commentors); ... } My async method. @Async private void sendPushnotification(List&lt;User&gt; commentors) { if (commentors != null) { for (User user : commentors) { try { int numNewComments = ps.getCommentsUnseenByUser(user); sendMessage("ios", user, "2", "" + numNewComments, "true"); } catch (Exception e) { log.error(e.getMessage(), e); } } } } Is there anything I am missing?

http://stackoverflow.com/comment/43128463
type: Comment
comment on: http://stackoverflow.com/a/27335468
score: 0
type: AnswerComment
has text: You can always save the file to disk in the application's cache directory, which you can retrieve by calling `getCacheDir()` (see [this article](http://developer.android.com/guide/topics/data/data-storage.html#filesInternal)). Android will delete files stored here if storage space becomes limited.

http://stackoverflow.com/comment/43234734
score: 0
type: Comment
has text: http://stackoverflow.com/questions/1724205/effect-of-a-bitwise-operator-on-a-boolean-in-java According to this, |= is a LOGICAL OPERATOR when used between booleans. Is that wrong?
type: AnswerComment
comment on: http://stackoverflow.com/a/27393713

http://stackoverflow.com/q/27368816
answer count: 1
has answer: http://stackoverflow.com/a/27369003
accepted answer: http://stackoverflow.com/a/27369003
tagged with: android
has title: Send an object to an array inside another object
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43189619
type: Question
has body: I want to insert an object (type Produto) inside of an ArrayList array_produtos of objects inside the Pedido_1 object as you can see inside itemClicked method. When i run the application, and i click an element of a gridview to run this method, the application just stops, showing me the error "unfortunately, the application stopped". Produto.java public class Produto { private final int cod_produto; private String nome; private double preco; private int quantidade; private int tempo; private int imagem; public Produto(int cod_produto, String nome, double preco,int quantidade, int tempo, int imagem) { super(); this.cod_produto = cod_produto; this.nome = nome; this.preco = preco; this.quantidade = quantidade; this.tempo = tempo; this.imagem = imagem; } } Pedido.java public class Pedido { private final int cod; private static int cod_aux=1; private int tempo_total; private double preco; private ArrayList&lt;Produto&gt; array_produtos; public Pedido() { this.cod = cod_aux; cod_aux++; } public void addProduto(Produto prodt){ this.array_produtos.add(prodt); this.tempo_total += prodt.getTempo(); this.preco += prodt.getPreco(); } } MainActivity.java public class MainActivity extends Activity { private ArrayList&lt;Produto&gt; produtos; private ArrayList&lt;Pedido&gt; produtos_pedidos; private int number_requests; private Produto produto_1; private Pedido pedido_1; private GridView gv; private ListView lv; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); produtos = new ArrayList&lt;Produto&gt;(); produtos_pedidos = new ArrayList&lt;Pedido&gt;(); number_requests=0; //Products produto_1 = new Produto(1, "Café",0.60,4,4,R.drawable.cafe1); produtos.add(produto_1); //Requests pedido_1 = new Pedido(); //cria primeiro pedido produtos_pedidos.add(pedido_1); //Atribui à lista de pedidos gv = (GridView)findViewById(R.id.gv_produtos); lv = (ListView) findViewById(R.id.lv_produtos_pedidos); gv.setA…
score: 0
has comment: http://stackoverflow.com/comment/43189719

http://stackoverflow.com/comment/43347448
type: Comment
comment on: http://stackoverflow.com/a/27454709
has text: Ahhh, thank you so much. This has been bugging me for like a week and it's such a relief to complete it!
type: AnswerComment
score: 0

http://stackoverflow.com/a/27414305
has comment: http://stackoverflow.com/comment/139517887
has comment: http://stackoverflow.com/comment/43293089
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/43282982
has comment: http://stackoverflow.com/comment/43290658
has body: ListFragment essentially provides shortcuts for interacting with a Fragment whose layout contains a single ListView (and nothing else, by default). The ListFragment does not provide any performance advantage, as far as I know. You can inspect the source code here if you would like to know more about how the class functions. My preference is to avoid ListFragments - I find them inflexible if the layout of a screen ever needs to change, plus they use slightly differently-named APIs that can be somewhat fiddly to remember (onListItemClick, vs the onItemClick callback of a standard AdapterView, for example). Here is a good article that describes how to handle empty ListViews. You are looking for the setEmptyView(View) method of ListView. This allows you to specify the view to be displayed when the ListView is empty.
downvote count: 0
answers question: http://stackoverflow.com/q/27413289
has comment: http://stackoverflow.com/comment/43297084

http://stackoverflow.com/q/27422336
tagged with: java
tagged with: swing
has comment: http://stackoverflow.com/comment/43289517
type: Question
linked to: http://stackoverflow.com/q/15025092
has body: I made my own RoundedBorder instead of using LineBorder with rounded corner because I wanted to set the arc size. public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D g2 = (Graphics2D) g; Shape roundRect = new RoundRectangle2D.Double(x + thickness / 2, y + thickness / 2, width - thickness, height - thickness, arcSize, arcSize); Area area = new Area(roundRect); g2.setColor(color); g2.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)); g2.setStroke(new BasicStroke(thickness)); g2.draw(area); } I used some code from border-with-rounded-corners-transparency to use the parent background color outside of the rounded borders. Though it does not work properly with TitledBorder taking a RoundedBorder as it does with only a RoundedBorder. Added the following code to my paintBorder. Component parent = c.getParent(); if (parent != null) { Color bg = parent.getBackground(); Rectangle rect = new Rectangle(x, y, width, height); Area borderRegion = new Area(rect); borderRegion.subtract(area); g2.setClip(borderRegion); g2.setColor(bg); g2.fillRect(x, y, width, height); g2.setClip(null); } Any idea how to fix this to work properly? Edit: A new implementation of paintBorder is getting me a little closer: public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) { Graphics2D g2 = (Graphics2D) g; Shape roundRect = new RoundRectangle2D.Double(x + thickness / 2, y + thickness / 2, width - thickness, height - thickness, arcSize, arcSize); Area area = new Area(roundRect); final Rectangle componentRect = c.getBounds(); final int componentWidth = (int) componentRect.getWidth(); final int componentHeight = (int) componentRect.getWidth(); // Paint the BG color of the parent in the entire rectangle of the component. // Then repaint the area inside the border. Component parent = c.getParent(); if (parent != null) { g2.setColor(parent.getBackground()); g2.fillRect(0, 0, …
has comment: http://stackoverflow.com/comment/43309794
has comment: http://stackoverflow.com/comment/43290805
tagged with: border
score: 0
tagged with: rounded-corners
has title: Cutting background outside of rounded Swing borders
has comment: http://stackoverflow.com/comment/43286995
has comment: http://stackoverflow.com/comment/43300244
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43328060
answer count: 0

http://stackoverflow.com/comment/43317458
has text: Like this `someClassInstance.new someException()`.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27434199

http://stackoverflow.com/a/27393565
has body: Others have pointed out that an object this large is likely not a great pattern to follow, so I'll assume you know that already and have decided to proceed anyways. I'm also going to assume this object is (mostly) immutable, since implementing .hashCode() for mutable objects is generally a bad plan (at the very least, you have to be careful about putting mutable objects in a HashSet or as keys in a HashMap). If you have a class with a large number of fields you can avoid defining complex .hashCode(), .equals(), and .toString() methods by taking advantage of existing functionality that does the same thing. An easy option is to construct a List or Map of your fields, and simply call the respective methods of that Collection. You can even cache the return values of these functions, rather than hold onto the whole Collection, if you want. There are also many useful utilities to make these methods easier; there's way too many to list, but I'll try to call out a couple of particularly useful ones: Stock JDK: Hashing: Objects.hash(), Arrays.hashCode() Equals: Arrays.equals() ToString: Arrays.toString() Guava: Hashing: Hashing.combineOrdered() and a whole batch of powerful hashing utilities. Equals: Iterables.elementsEqual() ToString: MoreObjects.toStringHelper() AutoValue: Awesome tool, does everything you want for you as long as your object is conceptually a value type. Additionally, you could use reflection to get all the fields in your object at runtime. This would be slower than a hard-coded implementation, but it would likely be faster to write. If you aren't overly concerned about speed, this is a good option.
type: Answer
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27393011

http://stackoverflow.com/q/27417091
has comment: http://stackoverflow.com/comment/43277922
score: -1
has comment: http://stackoverflow.com/comment/43277648
tagged with: hadoop
answer count: 2
favorite count: 0
has answer: http://stackoverflow.com/a/27420323
has comment: http://stackoverflow.com/comment/43277730
tagged with: jdbc
has comment: http://stackoverflow.com/comment/43277775
has comment: http://stackoverflow.com/comment/43277807
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43277726
possible better answer: http://stackoverflow.com/a/27419229
has title: why can I not connect to my hive DB?
has answer: http://stackoverflow.com/a/27419229
downvote count: 2
has body: I'm new to hive. I'm trying this code enter link description here This my code import java.sql.SQLException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.Statement; import java.sql.DriverManager; public class HiveJdbcClient { private static String driverName = "org.apache.hadoop.hive.jdbc.HiveDriver"; public static void main(String[] args) throws SQLException { try { Class.forName(driverName); System.out.println("Drive loaded..."); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); System.exit(1); } System.out.println("Before Connecting to hive..."); try { Connection con = DriverManager.getConnection("jdbc:hive://servername:10001/test","hive","hive"); System.out.println("Connected to hive.."); Statement stmt = con.createStatement(); String tableName = "testHiveDriverTable"; ResultSet res = stmt.executeQuery("create table " + tableName + " (key int, value string)"); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); System.exit(1); } } } When I run program It's executed only driver loading step, but when DriverManager.getConnection() executed it runs forever. So it doesn't give any exception or error. So please help me resolve this issue.
upvote count: 1
has comment: http://stackoverflow.com/comment/43277713
tagged with: hive
type: Question
accepted answer: http://stackoverflow.com/a/27420323
tagged with: hadoop2
tagged with: java

http://stackoverflow.com/comment/43327953
type: QuestionComment
comment on: http://stackoverflow.com/q/27444331
has text: thanks a lot, and elder i want to make friends with you to, can you give me some inofrmation about you like email?
score: 0
type: Comment

http://stackoverflow.com/comment/43327018
type: QuestionComment
has text: @Dima Maligin It does its just not as effective as some other methods. But I have found a effective method. Feel free to use it. There is just problems when doing that method.
comment on: http://stackoverflow.com/q/27439225
score: 0
type: Comment

http://stackoverflow.com/a/27458683
accepted answer of: http://stackoverflow.com/q/27454741
has comment: http://stackoverflow.com/comment/43359129
has comment: http://stackoverflow.com/comment/43370488
has comment: http://stackoverflow.com/comment/43373644
has comment: http://stackoverflow.com/comment/43363263
score: 0
answers question: http://stackoverflow.com/q/27454741
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43364695
has comment: http://stackoverflow.com/comment/43366858
type: Answer
has comment: http://stackoverflow.com/comment/43366630
has body: Anyhow, mule leverages a hyerarchical classpath isolating intentionally the applications to reduce clashing. Please, read this document to understand it better. If what you have is some kind of shared utility, why not just create a common project that creates a jar and then just have both projects to depend on it?
has comment: http://stackoverflow.com/comment/43359122
has comment: http://stackoverflow.com/comment/43366761

http://stackoverflow.com/q/27392175
answer count: 2
favorite count: 0
accepted answer: http://stackoverflow.com/a/27392189
has answer: http://stackoverflow.com/a/27392193
has comment: http://stackoverflow.com/comment/43231897
has comment: http://stackoverflow.com/comment/43231913
type: AnsweredQuestion
has title: Java Adding multiple elements to an ArrayList
tagged with: java
possible better answer: http://stackoverflow.com/a/27392193
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27392189
upvote count: 0
has body: Still new to java, but I'm having an issue adding multiple new elements to my arraylist. The idea for this method is to look and see if a name is already in the list, and if so return false, and if not then add the name and person's score to the arraylist. I keep getting an error when I try to add it in. The add will work if it's just the name portion I add in, but once I also include the scoreOn1st it gives me an error. public boolean addGolfer(String name, int scoreOn1st) { // check if the golfer is already in the collection for (int i = 0; i &lt; board.size(); i++) { if (board.get(i).equals(name)) { return false; } } // otherwise board.add(new ScoreCard(name, scoreOn1st)); return true; } This is the constructor class already created for the arraylist: public ScoreBoard(String tourneyName) { // initialize instance varable this.tournament = tourneyName; ArrayList&lt;ScoreCard&gt; board = new ArrayList&lt;ScoreCard&gt;(); }
score: -1
has comment: http://stackoverflow.com/comment/43231851
has comment: http://stackoverflow.com/comment/43231890
tagged with: arraylist

http://stackoverflow.com/comment/43370570
type: AnswerComment
comment on: http://stackoverflow.com/a/27467446
type: Comment
has text: I believed the same. But the location I always found random. Many times in home directory with folder name **~/temp**
score: 0

http://stackoverflow.com/comment/43321065
comment on: http://stackoverflow.com/q/27436917
has text: @EJP I already tried for API but not found
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27419539
answers question: http://stackoverflow.com/q/27419390
has comment: http://stackoverflow.com/comment/43282064
has comment: http://stackoverflow.com/comment/43282436
score: 0
has comment: http://stackoverflow.com/comment/43282006
has body: In addition to the comment, you may obtain all available monitors: GraphicsDevice.getLocalGraphicsEnvironment().getScreenDevices() and know them resolutions
type: Answer

http://stackoverflow.com/comment/43198007
type: QuestionComment
comment on: http://stackoverflow.com/q/27373201
has text: That is how I found it. It is is the movement method.
score: 0
type: Comment

http://stackoverflow.com/comment/43421954
score: 0
type: QuestionComment
has text: No, then I get the error. If I edit the email from the person it will work for person. The point what me confuse, the email object from person and child are the same.
type: Comment
comment on: http://stackoverflow.com/q/27401424

http://stackoverflow.com/q/27442402
has title: Java ArrayList.add() method thread safe for purely parallel adding?
has answer: http://stackoverflow.com/a/27442516
has comment: http://stackoverflow.com/comment/43324065
has body: Consider a for-loop over a function that takes an ArrayList reference and adds an object to that ArrayList. I would now like to execute each function call in parallel. Is the ArrayList.add() method thread safe if I don't care about the sequence the objects are added and no function reads or manipulates any ArrayList elements? So I only want to make sure that at the end of the parallel call all objects are added to the list.
has answer: http://stackoverflow.com/a/27449363
has answer: http://stackoverflow.com/a/27442457
has comment: http://stackoverflow.com/comment/43324702
tagged with: java
tagged with: multithreading
has answer: http://stackoverflow.com/a/27442470
has comment: http://stackoverflow.com/comment/43325071
type: Question
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/2715983
upvote count: 6
tagged with: thread-safety
answer count: 6
has answer: http://stackoverflow.com/a/27442925
duplicate of: http://stackoverflow.com/q/9468187
accepted answer: http://stackoverflow.com/a/27442455
possible better answer: http://stackoverflow.com/a/27442516
tagged with: arraylist
score: 5
has comment: http://stackoverflow.com/comment/43324049
linked to: http://stackoverflow.com/q/9468187
has comment: http://stackoverflow.com/comment/43324449
downvote count: 1
has answer: http://stackoverflow.com/a/27442455
favorite count: 0

http://stackoverflow.com/a/27462377
downvote count: 0
score: 1
has body: I don't think you need to use AspectJ to modify your classes. I don't see what benefits using compile team weaving would add. I would suggest having your POJOs use implements Serializableand then serialize your objects using an ObjectOutputStream. A simple example writing an object to a file: outputStream = new ObjectOutputStream(new FileOutputStream(filePath)); outputStream.writeObject(yourObject); ... // do whatever else and close stream Similar questions: Saving to binary/serialization java Best way to store data for your game? (Images, maps, and such)
type: Answer
answers question: http://stackoverflow.com/q/27460873
upvote count: 1
has comment: http://stackoverflow.com/comment/43362131

http://stackoverflow.com/comment/43347734
has text: @WilliamSeemann yes, you are right. I do try this method many many times, then I find that android `MediaPlayer` cannot recognize my mp4 file! I just change a mp4 file, it works. But I can play the video in windows, why both mp4, one can play while the other cannot?
comment on: http://stackoverflow.com/q/27374740
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43298270
type: Comment
comment on: http://stackoverflow.com/q/27427892
has text: It will not be. Cryptographically secure hashes do not work that way.
score: 0
type: QuestionComment

android-listview
tags question: http://stackoverflow.com/q/27374594
tags question: http://stackoverflow.com/q/27397955
tags question: http://stackoverflow.com/q/27358996
tags question: http://stackoverflow.com/q/27374445
tags question: http://stackoverflow.com/q/27415664
tags question: http://stackoverflow.com/q/27330827
tags question: http://stackoverflow.com/q/27333404
tag name: android-listview
tags question: http://stackoverflow.com/q/27371131
type: Tag
tags question: http://stackoverflow.com/q/27369388
tags question: http://stackoverflow.com/q/27463035
tags question: http://stackoverflow.com/q/27420064
tags question: http://stackoverflow.com/q/27367636
tags question: http://stackoverflow.com/q/27405402

http://stackoverflow.com/comment/43148096
comment on: http://stackoverflow.com/q/27346068
type: Comment
score: 1
type: QuestionComment
has text: Everything looks ok. Try with `p.getErrorStream()` instead of `p.getInputStream()` to get description of the error.

http://stackoverflow.com/comment/43435104
type: QuestionComment
has text: @FlyingGuy If I am using JDBC "Thin" then for remote oracle access i want firewall permission which may not required using "OCI" so..
comment on: http://stackoverflow.com/q/27445610
score: 0
type: Comment

http://stackoverflow.com/q/27366329
has comment: http://stackoverflow.com/comment/43184680
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27366513
has comment: http://stackoverflow.com/comment/43184597
tagged with: segment
downvote count: 1
has body: I need help finding how to segment an array to find every four values and see if those values go over 10. I tried to implement .subList but I'm not sure if that would be on the right track. Below is what i currently have done so far so thanks for help in advance. import java.util.Scanner; public class Problem1 { public static void main(String [] args){ Scanner sc = new Scanner(System.in); System.out.print( "Enter how many downs there are:"); int x = sc.nextInt(); double[] yards = new double [x]; double num1 = 0; for (int i = 0; i &lt; yards.length; i++){ //System.out.print( (i+1)+ " Enter the quality of the food on a scale from 1-5:"); System.out.print( "Enter the yards they moved:"); yards[i] = sc.nextDouble(); num1 += yards[i]; if (yards[i] &lt;=0){ System.out.print("SAFETY"); } if ( num1 == 100){ System.out.print("TOUCHDOWN"); System.exit(0); //System.out.print( num1 ); } } } } }
type: Question
tagged with: java
score: -1
has comment: http://stackoverflow.com/comment/43184828
has answer: http://stackoverflow.com/a/27366525
answer count: 2
upvote count: 0
has title: How to find segments of an array
tagged with: arrays
favorite count: 0

http://stackoverflow.com/comment/43134593
has text: Yes, `private` is a reserved word. `Private` is not.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27338964
type: AnswerComment

http://stackoverflow.com/comment/43123776
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27323331
has text: 1.0. Does 1.1 has such feature?

http://stackoverflow.com/q/27367653
type: Question
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/92346479
has body: I might need some explaining of stuff I haven't found answers for - neither here nor in javadoc or in the spec... (at least until now) I am building an application which will have to execute Javascript code, with the help of JSR 223. I am interacting with the JS world through a couple of JS objects which are available to me through global variables. This is why I mainly use Invocable.invokeMethod for my calls to JS. (And I create these objects by calling JS constructors through Invocable.invokeFunction and set the returned object in a JS var with ScriptEngine.put(). The actual code I read in with ScriptEngine.eval()) Now this is a server application, so CPU footprint and execution speed are important. So I discovered Compilable. Which brings me to my first question: Why does this interface exist at all? Why don't the different script engines do this internally and transparently? Ok, but back to the assumption that I have to use Compilable. And instead of reading my JS sources with ScriptEngine.eval I would use Compilable.compile(). Which would return a CompiledScript to me. Which has an interface that only offers eval methods. But not anything which resembles the API of Invocable. So how do I get back from my CompiledScript to Invocable? I still want to use that, the API gives me a nice abstraction! :-) Anybody can help me out with that? (This is all happening on Java 7 with Rhino. But of course migration to Java 8 - meaning Nashorn - is coming soon so I will have to deal with both engines.) Thanks a lot, Torben Update: Ok, now I just discovered that I overlooked some sections in the spec, the ones about Invocable and Compilable. So it seems like I will already get the benefit of compilation when using Invocable (why didn't they mention this in the javadoc?!). But then I still have a question: How do I import my source code? Will Invocable do a quasi-compilation of my code if I import it with ScriptEngine.eval?
has comment: http://stackoverflow.com/comment/92347084
tagged with: javascript
type: UnansweredQuestion
tagged with: jsr223
score: 3
downvote count: 0
answer count: 0
favorite count: 0
has title: JSR 223 ScriptEngine, Invocable, Compilable/CompiledScript - do they supplement each other?

http://stackoverflow.com/comment/43385874
type: Comment
has text: That wouldn't cause an NPE. You'll find it was `itemRecord[x].setItemNumber("");`. See my answer.
comment on: http://stackoverflow.com/q/27413029
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43106274
comment on: http://stackoverflow.com/q/27323404
has text: Yep! Really not sure what Im doing in faireness Ouney and Hovercraft Full of Eels. Im sure that was obvious tho! Not sure how to loop through and test in loop
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27449857
has answer: http://stackoverflow.com/a/27449883
has body: I am aware this might be a super-basic Java question, but I am a complete newbie in Java. Let's assume I have the following two classes in Java: public class Cell { private Integer value; public Integer setValue(Integer value) { this.value = value; } public Integer getValue() { return value; } } public class Grid { private Cell[][] cells = new Cell[9][9]; public void setCell(int row, int column, Integer value){ cells[row][column].setValue(value); } } Let alone for the fact that the code is unsafe if row or column exceed 8, my understanding is that Grid allocates the memory for 9 x 9 Cells, so that the method setCell(1,1, 10) should be ok (i.e. not cause a NullPointerException), right? However, when making JUnit tests for this cases this is exactly the error I've got. I can only overcome this error if instead of cells[row][column].setValue(value); I use cells[row][column] = new Cell(); cells[row][column].setValue(value); But I have the impression that I am instantiating Cell twice. What am I missing here? Is the instruction private Cell[][] cells = new Cell[9][9]; just allocating the structure (i.e. pointers) to hold the Cell objects without actually reserving memory for the objects themselves? Thanks! @Tryskele
type: AnsweredQuestion
tagged with: java
has title: How to set-up/use a 2D dimensional array as member of a Java class
tagged with: memory
type: Question
has answer: http://stackoverflow.com/a/27449951
possible better answer: http://stackoverflow.com/a/27449883
tagged with: arrays
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27450162
accepted answer: http://stackoverflow.com/a/27450162

http://stackoverflow.com/q/27383783
tagged with: keytool
favorite count: 0
has title: Keytool says alias both exists and does not exist. How do I start from scratch with a clean slate?
has body: For a project I'm working on, we need certificates in order to authenticate. When I first ran keytool.exe, I got the following: &gt; keytool.exe -list Your keystore contains 0 entries However, I attempted to import the certificates incorrectly like this: keytool.exe -import -alias dev01 -file cacert1.crt -keystore C:\Dev\Resources\Java\JDK_7\jdk1.7.0_67\jre\lib\security\cacerts Then when I ran a listing I got this: &gt; keytool.exe -list Keystore type: JKS Keystore provider: SUN Your keystore contains 0 entries So, I thought "Strange, I'll do it again." So I ran the command again, but keytool gave me this error: keytool error: java.lang.Exception: Certificate not imported, alias &lt;dev01&gt; already exists Then when I ran a listing I got this: &gt; keytool.exe -list Keystore type: JKS Keystore provider: SUN Your keystore contains 0 entries However, whenever I do a listing, keytool always says I have 0 entries. Then, I discovered from a co-worker that the command I really needed to run is: keytool.exe -import -trustcacerts -file cacert1.crt -alias dev01 -keystore C:\Dev\Resources\Java\JDK_7\jdk1.7.0_67\jre\lib\security\cacerts I tried to delete the "JKS" and "SUN", but I cannot figure out how. At this point, all I want to is go back to a clean slate, and start all over with the correct import command. How can I do this?
score: 4
type: UnansweredQuestion
type: Question
has answer: http://stackoverflow.com/a/34320457
tagged with: java
upvote count: 4
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/43339557
score: 0
type: Comment
type: QuestionComment
has text: Kindly make i=0 in your second for loop instead of i=1.
comment on: http://stackoverflow.com/q/27450369

http://stackoverflow.com/comment/58939401
type: AnswerComment
score: 0
type: Comment
has text: Is this still true with Java 8, or did they make improvements?
comment on: http://stackoverflow.com/a/27466264

http://stackoverflow.com/a/27371089
has comment: http://stackoverflow.com/comment/43203593
has comment: http://stackoverflow.com/comment/43208313
has body: There's no compilation error because + is a valid (albeit fairly useless) unary operator in the same way that - is: int x = +1; int y = -1; The relevant section in the Java Language Specification is Unary Plus Operator + (§15.15.3 ). It specifies that invoking the unary + operation results in Unary Numeric Promotion (§5.6.1) of the operand. This means that: If the operand is of compile-time type Byte, Short, Character, or Integer, it is subjected to unboxing conversion (§5.1.8). The result is then promoted to a value of type int by a widening primitive conversion (§5.1.2) or an identity conversion (§5.1.1). Otherwise, if the operand is of compile-time type Long, Float, or Double, it is subjected to unboxing conversion (§5.1.8). Otherwise, if the operand is of compile-time type byte, short, or char, it is promoted to a value of type int by a widening primitive conversion (§5.1.2). Otherwise, a unary numeric operand remains as is and is not converted. In any case, value set conversion (§5.1.13) is then applied. In short, this means that numeric primitive wrapper types are unboxed, and; integer types smaller than int are widened to int.
has comment: http://stackoverflow.com/comment/43201743
has comment: http://stackoverflow.com/comment/43349787
has comment: http://stackoverflow.com/comment/43216451
has comment: http://stackoverflow.com/comment/43193667
has comment: http://stackoverflow.com/comment/43259392
has comment: http://stackoverflow.com/comment/43199442
accepted answer of: http://stackoverflow.com/q/27371075
has comment: http://stackoverflow.com/comment/43207985
has comment: http://stackoverflow.com/comment/43210750
score: 105
has comment: http://stackoverflow.com/comment/43269753
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27371075
has comment: http://stackoverflow.com/comment/43195835
has comment: http://stackoverflow.com/comment/43204700
has comment: http://stackoverflow.com/comment/43224800
has comment: http://stackoverflow.com/comment/43219551
has comment: http://stackoverflow.com/comment/43193659
has comment: http://stackoverflow.com/comment/43240726
has comment: http://stackoverflow.com/comment/43195495
has comment: http://stackoverflow.com/comment/43205171
type: Answer
has comment: http://stackoverflow.com/comment/43204665
downvote count: 0
has comment: http://stackoverflow.com/comment/43205021
has comment: http://stackoverflow.com/comment/43196010
upvote count: 105
has comment: http://stackoverflow.com/comment/43241701
has comment: http://stackoverflow.com/comment/43194052
has comment: http://stackoverflow.com/comment/43201822

http://stackoverflow.com/comment/92775538
type: AnswerComment
type: Comment
has text: Thanks! Just for curiosity, why "JAVA_HOME=/opt/java/openjdk" works but "JAVA_HOME=$(/usr/libexec/java_home)" doesn't for custom Java installation?
comment on: http://stackoverflow.com/a/28686920
score: 0

http://stackoverflow.com/a/27457088
has body: If the input for your tip is 15. Using tip = meal.nextDouble() / 100.0; System.out.println(tip); would OUTPUT: 0.15
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27456884

http://stackoverflow.com/q/27417618
has answer: http://stackoverflow.com/a/28648166
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: google-app-engine
has comment: http://stackoverflow.com/comment/44664080
has body: I'm using Eclipse 4.4.1 with the latest gae plugins. When I saved da java file in a project, a NPE was thrown: "Errors occurred during the build. Errors running builder 'Enhancer' on project." Here's the stack trace: !STACK 0 !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources". java.lang.NullPointerException at com.google.appengine.eclipse.core.orm.enhancement.AutoEnhancer.hasValidSdk(AutoEnhancer.java:188) at com.google.appengine.eclipse.core.orm.enhancement.AutoEnhancer.build(AutoEnhancer.java:126) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:246) at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:299) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:302) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:358) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:381) at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:143) at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:241) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) !MESSAGE Errors running builder 'Enhancer' on project ... !STACK 0 java.lang.NullPointerException at com.google.appengine.eclipse.core.orm.enhancement.AutoEnhancer.hasValidSdk(AutoEnhancer.java:188) at com.google.appengine.eclipse.core.orm.enhancement.AutoEnhancer.build(AutoEnhancer.java:126) at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:206) at org.eclipse.core.intern…
tagged with: google-plugin-eclipse
has comment: http://stackoverflow.com/comment/44525485
tagged with: java
type: Question
score: 2
downvote count: 0
has title: Eclipse NPE on project update

http://stackoverflow.com/comment/43135718
has text: Nice game by the way ;)
type: Comment
comment on: http://stackoverflow.com/q/27339552
score: 0
type: QuestionComment

http://stackoverflow.com/a/27329542
score: 5
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27328994
upvote count: 5
answers question: http://stackoverflow.com/q/27328994
downvote count: 0
has body: It is not only good practice, it is the way Java was intended to be written. Why is each public class in a separate file? Multiple classes in the same file is possible, with nested classes and anonymous classes and so on, but you should really have a good reason to do such a thing. There is nothing wrong with a small class, and it greatly improves readability when you are not searching through large files looking for internal classes.

http://stackoverflow.com/q/27344122
answer count: 1
tagged with: junit
downvote count: 0
favorite count: 0
has title: Hibernate listeners are not getting invoked in Spring JUnit test
upvote count: 2
tagged with: spring
has comment: http://stackoverflow.com/comment/43158829
score: 2
type: AnsweredQuestion
has body: I'm creating Spring MVC application with Hibernate as the data access layer. All my entities contain createdOn and updatedOn fields, which contain timestamps when the entity was created/updated. The createdOn field is set using PreInsertEventListener and the updatedOn field is set using PreUpdateEventListener. When I run my application, it works as expected, listeners are registered and when I save an entity, appropriate listeners are invoked (verified using debugger). But when I try to unit test this behavior, the listeners are registered, but never invoked. I determined using debugging that when I save an entity in my application EntityInsertAction#preInsert is invoked, which loops through the registered listeners and invokes them. But when I run my unit test this method is never invoked. Here is an example of my unit test: @ActiveProfiles("test") @Transactional @TransactionConfiguration @ContextConfiguration(classes = { BaseConfiguration.class, DatabaseConfiguration.class }) @RunWith(SpringJUnit4ClassRunner.class) public class HibernateListenerTest { @Autowired private FooDao fooDao; @Test public void testPreUpdateListener() { Foo foo = fooDao.merge(createFoo()); Assert.assertNotNull(foo.getCreatedOn()); Assert.assertNull(foo.getUpdatedOn()); foo.setBar("Bar"); foo = fooDao.merge(foo); Assert.assertNotNull(foo.getUpdatedOn()); } } Because the listeners are not invoked the unit tests always fail with the following exception: org.hibernate.PropertyValueException: not-null property references a null or transient value So my question is: why is this behavior different between running the application and running the unit test and if there is a way to fix the code so that the listeners are correctly invoked in my unit tests? Thanks in advance for any input. Please leave a comment if additional code/information is needed.
has answer: http://stackoverflow.com/a/27464018
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/27464018
tagged with: unit-testing
type: Question

http://stackoverflow.com/comment/43641467
type: Comment
type: QuestionComment
score: 0
has text: Sorry. i found what it is? Its just a log... while running the program its printing in the console....Thanks to @ShaikhMohammedShariq
comment on: http://stackoverflow.com/q/27444986

http://stackoverflow.com/a/27509130
score: 1
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27462465
answers question: http://stackoverflow.com/q/27462465
type: Answer
downvote count: 0
has body: Here is my answer for keeping track of this, this method takes a couple of parameters for convience: /** Basically creates to-start number of futures in a while loop, while passing the index to a Lambda that is passed and that returns a Runnable which will have access to the index. See example below. **/ public static CompletableFuture[] async(ExecutorService executorService, int start, int to, Runnable beforeAll, Lambda.R1&lt;Runnable, Integer&gt; onEach, Double onPercentage, Runnable onPercentageRun, Runnable afterAll) { CompletableFuture[] futures = new CompletableFuture[to-start]; double onPercentageIndex = Valid.elvis(onPercentage, 0.0) * futures.length; // When to onPercentageRun AtomicBoolean percentageMet = new AtomicBoolean ( false ); AtomicBoolean completeMet = new AtomicBoolean ( false ); AtomicInteger complete = new AtomicInteger ( 0 ); int i = start; if ( i &lt; to &amp;&amp; beforeAll != null ) { beforeAll.run(); } boolean percentageSet = onPercentageIndex &gt; 0.0 &amp;&amp; onPercentageRun != null; boolean completeSet = afterAll != null; while( i &lt; to ) { Runnable call = onEach.call(i); futures[i-start] = CompletableFuture.runAsync( () -&gt; { try { call.run(); } catch (Throwable e) { $Log.info(Concurrency.class, "RunAsync: run", e); } if ( percentageSet || completeSet ) { complete.incrementAndGet(); if ( percentageSet &amp;&amp; !percentageMet.get() &amp;&amp; complete.get() &gt;= onPercentageIndex) { percentageMet.set(true); try { onPercentageRun.run(); } catch(Throwable e) { $Log.info(Concurrency.class, "RunAsync: onPercentage", e); } } if ( completeSet &amp;&amp; !completeMet.get() &amp;&amp; complete.get() == to ) { completeMet.set(true); // Just for clarity, propably redundant try { afterAll.run(); } catch(Throwable e) { $Log.info(Concurrency.class, "RunAsync: onComplete", e); } } } }, executorService ); ++i; } return futures; } For a reference to what Lambda.R1 is, see this, Lambda interfaces The method can be used like this: private void r…

http://stackoverflow.com/a/40605971
has body: I had a "Run" problem in Android Studio due to multiple instances of Android Studio were opened. So I closed all instances and opened only on instances for which I wanted to generate APK.And It worked well. May be it had a problem with RAM.
type: Answer
score: -1
answers question: http://stackoverflow.com/q/27407855
downvote count: 1
upvote count: 0

http://stackoverflow.com/comment/43209194
comment on: http://stackoverflow.com/q/27379961
score: 0
type: Comment
type: QuestionComment
has text: possible duplicate of [Using Maven to just download JARs](http://stackoverflow.com/questions/7559500/using-maven-to-just-download-jars)

http://stackoverflow.com/a/27424871
type: Answer
has comment: http://stackoverflow.com/comment/43291773
has comment: http://stackoverflow.com/comment/43291696
score: 2
accepted answer of: http://stackoverflow.com/q/27424449
answers question: http://stackoverflow.com/q/27424449
has body: name is the name of the form bean (an ActionForm of some sort). attribute is the name of the form bean in the session or request if it's different than the name.
type: AcceptedAnswer
downvote count: 0
upvote count: 2

http://stackoverflow.com/a/27344252
answers question: http://stackoverflow.com/q/27344232
downvote count: 0
has comment: http://stackoverflow.com/comment/43144119
has body: Just declare a variable JPanel and add it to the Frame. JPanel panel = new JPanel(); this.setContentPane(panel);
has comment: http://stackoverflow.com/comment/43143903
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43143931
score: 1
has comment: http://stackoverflow.com/comment/43143840

http://stackoverflow.com/comment/43353935
has text: NO! Just no. Stop attaching `KeyListener`s to text components, they are not appropriate for modifying/filter content into text components, for a copious amount of reasons, apart from the fact that there are better ways to achieve the same result but it will not take into consideration the use case where the user pastes text into the field. There is also no need to use a custom `Document` either.
score: 1
comment on: http://stackoverflow.com/a/27458200
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43281146
has text: I know, and so far as I understand, google is concentrating efforts on Android Studio, and not on ADT. Did the use of `Empty Activity` work for you, to get the basic template in place?
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27414093
score: 0

http://stackoverflow.com/q/27314836
tagged with: struts2
score: 0
has answer: http://stackoverflow.com/a/27316512
answer count: 1
type: UnansweredQuestion
tagged with: actionresult
has title: Put session for a Struts 2 action result of type stream
tagged with: java
tagged with: stream
has comment: http://stackoverflow.com/comment/43094142
type: Question
has body: I have a Struts 2 action where a response of type stream is generated by velocity. But this is HTML and JavaScript but not all the stuff I need like session, cookie etc. How can I pass, in my action, session and cookie to the response? My action: @Action(value = "example", results = { @Result(name = "success", type = "stream", params = { "contentType", "text/html" }) }) public String example() throws Exception { serviceId = (Long) getObjectSession("serviceId"); selIdfile = Long.parseLong(idpreview); MpsServiceTemplate mpsServiceTemplate = mpsServiceTemplateDAO .getMpsServiceTemplateById(selIdfile); MpsService service = (MpsService) maasCustomDAO.loadbyId(MpsService.class, serviceId); String html = htmlBuilder.getHtml(service.getParent().getName(), service.getName(), new String(mpsServiceTemplate.getTemplateCode()), null); inputStream = new StringBufferInputStream(html); return SUCCESS; }

http://stackoverflow.com/comment/43340143
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27450518
has text: My friend as you have mentioned in the first comment like to close the connection like this [MongoClient.close()]. so i am trying like that. I did check the source code of MongoClient and Db file. i didn't get any method like close(). Thanks
type: Comment

http://stackoverflow.com/comment/43366031
type: Comment
has text: I deleted my comment because I don't think that ? extends CharSequence[] is actually a type. I'm not entirely sure what it is though. I've tried and failed on many occasions to understand java generics and types, but they're totally incomprehensible.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27464708

http://stackoverflow.com/q/27432603
tagged with: mysql
has body: I have this problem when I execute a select: My StackTrace is : java.lang.NullPointerException org.hibernate.hql.internal.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:394) org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3769) org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3555) org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3433) org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:708) org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:564) org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301) org.hibernate.hql.internal.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:249) org.hibernate.hql.internal.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:250) org.hibernate.hql.internal.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185) org.hibernate.hql.internal.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:138) org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:104) org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:79) org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:168) org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:222) org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:200) org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1703) org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:291) com.agostino.CrudJpa.selezione(CrudJpa.java:27) com.agostino.Gioia.doGet(Gioia.java:43) javax.servlet.http.HttpServlet.service(HttpServlet.java:620) javax.servlet.http.HttpServlet.service(HttpServlet.java:727) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) My classes are: @Entity public class Persona { @Id private int id; private String n…
has comment: http://stackoverflow.com/comment/43340836
type: Question
has comment: http://stackoverflow.com/comment/43344244
score: 0
tagged with: jpa
tagged with: jpql
has comment: http://stackoverflow.com/comment/43308136
answer count: 0
has title: Hibernate JPA Join Query jpql Issue
type: UnansweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/a/27454296
has body: Safer is a meaningless term used over and over. What all those books mean is that in terms of scalability on a big project, a private attribute should be considered as an entity univocally tied to a class so its value shall never be modified by other object in order to not alter its purpouse of existance (it's functionality). It's more a design matter than an implementation matter. Think of an object which methods will return correct results only if their attributes are only modified by its very determinated methods: it couldn't guarantee that its method will return the expected result if an attribute is modified with a random value. Furthermore, If you are coding an API library, the private elements won't be exposed in your binaries, making it more difficult to crack from a malicious user trying to instantiate objects not meant to be instantiated by the users.
has comment: http://stackoverflow.com/comment/43346771
downvote count: 1
score: -1
has comment: http://stackoverflow.com/comment/43346854
upvote count: 0
answers question: http://stackoverflow.com/q/27454218
has comment: http://stackoverflow.com/comment/43346708
type: Answer

http://stackoverflow.com/q/27395159
tagged with: file
type: Question
has title: how to write tags,meta data to a file with android java(when we right click on windows>properties)
has body: I want to add a comment to a file(video,txt,etc...). right click on a file on windows the comment should appear. File tempf= new File (Environment.getExternalStorageDirectory().getAbsolutePath()+"/picedittemp"); tempf.setcommentOrTittle("mycomment to file");
score: 0
has comment: http://stackoverflow.com/comment/43236888
answer count: 1
has answer: http://stackoverflow.com/a/27398446
type: UnansweredQuestion
tagged with: android
tagged with: java

http://stackoverflow.com/comment/43318133
type: AnswerComment
type: Comment
has text: Thank you for your answer, but i can't add the field price on the entity Item. It is there another way of creating the criteria?
comment on: http://stackoverflow.com/a/27392838
score: 0

http://stackoverflow.com/comment/43369759
comment on: http://stackoverflow.com/q/27466970
score: 0
type: QuestionComment
type: Comment
has text: Your for loop adds `jamesTotalQuarter` based on the elements in the `lebronJamesAttributes` array. Such that you could skip over `60`, leading to an infinite loop. For example if I'm at `jamesTotalQuarter = 55` and the next item in `lebronJamesAttributes` is `10`. You get `65`. And since your adding numbers it will always not be `60`.

http://stackoverflow.com/comment/45213787
comment on: http://stackoverflow.com/a/27370525
has text: I think it is necessary if you have JDK 8. Also @ss1271 has it right, if you want to change or create an environment variable you should but it in your .bash_profile. BTW You may need to run source .bash_profile the first time around (if you don't want to reboot).
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27331887
upvote count: 2
has body: Here you are printing an object. System.out.println(rgbImg0); But you have not defined what you want to happen when you print a RGBImage object. When you pass an object reference to a print statement, the objects toString(); method is called and the result is printed out. By default Object subclasses print out a reference, something like RGBImage@47520d which is ClassName + @ + Hashcode. You can override the toString() method of RGBColor to print what you need. @Override public String toString() { return "("+_red+","+_green+","+_blue+")"; } Then you can override the toString() method of RGBImage class to print your array of RBGColor objects. public String toString() { // If your not too bothered about formatting, you can do it in a single line. // return Arrays.deepToString(_pixels); String pixelSet=""; for(int i=0; i&lt;_pixels.length;i++){ for(int j=0 ;j&lt;_pixels[i].length;j++){ pixelSet+=this._pixels[i][j].toString(); } pixelSet +="\n"; } return pixelSet; } I hope this helps.
has comment: http://stackoverflow.com/comment/43121977
has comment: http://stackoverflow.com/comment/43121682
answers question: http://stackoverflow.com/q/27331805
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27331805
type: Answer
has comment: http://stackoverflow.com/comment/43121865
has comment: http://stackoverflow.com/comment/43122021
score: 2

http://stackoverflow.com/comment/43289386
has text: How are you deploying? I think you can specify the `.dylib` in a [tag:java-web-start] .jnlp` file, and I'm sure you can load it from an application bundle.
comment on: http://stackoverflow.com/q/27372524
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/56543219
type: AnswerComment
has text: Ok, I have hardcoded the service port, but ENV only shows internal IP's on Docker Swarm. My javascript on a PHP container front-end page cannot use that internal IP, so Consul, Etcd seem useless. Can I pass public IP?
comment on: http://stackoverflow.com/a/27408999
score: 0
type: Comment

http://stackoverflow.com/q/27440408
type: Question
has answer: http://stackoverflow.com/a/27440666
tagged with: client-server
has body: I tried to create a Chat application , but faced two problems, the first when sending the emoticon it is appear as follows And This is my code (sending emoticon) private void sendEmotion(ImageIcon emoticon, URL url) { try { Image image = emotion.getImage(); listModel.addElement(emoticon); jList2.setModel(listModel); BufferedImage img = ImageIO.read(new File(url.toURI())); ImageIO.write(img, "png", s.getOutputStream()); } catch (Exception ex) { Logger.getLogger(Client.class.getName()).log(Level.SEVERE, null, ex); } } reading text and emoticon br = new BufferedReader(new InputStreamReader(socket.getInputStream())); while (true) { // To read text String st = br.readLine(); listModel.addElement(st); jList1.setModel(listModel); //to read imge BufferedImage image = ImageIO.read(socket.getInputStream()); ImageIO.write(image, "png", new File("e:/image.png")); listModel.addElement(image); jList1.setModel(listModel); } } catch (IOException ex) { Logger.getLogger(MainServer.class.getName()).log(Level.SEVERE, null, ex); } The second problem , when sending text and image from server to client, The client can't read both (text or image not both)
has answer: http://stackoverflow.com/a/27440594
tagged with: java-io
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27480271
has title: Simple java chat app reading image
type: UnansweredQuestion
tagged with: javax.imageio
tagged with: java
has comment: http://stackoverflow.com/comment/43394029

http://stackoverflow.com/comment/43231335
score: 0
type: Comment
has text: @SotiriosDelimanolis Yes, readability (always high on the design radar, and I believe in "less code is good") *and* performance - it hands more over to the JDK (which we tend to trust is "well written").
type: AnswerComment
comment on: http://stackoverflow.com/a/27391086

http://stackoverflow.com/q/27341696
has answer: http://stackoverflow.com/a/27341754
tagged with: java
type: Question
upvote count: 2
answer count: 1
has title: CopyOnWriteArrayList implementation concern
has body: According to javadoc of CopyOnWritearrayList: A thread-safe variant of ArrayList in which all mutative operations (add, set, and so on) are implemented by making a fresh copy of the underlying array but I want to know why its making the fresh copy each time as it is doing this operation in the exclusive lock.
downvote count: 0
has comment: http://stackoverflow.com/comment/43139194
favorite count: 0
score: 2
has comment: http://stackoverflow.com/comment/43139199
has comment: http://stackoverflow.com/comment/43139162
type: UnansweredQuestion
tagged with: collections

http://stackoverflow.com/comment/43247744
score: 0
type: Comment
type: QuestionComment
has text: they are both integers, what difference does it make?
comment on: http://stackoverflow.com/q/27401432

http://stackoverflow.com/q/27404683
has comment: http://stackoverflow.com/comment/43254086
has comment: http://stackoverflow.com/comment/43254089
has title: Main method not found in class ActivityTime, please define the main method as: public static void main(String[] args)
has comment: http://stackoverflow.com/comment/43254146
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43255331
tagged with: java
has comment: http://stackoverflow.com/comment/43254512
has answer: http://stackoverflow.com/a/27404850
has body: I tested my program on http://www.hackerearth.com/problem/algorithm/roys-life-cycle/ . However, I always got Error: Main method not found in class ActivityTime, please define the main method as:public static void main(String[] args) This is my program import java.util.Scanner; /** * Created by DUY on 10/12/2014. */ class EatSleepCode { public static void main(String[] args){ int numberDay = 0; int numberMinuteOfDay = 18; Scanner input = new Scanner(System.in); numberDay = input.nextInt(); input.nextLine(); String[] str = new String[numberMinuteOfDay]; for(int i = 0; i &lt; numberDay; i++){ str[i] = input.nextLine(); } ActivityTime code = new ActivityTime(numberDay,str,'C'); code.findLongestTime(); } } class ActivityTime{ public int longestTimeOfDay; public int longestTimeOfTotal; public int numberDay; public String[] str; public char act; public ActivityTime(int numberDay, String[] str, char act){ this.numberDay = numberDay; this.str = str; this.act = act; } public void findLongestTime(){ int tmp1 = 0, tmp2 = 0; for(int i = 0; i &lt; numberDay; i++){ tmp1 = 0; for(int j = 0; j &lt; str.length; j++){ if(str[i].charAt(j) != act){ tmp1 = 0; tmp2 = 0; } else { tmp1 ++; tmp2 ++; } if(tmp1 &gt; longestTimeOfDay){ longestTimeOfDay = tmp1; } if(tmp2 &gt; longestTimeOfTotal){ longestTimeOfTotal = tmp2; } } } System.out.println(longestTimeOfDay + " " + longestTimeOfTotal ); } } Can you help me solve this error? Thank you very much
type: Question
has comment: http://stackoverflow.com/comment/43254418
accepted answer: http://stackoverflow.com/a/27404850
score: 0
answer count: 1

http://stackoverflow.com/q/27360989
has answer: http://stackoverflow.com/a/27363252
accepted answer: http://stackoverflow.com/a/27678144
tagged with: azure-table-storage
type: AnsweredQuestion
score: 0
tagged with: java
possible better answer: http://stackoverflow.com/a/27363252
type: Question
has answer: http://stackoverflow.com/a/27678144
answer count: 2
tagged with: azure
has body: I've created an Entity class that extends TableServiceEntity. My class has a single field called "value" of type Byte: public class TestEntity extends TableServiceEntity{ public Byte value; public TestEntity(){ super("some_partition","somekey"); } public Byte getValue() { return value; } public void setValue(Byte value) { this.value = value; } } According to the documentation for TableServiceEntity, Byte is one of the supported field types. However when I try to store my entity, I get the following exception: java.lang.IllegalArgumentException: Type class java.lang.Byte is not supported. at com.microsoft.azure.storage.table.EntityProperty.&lt;init&gt;(EntityProperty.java:175) at com.microsoft.azure.storage.table.PropertyPair.generateEntityProperty(PropertyPair.java:271) at com.microsoft.azure.storage.table.TableServiceEntity.writeEntityWithReflection(TableServiceEntity.java:217) at com.microsoft.azure.storage.table.TableServiceEntity.writeEntity(TableServiceEntity.java:470) at com.microsoft.azure.storage.table.TableEntitySerializer.writeJsonEntity(TableEntitySerializer.java:317) at com.microsoft.azure.storage.table.TableEntitySerializer.writeSingleJsonEntity(TableEntitySerializer.java:411) at com.microsoft.azure.storage.table.TableEntitySerializer.writeSingleEntityToStream(TableEntitySerializer.java:74) at com.microsoft.azure.storage.table.TableOperation.insertImpl(TableOperation.java:389) at com.microsoft.azure.storage.table.TableOperation.performInsert(TableOperation.java:370) ... The fault seems to be with the EntityProperty constructor (see source), which doesn't seem to support Byte or byte types, only Byte[] and byte[]: protected EntityProperty(final String value, final Class&lt;?&gt; type) { this.type = type; this.value = value; if (type.equals(byte[].class)) { this.getValueAsByteArray(); this.edmType = EdmType.BINARY; } else if (type.equals(Byte[].class)) { this.getValueAsByteObjectArray(); this.edmType = EdmType.BINARY; } ... Am I doing something wrong, or …
has title: Cannot create a byte field in an Azure Table entity

http://stackoverflow.com/a/27326284
score: 0
has comment: http://stackoverflow.com/comment/43111625
type: Answer
has body: your spot is being drawn behind all the other panels. if you add setComponentZOrder(spot, 0); this will cause it to be drawn on top of everything else. A better way to approach this would be to draw the x inside of the panels that you have instead of on top of them. EDIT: you can add your x to a specific panel with panel[0].add(spot);
has comment: http://stackoverflow.com/comment/43111736
answers question: http://stackoverflow.com/q/27326190

soa
type: Tag
tags question: http://stackoverflow.com/q/27372551
tag name: soa

http://stackoverflow.com/a/27391614
answers question: http://stackoverflow.com/q/27391467
has body: Use an HTML parser for Java such as HTMLParser or use regular expressions to pull out the title from the malformed HTML string, maybe something like this (.*?)
score: 0
type: Answer

http://stackoverflow.com/comment/43334179
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27447011
has text: yeah, That what I was intend to do, but code stuck there.
type: Comment

http://stackoverflow.com/q/27322707
has answer: http://stackoverflow.com/a/47645940
type: Question
downvote count: 4
score: 2
has comment: http://stackoverflow.com/comment/138271056
tagged with: string
has answer: http://stackoverflow.com/a/27322858
has title: Print character multiple times
has comment: http://stackoverflow.com/comment/43105284
has answer: http://stackoverflow.com/a/27322819
has comment: http://stackoverflow.com/comment/43104949
linked to: http://stackoverflow.com/q/9408210
has answer: http://stackoverflow.com/a/27322785
linked to: http://stackoverflow.com/q/1235179
upvote count: 6
favorite count: 0
tagged with: character
possible better answer: http://stackoverflow.com/a/27322821
answer count: 5
duplicate of: http://stackoverflow.com/q/1235179
has comment: http://stackoverflow.com/comment/43104687
has answer: http://stackoverflow.com/a/27322821
accepted answer: http://stackoverflow.com/a/27322819
has comment: http://stackoverflow.com/comment/43104606
type: AnsweredQuestion
has body: How can I print a character multiple times in a single line? This means I cannot use a loop. I'm trying to print " _" multiple times. I tried this method but it's not working: System.out.println (" _" , s); s is the variable.
tagged with: java

http://stackoverflow.com/q/27357428
has answer: http://stackoverflow.com/a/27357795
type: Question
has comment: http://stackoverflow.com/comment/43167272
has title: How to read csv file by each row and column wise in java without using external jars
has body: Can someone tell me how can i read csv file by each row and column wise in java without using external jars. I have tried the below code but here i am able to read only one column at a time. public class ParseCSVs{ public static void main(String[] args) throws Exception { File file = new File("./input//SIMNumbers.csv"); List&lt;String&gt; lines = Files.readAllLines(file.toPath(),StandardCharsets.UTF_8); for (String line : lines) { String[] array = line.split(","); System.out.println(array[2]); } }} Thanks in advance.
upvote count: 2
answer count: 2
accepted answer: http://stackoverflow.com/a/27358372
tagged with: java
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43167742
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/27357795
has answer: http://stackoverflow.com/a/27358372

http://stackoverflow.com/comment/43273033
type: Comment
type: QuestionComment
has text: "image == null" because ImageIO.read(file1) return null,I said "imageio can't parse .webp",maybe there is problem in complie webp-imageio.jar and libwebp-imageio.dll
score: 0
comment on: http://stackoverflow.com/q/27414282

http://stackoverflow.com/q/27315513
has body: I have a mandatory EditText that has a placeholder with mandatory symbol * that has to be red. Help with this guys.
linked to: http://stackoverflow.com/q/6456588
answer count: 2
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27315560
has comment: http://stackoverflow.com/comment/43090999
tagged with: android
has comment: http://stackoverflow.com/comment/43091055
has comment: http://stackoverflow.com/comment/43090946
type: AnsweredQuestion
score: 1
has title: Set color to part of EditText placeholder
upvote count: 1
accepted answer: http://stackoverflow.com/a/27315560
type: Question
possible better answer: http://stackoverflow.com/a/27315622
tagged with: java
has comment: http://stackoverflow.com/comment/43090853
has answer: http://stackoverflow.com/a/27315622

http://stackoverflow.com/q/27405556
score: 1
has comment: http://stackoverflow.com/comment/43280635
tagged with: java
tagged with: hadoop
upvote count: 1
downvote count: 0
has body: I'm trying to run the MapRedure MaxTemperaute App and I'm getting this error: "ERROR security.UserGroupInformation: PriviledgedActionException as:yosr cause:java.io.IOException: Failed to set permissions of path: \tmp\hadoop-yosr\mapred\staging\yosr1581500197\.staging to 0700 Exception in thread "main" java.io.IOException: Failed to set permissions of path: \tmp\hadoop-yosr\mapred\staging\yosr1581500197\.staging to 0700" I'm running it on eclipse on windows and the hadoop configuration is on a VM centOS How can I resolve this
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43258250
answer count: 0
type: Question
has title: security.UserGroupInformation: PriviledgedActionException

http://stackoverflow.com/comment/43110641
has text: That is definitely a smarter way to handle the ugly if-statements I had. Thanks! The performance didn't improve significantly, but I guess there's really no way around this computational cost.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27325033
type: Comment

http://stackoverflow.com/q/27473519
accepted answer: http://stackoverflow.com/a/27473527
score: 3
tagged with: java
answer count: 2
downvote count: 0
tagged with: unchecked-exception
favorite count: 0
tagged with: exception
has answer: http://stackoverflow.com/a/27473527
has answer: http://stackoverflow.com/a/27473564
tagged with: checked-exceptions
has title: How to convert / wrap Unchecked Exceptions into Checked Exceptions in Java?
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27473564
upvote count: 3
type: Question
has body: Can Unchecked Exceptions be converted into Checked Exceptions in Java? If yes, please suggest ways to convert/wrap an Unchecked Exception into a Checked Exception.

permissions
tag name: permissions
type: Tag
tags question: http://stackoverflow.com/q/27380855
tags question: http://stackoverflow.com/q/27411876

http://stackoverflow.com/a/27422311
accepted answer of: http://stackoverflow.com/q/27420650
has body: Cloudhub properties are set using System Properties, thats why you can access them via System.getProperty(). mule-app.properties is special as this properties file automatically gets loaded into the Mule registry so you could access it via the Mule Context. But it would be better to inject them into you Java class from your Mule config: &lt;bean class="YourJavaClass"&gt; &lt;property name="myVar" value="${the.key}"&gt; &lt;/bean&gt; public class YourJavaClass{ String myVar ... }
has comment: http://stackoverflow.com/comment/43290572
answers question: http://stackoverflow.com/q/27420650
has comment: http://stackoverflow.com/comment/43297388
upvote count: 4
type: AcceptedAnswer
downvote count: 0
score: 4
type: Answer

http://stackoverflow.com/comment/43253886
has text: What's wrong with the `valueOf` built in to every enum?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27404513
score: 2

http://stackoverflow.com/q/27409887
type: Question
tagged with: resources
has comment: http://stackoverflow.com/comment/44213681
has answer: http://stackoverflow.com/a/28475985
has title: Reasons for "no more handles"
has comment: http://stackoverflow.com/comment/44256690
upvote count: 2
linked to: http://stackoverflow.com/q/2018553
has comment: http://stackoverflow.com/comment/44205735
answer count: 1
has comment: http://stackoverflow.com/comment/43284634
has comment: http://stackoverflow.com/comment/43264261
favorite count: 0
type: UnansweredQuestion
has body: For our SWT-based application we've got certain different SWT crash reports where SWT crashes with "no more handles" errors. This only happens for very few people and sometimes in a very early stage of launching the application. A typical stacktrace of the very early application state looks like this: Caused by: org.eclipse.swt.SWTError: No more handles at org.eclipse.swt.SWT.error(SWT.java:4467) at org.eclipse.swt.SWT.error(SWT.java:4356) at org.eclipse.swt.SWT.error(SWT.java:4327) at org.eclipse.swt.widgets.Widget.error(Widget.java:476) at org.eclipse.swt.widgets.TaskBar.createHandle(TaskBar.java:103) at org.eclipse.swt.widgets.TaskBar.&lt;init&gt;(TaskBar.java:96) at org.eclipse.swt.widgets.Display.getSystemTaskBar(Display.java:2567) ... We already have tested our application and under normal conditions it does not leak any resources (fonts, colors, images, GCs, ...), the values in the Windows Task Manager (Handles, USER Objects, GDI Objects, ...) are only in the top third, but often not the top most ones. What reasons could cause such problems - could it be a machine with a lot of applications running, other possibly debugged applications leak massive resources, what else? What information, e.g. output of "tasklist.exe" I need to request from the users to get a clue for a possible reason?
tagged with: swt
has comment: http://stackoverflow.com/comment/43264363
has comment: http://stackoverflow.com/comment/43264237
score: 2
has comment: http://stackoverflow.com/comment/44098362
downvote count: 0
tagged with: java
tagged with: handle

http://stackoverflow.com/comment/43262397
type: Comment
score: 0
has text: I'm using a mouse joint to move the box2d bodies, will It work with it? Also do you have any examples? Thanks for the response:).
type: AnswerComment
comment on: http://stackoverflow.com/a/27400600

http://stackoverflow.com/q/27377844
favorite count: 0
has title: NullPointerExpection after second submit multipart/conf - Tomcat
type: UnansweredQuestion
tagged with: http-redirect
tagged with: form-submit
tagged with: java
has answer: http://stackoverflow.com/a/27378022
downvote count: 1
has body: I´m facing a strange behaviour on my development system. After a succesfull FileUpload trough a form multi/part submit, I forward to another Servlet to handle the database insert and from there I redirect to the source page where the file upload got initiated. If the user now tries to upload another File trough multi/part submit, Tomcat throws a NullPointerException when i try to read the Parameters from the request in the first Servlet. At first i analyzed the POST from the Client to the server, just to find out that they looked exactly the same. The obscure thing is, if I reload the page with F5 several times im able to upload another File without problems. Because of this i tried, as a fast fix, to append a random number to the URL and use JAVASCRIPT to force a hard reload once (location.reload(true) but this did not fix the problem at all. My settings are: Tomcat 7.0.55 mySql Database (latest release) Java 1.8.0_20 Eclipse Juno Programing Code documents.jsp Dokumententyp Kommentar Dokument CreateAgentCustomerContractAdditional int contract_id = Integer.parseInt(request.getParameter("contract_id_select")); String comment = request.getParameter("add_comment"); String doc_type = request.getParameter("doc_type"); .... .... getServletContext().getRequestDispatcher("//InsertContractAdditional").forward(request, response); InsertContractAdditional response.sendRedirect( context_pathprefix + context/documents.jsp?#"+ran.nextDouble()); Javascript I hope someone is able to give me an hint! With kind regards! P.S.: StackTrace HTTP Status 500 - nulltype Exception report message null description The server encountered an internal error that prevented it from fulfilling this request. exception java.lang.NumberFormatException: null java.lang.Integer.parseInt(Unknown Source) java.lang.Integer.parseInt(Unknown Source) servlet.CreateAgentCustomerContractAdditional.doPost(CreateAgentCustomerContractAdditional.java:62) javax.servlet.http.HttpServlet.service(HttpServlet.java:646) ja…
type: Question
has answer: http://stackoverflow.com/a/27377968
upvote count: 0
score: -1
tagged with: tomcat
has answer: http://stackoverflow.com/a/27378024
answer count: 3
has comment: http://stackoverflow.com/comment/43205202

http://stackoverflow.com/q/27335149
tagged with: java
has comment: http://stackoverflow.com/comment/43129077
tagged with: eclipse
type: Question
has body: I have tried a few different ways of doing this but all have failed. Currently I have a frame with an image set in it using a class called backViewer that extends JPanel. I would like to take that frame and place a JComponent over it that I can then move. The background image will appear but the JComponent, SchellTower, will not appear over top of it. package Graphical; import java.awt.Component; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.LayoutManager; import javax.swing.ImageIcon; import javax.swing.JPanel; import javax.accessibility.*; import javax.imageio.ImageIO; import java.awt.*; import java.awt.event.*; import java.io.File; import java.io.IOException; import javax.swing.*; public class TowerViewer extends JFrame { public TowerViewer() { //backViewer /*public class backViewer extends JPanel { @Override protected void paintComponent(Graphics g){ super.paintComponents(g); Image image = new ImageIcon("filename").getImage(); g.drawImage(image,0,0,500,690,null); }*/ setSize(500, 688); backViewer back = new backViewer(); add(back); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setTitle("Schell Tower"); } public static void main(String args[]) { TowerViewer t = new TowerViewer(); SchellTower comp = new SchellTower(); t.add(comp); t.setVisible(true); //moving the component this works on its own and seems to be running in the back ground //but the SchellTower component isnt visible int x = 0; while (true) { for (int i = 0; i &lt;= 10; i++) { comp.move(0, x); t.add(comp); x += 60; try { Thread.sleep(1000); //1000 milliseconds is one second. } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } } try { Thread.sleep(3000); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } x -= 60; for (int j = 0; j &lt;= 9; j++) { comp.move(0, x); t.add(comp); x -= 60; try { Thread.sleep(1000); //1000 milliseconds is one second. } catch (InterruptedException ex) { Thread.curr…
has comment: http://stackoverflow.com/comment/43131555
has answer: http://stackoverflow.com/a/27337575
has comment: http://stackoverflow.com/comment/43128297
has title: I have a frame with an image in it and i am trying to add a JComponent over it
score: 0
has comment: http://stackoverflow.com/comment/43128696
has comment: http://stackoverflow.com/comment/43127378
answer count: 1
has comment: http://stackoverflow.com/comment/43131530
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43127939

http://stackoverflow.com/comment/43180869
type: QuestionComment
has text: @DrewKennedy Thank you for the hint. That way sounded wrong to me as well.
comment on: http://stackoverflow.com/q/27364351
score: 0
type: Comment

http://stackoverflow.com/comment/43368296
comment on: http://stackoverflow.com/q/27466095
has text: Could you just put a comment next to the important line numbers (there are multiple lines `line = f.nextLine();`). Also please post a sample of the text file.
score: 0
type: Comment
type: QuestionComment

functional-testing
tags question: http://stackoverflow.com/q/27324654
tag name: functional-testing
type: Tag

http://stackoverflow.com/a/44564485
score: 0
has comment: http://stackoverflow.com/comment/76118099
answers question: http://stackoverflow.com/q/27332003
type: Answer
has body: You can use lanuch4j that compile jar file to exe. add filename.manifest to basic/warpper manifest: it will work well as administrator on windows. I have tested on my javafx program. <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <requestedExecutionLevel level="highestAvailable" uiAccess="False" />

http://stackoverflow.com/q/27423353
has title: validation on JSP page does not work
has comment: http://stackoverflow.com/comment/43291106
tagged with: validation
accepted answer: http://stackoverflow.com/a/27503635
tagged with: jsp
tagged with: javascript
has comment: http://stackoverflow.com/comment/43288834
has comment: http://stackoverflow.com/comment/43289407
has comment: http://stackoverflow.com/comment/43289868
has comment: http://stackoverflow.com/comment/43289602
has comment: http://stackoverflow.com/comment/43290303
has comment: http://stackoverflow.com/comment/43437309
possible better answer: http://stackoverflow.com/a/27424751
has comment: http://stackoverflow.com/comment/43290007
has comment: http://stackoverflow.com/comment/43290227
has comment: http://stackoverflow.com/comment/43293070
has answer: http://stackoverflow.com/a/27424751
has comment: http://stackoverflow.com/comment/43290823
has comment: http://stackoverflow.com/comment/43290651
has answer: http://stackoverflow.com/a/27503635
has comment: http://stackoverflow.com/comment/43290323
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43289940
has comment: http://stackoverflow.com/comment/43289324
tagged with: java
tagged with: servlets
type: Question
score: 0
has body: I have the following jsp page with one input textbox, upon entering the number, the page is redirected to a servlet where I retrieve that number and let's say display it on a page. I'm trying to do the validation in JavaScript but in spite of it, it's still executing the servlet even though validation returns false and I get java.lang.NumberFormatException: For input string: "" in the doGet method on the servlet on the following line: int max = Integer.parseInt(request.getParameter("lengthTxt"));. Why does it seem to bypass validation and still execute the servlet ? How to fix it ? thanks for help ! <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> Length calc enter length
answer count: 2

http://stackoverflow.com/q/27316021
has title: File class cannot access file using absolute path
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27316198
answer count: 2
has body: I am trying to access a file using the file class but it works only with below code File file = new File("s:\\testing\\selenium\\Version8\\locators\\OR.properties"); however I need to use this approach where I go directly to the server: "\\GIGABYTE\\s-drive\\Testing\\selenium\\Version8\\locators\OR.properties"in which the above will not find the file - very strange Any clue as to why this is?
has comment: http://stackoverflow.com/comment/43091937
has answer: http://stackoverflow.com/a/27316130
type: UnansweredQuestion

http://stackoverflow.com/q/27400396
accepted answer: http://stackoverflow.com/a/27402619
has body: My problem is related to localization, I have JPA entities having fields like fieldnameEN,fieldnameFR,fieldnameRU. I want to write some getter method which automatically detects current locale and returns appropriate field. I'm using facelets and such getter will help me to call getter and delegate localization issues to backend. Locale already stored in session and getting it is not a problem. I know how do such method manually, something like getProperty(){ locale = takeFromSession(); if(locale=en) return getPropertyEN(); if(locale=fr) return getPropertyFR(); } But I want to keep DRY principle with the help of AspectJ or some interceptor. Current thoughts on implementation - in each getter call determine running method name, pass Object state to some interceptor and in interceptor perform locale checks and return appropriate value of field which is already passed to interceptor. Is there any working example of solving such problem? How pass object state to interceptor? Are there any better approaches to solve my problem? UPDATE Kriegaex recommended to use bundles. Actually, we use bundles for markup (headers and captions) but we also need to localize entities stored in database. Bundles require usage of 'hash tags' as keys in .property files, but I don't want to store entity values as hash tags. Bundles will force users to fill business values as 'hash tags' and I wouldn't like that) Even if use english values as key or some hash from values we need to make 100 queries if entity has 100 properties. And yes, I mean 100 DB queries, because AFAIK bundle stored in RAM which may be insufficient to store translations that's why in our case bundles should be in key-value DB. About recompilation - most probably we will have only 3 languages and don't need scale in such direction. If somebody know answer to my topic question, please share some little example)
possible better answer: http://stackoverflow.com/a/27403157
linked to: http://stackoverflow.com/q/442747
has title: How pass class name, running method name and object fields to AspectJ or other interceptor?
type: AnsweredQuestion
tagged with: facelets
tagged with: java
tagged with: localization
type: Question
tagged with: aspectj
tagged with: jpa
has answer: http://stackoverflow.com/a/27402619
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27403157

http://stackoverflow.com/comment/43231362
score: 0
type: Comment
has text: @EJP sounds like your comment is the actual answer. Also IIRC PrintWriter takes a File as output stream, you probably need another variable for fh = new File("../note.txt"); before new PrintWriter(fh)
comment on: http://stackoverflow.com/a/27391830
type: AnswerComment

http://stackoverflow.com/a/27368442
downvote count: 1
score: 0
has comment: http://stackoverflow.com/comment/43189024
answers question: http://stackoverflow.com/q/27368410
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43189686
has body: Enumeration&lt;SomeClass&gt; en = someFunctionToRetrieveEnumeration(); if(en.hasMoreElements()){ do{ String name = en.nextElement().getName(); System.out.println(name); }while(en.hasMoreElements()); } Upd: Seems like function return enumeration with used iterator. Enumeration is an interface. For getting first element you need to know real type of Enumeration and check - if it is possible to iterate it once again(retrieve new iterator)
type: Answer
has comment: http://stackoverflow.com/comment/43189848
has comment: http://stackoverflow.com/comment/43189229
accepted answer of: http://stackoverflow.com/q/27368410
upvote count: 1

http://stackoverflow.com/q/27420340
has comment: http://stackoverflow.com/comment/43297546
has title: @RetryTransaction: how to make it work when deadlock was found
favorite count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: spring
type: Question
tagged with: transactions
tagged with: java
has body: Concurent Transaction make my Sql statements fail. I'm trying to use [this] dellroad-stuff1. But it seems to be ignored. I m working with spring 3 and hibernate 4. The error : 15:32:11,331 WARN SqlExceptionHelper:145 - SQL Error: 1213, SQLState: 40001 15:32:11,331 ERROR SqlExceptionHelper:147 - Deadlock found when trying to get lock; try restarting transaction 15:32:11,334 INFO AbstractBatchImpl:195 - HHH000010: On release of batch it still contained JDBC statements The annoted Function to retry transaction if failed : @Override @RetryTransaction @Transactional public void save(AnalyseResult analyseResult) { final int attempt = RetryTransactionAspect.aspectOf().getAttemptNumber(); System.out.println("#############"); System.out.println("Retry Transact : "+attempt); System.out.println("#############"); analyseResultDao.save(analyseResult); } The Beans.xml <aop:aspectj-autoproxy proxy-target-class="true" />
tagged with: aspectj
score: 5
has comment: http://stackoverflow.com/comment/65728250
answer count: 1
has answer: http://stackoverflow.com/a/45725751
upvote count: 5

http://stackoverflow.com/a/27408187
has comment: http://stackoverflow.com/comment/43299704
type: Answer
accepted answer of: http://stackoverflow.com/q/27407732
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27407732
upvote count: 2
type: AcceptedAnswer
has body: As per MSDN in regard the 3rd parameter of SetWindowsHookEx (counting from 1) which in your case is NULL A handle to the DLL containing the hook procedure pointed to by the lpfn parameter. The hMod parameter must be set to NULL if the dwThreadId parameter specifies a thread created by the current process and if the hook procedure is within the code associated with the current process. In your case, your hooking setup process (the java one) didn't created the application/process associated w/ the 'test' window, hence you can't pass NULL to this parameter, so you must provide a handle to some DLL containing the hook procedure callback :( this means you should implement this callback logic in a native DLL, load it (thru JNA usage of LoadLibrary) and pass the returned handle to SetWindowsHookEx

http://stackoverflow.com/comment/43301756
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27430293
type: Comment
has text: Wouldn't that give a "method prinln(String) in undefined for the type PrintStream" error? Usually "cannot find symbol" errors are caused by an undeclared variable.

http://stackoverflow.com/a/27368122
type: Answer
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/43188418
answers question: http://stackoverflow.com/q/27367989
has comment: http://stackoverflow.com/comment/43188248
has body: In Grow(), try changing int newIndex = sizeSnake + 1; to int newIndex = sizeSnake;. Since your for loops all go until i &lt; sizeSnake, that means the last JButton is actually the one at snakeButton[sizeSnake - 1], not the one at snakeButton[sizeSnake].
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27367989

http://stackoverflow.com/a/27430293
has comment: http://stackoverflow.com/comment/43301808
type: AcceptedAnswer
downvote count: 0
has body: It is System.out.println(..) You wrote System.out.prinln(..), where the compiler does not find the method prinln
type: Answer
accepted answer of: http://stackoverflow.com/q/27430264
has comment: http://stackoverflow.com/comment/43301756
answers question: http://stackoverflow.com/q/27430264
score: 4
upvote count: 4

http://stackoverflow.com/comment/43151783
comment on: http://stackoverflow.com/a/27348380
score: 0
type: AnswerComment
type: Comment
has text: Added regex101 url, you can check your cases one by one.

http://stackoverflow.com/comment/43200539
comment on: http://stackoverflow.com/q/27372898
type: QuestionComment
type: Comment
score: 2
has text: https://github.com/FasterXML/jackson-dataformat-xml/issues/32

http://stackoverflow.com/comment/43231610
type: QuestionComment
has text: @KickButtowski I saw that one and it didn't seem to have solutions I was looking for. It was saying make the method static and mine already was so I determined it was a different problem.
score: 0
comment on: http://stackoverflow.com/q/27392006
type: Comment

http://stackoverflow.com/q/27364143
has comment: http://stackoverflow.com/comment/43180170
has comment: http://stackoverflow.com/comment/43180167
has comment: http://stackoverflow.com/comment/43180315
type: AnsweredQuestion
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/28479898
has comment: http://stackoverflow.com/comment/43180410
has title: generate secure random bits
score: 0
tagged with: random
has body: public static void main(String[] args) { Random ranGen = new SecureRandom(); ranGen.setSeed(0); int randomNumber = ranGen.nextInt(2); System.out.print(randomNumber); } Is the above code a good way to either produce a truly random and secure/unbiased 0 or 1 ?
has comment: http://stackoverflow.com/comment/43180141
answer count: 1
accepted answer: http://stackoverflow.com/a/28479898
has comment: http://stackoverflow.com/comment/43180261
has comment: http://stackoverflow.com/comment/43180238
tagged with: cryptography

http://stackoverflow.com/comment/43205719
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27377894
has text: I want to export all my tables and data from db2 to Oracle by using java. for example every time i run my javaCode all tables and data insert to oracle from db2. and this could happen many times in a day. I need java class that the first method must select a table and get those values and copy them into a vector, and the second method take an argument; the vector and take those values and insert them in the second database 'oracle'. could you please help me for writing this methods.
type: AnswerComment

http://stackoverflow.com/comment/43280975
type: AnswerComment
has text: `setLayout(new BorderLayout()); }` should be `setLayout(new BorderLayout()); init(); }`. That's what `Called from constructor` means!
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27418732

http://stackoverflow.com/q/27338693
has comment: http://stackoverflow.com/comment/55038365
has body: I am interested in using valdr Bean Validation for my Spring 4 REST project, but it seems like valdr Bean Validation is only available with CLI and as Servlets. I tried integrating it with my Spring project but it doesn't seem to work. I have been stuck on this for a while. Could anyone please help me out with any examples of valdr Bean Validation integration with Spring? Is there a specific configuration needed to integrate it? Any help is appreciated! Thank You!
has comment: http://stackoverflow.com/comment/43150407
score: 0
tagged with: rest
has comment: http://stackoverflow.com/comment/43517937
has comment: http://stackoverflow.com/comment/43497307
answer count: 1
has answer: http://stackoverflow.com/a/27360150
type: UnansweredQuestion
tagged with: spring
has comment: http://stackoverflow.com/comment/43500528
tagged with: java
has title: Valdr integration with Spring
type: Question
tagged with: valdr-bean-validation
has comment: http://stackoverflow.com/comment/43500450

http://stackoverflow.com/q/27358192
has comment: http://stackoverflow.com/comment/43168681
answer count: 1
has comment: http://stackoverflow.com/comment/43168597
has comment: http://stackoverflow.com/comment/43168783
type: UnansweredQuestion
tagged with: android
has title: Android app name shows as "loading"
has answer: http://stackoverflow.com/a/27358387
tagged with: java
type: Question
has body: Hi I am working with android . I had created an app in which I used volley jar for loading json contents using the link http://www.androidhive.info/2014/05/android-working-with-volley-library-1/ . Here I am used a AppController class which extends Application.MY problem is that when I run the app in device it works fine but shows app label as "Loading". I dont know why this happens .I changed label and icon in manifest and so Icon will changes but app name still the same. Here is my manifest. <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="17" /> <uses-permission android:name="android.permission.INTERNET" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> here is my string.xml <?xml version="1.0" encoding="utf-8"?> Testapp Settings Hello world! public private How can I solve this problem ? please help me. Thanks in advance :)
tagged with: manifest
has comment: http://stackoverflow.com/comment/43168618
score: 0

http://stackoverflow.com/q/27323215
tagged with: java
has comment: http://stackoverflow.com/comment/43105806
has comment: http://stackoverflow.com/comment/43105746
has comment: http://stackoverflow.com/comment/43106482
type: Question
upvote count: 4
has title: Can an array be larger than physical memory? (e.g. can it be partially paged)
has comment: http://stackoverflow.com/comment/43106413
has comment: http://stackoverflow.com/comment/43105765
has body: Let's say I have an API that provides an array of Strings for example, and this array might be larger than physical memory. Can the JVM page part of the array and bring it from disk as I traverse it? or is an Array an "atomic" data type that can't be partially paged? I assume for a linked list the answer is much easier since any of the nodes can be paged transparently and retrieved on a page fault, but I wonder if the JVM (or if major OSs a at all) allow paging just a part of a large continuous array.
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43105610
has comment: http://stackoverflow.com/comment/43105856
favorite count: 0
has comment: http://stackoverflow.com/comment/43105808
has answer: http://stackoverflow.com/a/27323256
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43105873
score: 4
has comment: http://stackoverflow.com/comment/43105716
has comment: http://stackoverflow.com/comment/43106435

http://stackoverflow.com/q/27319475
has comment: http://stackoverflow.com/comment/43098483
downvote count: 2
has answer: http://stackoverflow.com/a/27319741
has comment: http://stackoverflow.com/comment/43098418
linked to: http://stackoverflow.com/q/11685305
has comment: http://stackoverflow.com/comment/43098335
tagged with: java
has comment: http://stackoverflow.com/comment/43098311
has comment: http://stackoverflow.com/comment/43098358
type: Question
score: 0
tagged with: for-loop
has answer: http://stackoverflow.com/a/27319665
has answer: http://stackoverflow.com/a/75472885
favorite count: 0
has comment: http://stackoverflow.com/comment/43098558
has title: How can I replace the for loop with enhanced for loop in the following code?
has body: I have this code for sorting an arraylist ArrayList&lt;Worker&gt; workersSorted= sort(workers); System.out.println(workersSorted.toString()); } public static ArrayList&lt;Worker&gt; sort(ArrayList&lt;Worker&gt; _workers) throws CloneNotSupportedException { Worker temp; for (int i = 0; i &lt; _workers.size() - 1; i++) { if ((_workers.get(i)).compareTo(_workers.get(i+1)) == -1){ temp = (Worker) _workers.get(i).clone(); _workers.set(i, _workers.get(i+1)); _workers.set(i+1, temp); } } return _workers; } How may I rewrite the code using enhanced for loop?
has answer: http://stackoverflow.com/a/27319676
answer count: 4
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/q/27334410
answer count: 1
type: UnansweredQuestion
tagged with: jdbc
tagged with: java
tagged with: mysql
tagged with: prepared-statement
type: Question
has body: I'm attempting to enter a set of values to tables reservation,resdetails using database transactions. There are no exceptions thrown, but values are not being entered in to DB.Here i've used utilised java.sql.PreparedStatement. public boolean addReservation(Reservation res, ArrayList&lt;ReservationDetails&gt; resdetlist) throws Exception { connection = DBConnection.getDBConnection(); try { System.out.println("A"); connection.setAutoCommit(false); PreparedStatement ps1 = connection.prepareStatement("insert into reservation values(?,?,?,?)"); ps1.setString(1, res.getResid()); ps1.setBoolean(2, res.isCheckin_status()); ps1.setString(3, res.getRes_from()); ps1.setString(4, res.getRes_till()); int addedres = ps1.executeUpdate(); System.out.println("addres:" + addedres); System.out.println("B"); if (addedres &gt; 0) { for (ReservationDetails resdet : resdetlist) { //int addedresdet = addReservationDetails(resdet); PreparedStatement ps2 = connection.prepareStatement("insert into resdetails values(?,?,?,?,?,?)"); ps2.setString(1, resdet.getResid()); ps2.setString(2, resdet.getNic()); ps2.setString(3, resdet.getPayment_id()); ps2.setString(4, resdet.getRoom_no()); ps2.setString(5, resdet.getType_of_accomodation()); ps2.setString(6, resdet.getDate_of_reservation()); int addedresdet = ps2.executeUpdate(); System.out.println("addedresdet:" + addedresdet); System.out.println("C"); if (addedresdet &lt;= 0) { System.out.println("D"); connection.rollback(); return false; } } } else { System.out.println("E"); connection.rollback(); return false; } connection.commit(); } catch (Exception ex) { // ex.printStackTrace(); connection.rollback(); } finally { connection.setAutoCommit(true); System.out.println("F"); } return true; }
has comment: http://stackoverflow.com/comment/43125823
score: 0
has title: Attempting to enter values to database tables using jdbc transaction
has answer: http://stackoverflow.com/a/27334502

http://stackoverflow.com/comment/43363020
type: AnswerComment
comment on: http://stackoverflow.com/a/27457103
has text: @JoopEggen I still don't know what "open" means in this context ;)
score: 0
type: Comment

http://stackoverflow.com/comment/43297818
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27427775
has text: I have to install netbeans for this?
type: AnswerComment

http://stackoverflow.com/q/27377293
type: AnsweredQuestion
tagged with: java
tagged with: selenium
has title: get the path of a resource in Java and get a path that can be opened in Browser with Special Characters
has answer: http://stackoverflow.com/a/27377443
type: Question
score: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/27377443
has body: I'm doing Selenium Tests and I want to open a Resource in Java Code like that : getClass().getClassLoader().getResource("fileWith[]"); The file I have to open contains '[' and ']' in its filename. I can't change the name. If I call url.getPath(); I get some String with '%5b' and '%5d' which I can't open in the Browser. Which Encoding do I have to do to open the path in the Browser on Windows?
tagged with: google-chrome

http://stackoverflow.com/comment/43381288
comment on: http://stackoverflow.com/q/27473351
score: 0
type: Comment
type: QuestionComment
has text: The usual method is that the server thread starts the thread for talking to the client. That is, it literally calls `Thread.start()` or something similar, like adding a task to a thread pool.

http://stackoverflow.com/q/27400125
type: Question
has body: I have exposed some webservices in a RESTful manner. In my first form user needs to login and login credentials is sent in Authorization header in the following manner: Authorization :Basic adajajffjfksal Now in my security-context.xml I have secured the URL in the following way: &lt;http pattern="/login" create-session="stateless"&gt; &lt;intercept-url pattern="/**" access="ROLE_AUTHENTICATED" /&gt; &lt;http-basic /&gt; &lt;/http&gt; After successful login I have another form from which some paramaters will be passed to the server on behalf of the User. Will session be created? Do I have to pass user credentials in Authorization header again? Will this login request be sessionless due to 'create-session="stateless"'?
has comment: http://stackoverflow.com/comment/43246695
has answer: http://stackoverflow.com/a/27401614
score: 0
answer count: 1
tagged with: spring-security
has comment: http://stackoverflow.com/comment/43245744
has comment: http://stackoverflow.com/comment/43246623
type: UnansweredQuestion
tagged with: spring
has title: How does Spring security handle http basic authentication?
tagged with: java
has comment: http://stackoverflow.com/comment/43246469

http://stackoverflow.com/a/27435940
downvote count: 0
score: 5
has body: Node is a non-static nested class. That means it is an inner class, and it is within the scope of the type parameters Key and Value of its outer class. When you simply write the type Node without any explicitly qualification inside SeperateChainingST, it is implicitly qualified as SeperateChainingST&lt;Key, Value&gt;.Node. This is a parameterized type (it has the type parameters Key and Value), even though you do not "see" them when writing Node. As you know, you cannot use array creation expression with a component type that is a parameterized type: new HashMap&lt;Key, Value&gt;[5] So you cannot do new Node[5] // which is equivalent to new SeperateChainingST&lt;Key, Value&gt;.Node[5] But, as you may also know, array creation expression can be used with a component type that is a raw type, or a type that is parameterized with all wildcards: new HashMap[5] new HashMap&lt;?,?&gt;[5] We can do it similarly here, except how do you get the raw type of the inner class Node? It is not just Node, as we have found. Instead, you must explicitly qualify it with the raw type of the outer class: new SeperateChainingST.Node[5] or with the all-wildcards way: new SeperateChainingST&lt;?,?&gt;.Node[5]
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27415693
upvote count: 5
accepted answer of: http://stackoverflow.com/q/27415693
type: Answer

http://stackoverflow.com/q/27358867
has title: GXT3 - TextField height. How to make a TextFields height bigger?
tagged with: gxt
possible better answer: http://stackoverflow.com/a/27359113
tagged with: gwt
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27373466
tagged with: java
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/27373466
score: 0
has body: GXT 3.0.1 GWT 2.5.1 I am trying to make a textfield the same height as the button next to it, but it does not work. I have tried the TextFields own set functions, the cointaner Layout functions and so on. Nothing seems to work like suspected. VerticalLayoutContainer layout = new VerticalLayoutContainer(); HBoxLayoutContainer searchContainer = new HBoxLayoutContainer(); searchContainer.setPadding(new Padding(5)); searchContainer.setPack(BoxLayoutPack.CENTER); BoxLayoutData boxLayout = new BoxLayoutData(new Margins(0, 5, 5, 0)); searchText = new TextField(); searchButton = new TextButton("Search"); searchContainer.add(searchText, boxLayout); searchContainer.add(searchButton, boxLayout); searchContainer.setBorders(true); layout.add(searchContainer); The snippet does not represent, what I have tried so far. The snippet shows in what context I am using the TextField and the Button (Containers). What am I missing? Or is it even possible to adjust the height over a fixed value like pixels? I am quite new to GXT. Thank you very much.
tagged with: height
has answer: http://stackoverflow.com/a/27359113
tagged with: textfield

http://stackoverflow.com/comment/43098788
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27319391
has text: Sorry, my fault. IClass_Instance was for "an instance of a variable of type IClass".
score: 0

http://stackoverflow.com/q/27348979
accepted answer: http://stackoverflow.com/a/27349296
type: Question
has answer: http://stackoverflow.com/a/27349057
tagged with: hashmap
has comment: http://stackoverflow.com/comment/43152692
score: -2
possible better answer: http://stackoverflow.com/a/27349057
answer count: 3
has comment: http://stackoverflow.com/comment/43152644
favorite count: 0
has answer: http://stackoverflow.com/a/27349296
has answer: http://stackoverflow.com/a/27349068
type: AnsweredQuestion
tagged with: linked-list
tagged with: java
downvote count: 3
upvote count: 1
has body: I wrote a HashMap with the key as a String and the value as a LinkedList of Strings. I want to write a method that consumes the key which is a string and value. Then I want find the key in the HashMap that match the given key then add the given String to the List of the Strings. **thank guys but there is another error. in this line "Likes.put(s,Likes.get(s).add(fav)); ." it says : Error: no suitable method found for put(java.lang.String,boolean) method java.util.HashMap.put(java.lang.String,java.util.LinkedList&lt;java.lang.String&gt;) is not applicable (actual argument boolean cannot be converted to java.util.LinkedList&lt;java.lang.String&gt; by method invocation conversion) method java.util.AbstractMap.put(java.lang.String,java.util.LinkedList&lt;java.lang.String&gt;) is not applicable (actual argument boolean cannot be converted to java.util.LinkedList&lt;java.lang.String&gt; by method invocation conversion) I can't tell why it says "the actual argument is Boolean"! I want to insert a LinkedList no a boolean class Recomnder { Recomnder(){ Likes.put("tom",new LinkedList() ); Recomnder.addLikes("tom","movie tovi"); } HashMap&lt;String,LinkedList&lt;String&gt;&gt; Likes = new HashMap&lt;String,LinkedList&lt;String&gt;&gt;(); void addLikes (String name, String fav){ for (String s : Likes.keySet()) { if (s.equals(name)) Likes.put(s,Likes.get(s).add(fav)); } } }
has title: Finding and replacing a value in HashMap?

http://stackoverflow.com/a/27445714
has body: Arrays.toString is expecting an array, yet you are only passing one element, try using: Arrays.toString(newgame.top3Score)
has comment: http://stackoverflow.com/comment/43331616
type: Answer
upvote count: 2
score: 1
answers question: http://stackoverflow.com/q/27445626
downvote count: 1
has comment: http://stackoverflow.com/comment/43330573
has comment: http://stackoverflow.com/comment/43330396
has comment: http://stackoverflow.com/comment/43331688

http://stackoverflow.com/q/27474061
has answer: http://stackoverflow.com/a/27474530
tagged with: eclipse
type: Question
score: 0
has comment: http://stackoverflow.com/comment/43383818
has title: Eclipse Android plugin issue "Error: No resource found that matches the given name (at 'theme' with value '@style/AppTheme')"
has answer: http://stackoverflow.com/a/31397802
possible better answer: http://stackoverflow.com/a/27474271
tagged with: android
has comment: http://stackoverflow.com/comment/43382519
has answer: http://stackoverflow.com/a/27474271
answer count: 4
linked to: http://stackoverflow.com/q/5482554
has body: I am using Eclipse Android plugins to build a project, but I am getting this error when create a new project. And also in generated project hierarchy src files and layout files doesnt exist. I tried to add support libraries but nothing changed. How do I fix it?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27528144
accepted answer: http://stackoverflow.com/a/27528144
tagged with: java

http://stackoverflow.com/a/27408174
answers question: http://stackoverflow.com/q/27382921
has body: Any way... i found a solution (i dont know if another one exists) and it was adding the resource into the <build> of the pom.xml src/main/resources/META-INF/ ${project.basedir}/target/classes/META-INF/ *.xml
type: AcceptedAnswer
score: 0
accepted answer of: http://stackoverflow.com/q/27382921
type: Answer

http://stackoverflow.com/q/27449389
accepted answer: http://stackoverflow.com/a/27449944
tagged with: spring
upvote count: 11
tagged with: spring-4
has title: Spring 4 - Java Config, Tomcat, and Display Name
tagged with: tomcat7
score: 11
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27449944
tagged with: java
type: Question
answer count: 1
downvote count: 0
tagged with: tomcat
favorite count: 0
has body: I'm using Spring 4.1.1 with pure Java Config (i.e., no web.xml at all). The AnnotationConfigWebApplicationContext has a displayName property, which I assume is analogous to the display-name tag in a web.xml file. However, when I set this property in Java Config, the "Display Name" column in the Tomcat Manager is empty when I deploy the WAR unlike if I would have used the display-name tag in web.xml. Is this the intended behavior or am I doing something wrong. I'm using the latest version of Tomcat which is 7.0.57, Java 1.7 u51, and Groovy 2.3.7. @Slf4j class WebAppInitializer implements WebApplicationInitializer { { @Override void onStartup(ServletContext container) throws ServletException { def rootContext = new AnnotationConfigWebApplicationContext() rootContext.register(WebAppConfig) rootContext.servletContext = container rootContext.displayName = 'Description of WAR goes here!' DispatcherServlet dispatcherServlet = new DispatcherServlet(rootContext) dispatcherServlet.throwExceptionIfNoHandlerFound = true def dispatcherServletReg = container.addServlet('dispatcher', dispatcherServlet) dispatcherServletReg.addMapping('/') dispatcherServletReg.loadOnStartup = 1 } } Thanks ahead of time for any help.

http://stackoverflow.com/q/27457816
tagged with: java
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/43352894
has title: Java GUI Game: Help using Jframes
score: 0
tagged with: user-interface
has comment: http://stackoverflow.com/comment/43354173
has comment: http://stackoverflow.com/comment/43352672
tagged with: jframe
type: UnansweredQuestion
has body: Ive been playing around with some code to teach myself JFrames. I've got myself in a complete mess with coding this game. What i'm trying to achieve is to take the current code with is just sat in a jframe (with has no support for re-sizing) and place it in a better constructed window. with 3 panels one for the game buttons to the left one to the right for status labels and one at the button also for labels. At the moment the class extends Jframe but not makeFrame method has been introduced which I've been trying to do. The following code is initialized in the constructor. The corresponding fields are there, i haven't included them but they all compile. buttons = new JButton[boardsize][boardsize]; mineBoard = new int[9][9]; setSize(boardsize * gridsize + 60, boardsize * gridsize + 180); getContentPane().setLayout(null); getContentPane().add(namelabel); getContentPane().add(scorelabel); getContentPane().add(gamesPlayed); // LABEL POSITIONING ON BOARD scorelabel.setBounds(30, 30 + gridsize * boardsize, 130, 30); namelabel.setBounds(40, 40 + gridsize * boardsize, 130, 30); gamesPlayed.setBounds(60, 60 + gridsize * boardsize, 130, 30); for (int a = 0; a &lt; boardsize; a++) { for (int b = 0; b &lt; boardsize; b++) { buttons[a][b] = new JButton(""); getContentPane().add(buttons[a][b]); buttons[a][b].setBounds(30 + gridsize * a, 30 + gridsize * b, gridsize, gridsize); buttons[a][b].addMouseListener(new MouseListener(a, b)); //buttons[a][b].setIcon( new ImageIcon( "images/rock.jpg" ) ); setx(a); sety(b); settried(false); setmine(false); } } assignmines(); setVisible(true); updateGamesPlayed(); UpdateName(); updatescore(); If anyone can help in any way as to how i can achieve the aim with a makeFrame() method that would be great.
answer count: 0

http://stackoverflow.com/comment/43355524
has text: Which means there is something else wrong.
comment on: http://stackoverflow.com/q/27457639
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43333826
score: 0
comment on: http://stackoverflow.com/q/27431576
type: Comment
type: QuestionComment
has text: @edharned Implementing a Queue with a thread pool sounds like a great idea. However, I feel that I would still get the same IO issues. I am not quite sure how I would implement a thread pool to work off a queue, could you provide an example, so I can run some tests and see if the results are different and if there is any speed change.

liferay-6
tags question: http://stackoverflow.com/q/27369549
tags question: http://stackoverflow.com/q/27460914
tag name: liferay-6
type: Tag

http://stackoverflow.com/a/27320337
downvote count: 0
answers question: http://stackoverflow.com/q/27319446
type: Answer
has comment: http://stackoverflow.com/comment/43155779
has comment: http://stackoverflow.com/comment/43171093
upvote count: 5
score: 5
has body: Not all algorithms can be processed in parallel (algorithms that are strictly sequential; where P=0 in Amdahl's law) or at least not efficiently (see P-complete). Other algorithms are more suitable for parallel execution (extreme cases are called "embarrassingly parallel"). A naive implementation of a parallel algorithm can be less efficient in terms of complexity or space compared to a similar sequential algorithm. If there is no obvious way to parallelize an algorithm so that it will get a speedup, you may need to choose another similar parallel algorithm that solves the same problem but can be more or less efficient. If you ignore thread/process creation and direct inter-process communication overhead, there can still be other limiting factors when using shared resources like IO bottlenecks or increased paging caused by higher memory consumption. When should we decide to give up multithreading and only use a single thread to accomplish our goal? When deciding between single and multithreading, the time needed to change the implementation and the added complexity for developers should be taken into account. If there is only small gain by using multiple threads you could argue that the increased maintenance cost that are usually caused by multi-threaded applications are not worth the speedup.

http://stackoverflow.com/comment/43118713
type: AnswerComment
comment on: http://stackoverflow.com/a/27325669
type: Comment
has text: Edited my code. Tested the new part and it works. I also edited the first part to fix two small problems (int > Integer as a type for the HashMap). Sorting the contents of HashMaps isn't as easy as you might think since HashMaps are created be be accessed very fast and therefore skip the process of sorting. If you got any other question, don't hesitate to ask. :)
score: 0

http://stackoverflow.com/comment/43209146
type: QuestionComment
score: 0
has text: Output added sorry for the non /n..
comment on: http://stackoverflow.com/q/27379638
type: Comment

http://stackoverflow.com/q/27415306
tagged with: eclipse
tagged with: static-libraries
score: 0
has comment: http://stackoverflow.com/comment/43274652
answer count: 1
has answer: http://stackoverflow.com/a/27415354
favorite count: 0
has comment: http://stackoverflow.com/comment/43274631
has body: I started learning Java a while ago and I have a decent understanding of the language (I am about half way through Herbert Scheildns Java a beginners guide book). I really wanted to code a MineCraft mod in forge. So I set up the environment using this video https://www.youtube.com/watch?v=tD6MsMWIH-4&amp;list=UUrsaesoinvX126cv-ctAwBw&amp;index=18 and it worked. Now I sort of have two questions at this point. One is slightly off topic but I don't really know where else to ask and id appreciate the help. If you'd rather not answer the off topic question please at least help with the other one. My first question is this: How do I view the "commands" for MineCraft forge. I know it imports a library of commands and I was wondering if there was a way to view them (commands like getHealth() or things like this) . Now here is the off topic question: What is the best way for me to learn how to code with MineCraft forge. I know there is a specific "syntax" things have to have so a mod will run like proxies and Preload methods and things so I was wondering if there was some type of tutorial you all know about. Thanks for the help in advanced, sorry about going of topic!
has title: How do I view all the "commands" for minecraft forge once I have it imported into my minecraft workspace?
has comment: http://stackoverflow.com/comment/43274615
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27415354
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43274746
tagged with: minecraft-forge
tagged with: minecraft

http://stackoverflow.com/comment/43298636
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27428047
score: 0
has text: Because that's what `Object.toString()` prints.

http://stackoverflow.com/comment/46775215
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27516472
type: AnswerComment
has text: @Programmer I currently have a class (CameraActivity) which inherits from Activity which is stopping me from inheriting from BroadcastReceiver as well. I need to have the logic within CamreActivity because the wink needs to run a function to take a picture which has the logic within CameraActivity class. Wink will have other logic elsewhere.

http://stackoverflow.com/a/27330170
has comment: http://stackoverflow.com/comment/43119343
answers question: http://stackoverflow.com/q/27327060
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27327060
upvote count: 1
has body: SQLite has no pivot functions; you have to do this in two steps. First, get all possible tags: SELECT _id, Name FROM Tags ORDER BY Name; Then, using the returned data, construct a query that looks up each possible tag for each key: SELECT Key, (SELECT Value FROM Values WHERE Key_ID = Keys._id AND Tag_ID = 111 ) AS Tag_111, (SELECT Value FROM Values WHERE Key_ID = Keys._id AND Tag_ID = 222 ) AS Tag_222, ... FROM Keys;
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/43352793
type: QuestionComment
has text: Ok, let me give you some general advice. I suggest you to read "Learning libGDX Game Development". It's nice book for beginners and it will give you basic knowledges about libgdx. If you don't have money you know what to do, right? Did you also tried to download source code from that tutorial? Maybe you missed something. And this is my source code https://github.com/nikoliazekter/JustSimpleTD . It can help you.
comment on: http://stackoverflow.com/q/27457401
score: 0
type: Comment

http://stackoverflow.com/q/27319534
answer count: 2
has body: I'm with the following problem: I have two variables called "hourOne" and "hourTwo" of type Calendar[][]. They have periods of dates stored in two columns, "start" and "end". I need subtract the hours to find the differences and store in another variable (hourThree for example) like this hourOne[0][0] = "08:00" hourOne[0][1] = "12:00" hourTwo[0][0] = "07:00" hourTwo[0][1] = "13:00" In hourThree will have hourThree[0][0] = "07:00" hourThree[0][1] = "08:00" hourThree[1][0] = "12:00" hourThree[1][1] = "13:00" How can I subtract this periods? Detail: I can't use JodaTime API for this, and the variables don't have a defined number of rows (one may have more lines than the other too).
tagged with: subtraction
has answer: http://stackoverflow.com/a/27319980
has comment: http://stackoverflow.com/comment/43099198
has answer: http://stackoverflow.com/a/27319746
tagged with: multidimensional-array
type: UnansweredQuestion
tagged with: java
tagged with: calendar
type: Question
has title: Subtracting time period
score: 0

http://stackoverflow.com/q/27318289
has title: Scalable chatroom using (playframework akka and websocket)
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27319566
has comment: http://stackoverflow.com/comment/45589292
tagged with: scalability
score: 0
has body: I've been asked to build a chatroom that scale using Play (java), Akka and websocket. Play provide a sample that do what I wanted and it works perfectly. Now I need to deal with the scaling issue. I'm not familiar with play and scaling problematics so I'm having a hard time to find a solution that will scale. Or at least prove that the sample will scale (which I doubt). I know that actor system offers good performance but how can I be sure that it will scale ? Does anyone of you would be able to explain me/provide me links that explain how to build such application that will really scale ? What would be the architecture ? I've found a an example on Heroku but i'd like alternatives to heroku. Maybe akka.cluster is one ? Thank you,
tagged with: playframework
tagged with: akka
answer count: 1
tagged with: websocket
accepted answer: http://stackoverflow.com/a/27319566
type: AnsweredQuestion

http://stackoverflow.com/comment/43167452
comment on: http://stackoverflow.com/a/27357596
type: AnswerComment
has text: Before he's starting with ORM, i think it's good to understand jdbc first, it's my opinion.
type: Comment
score: 2

http://stackoverflow.com/comment/43235006
type: QuestionComment
has text: Just FYI - If the anyMoreDelayedExplosion is class variable and if you are not initializing it, it will be initialized to false by default.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27393685

http://stackoverflow.com/comment/43311599
type: AnswerComment
has text: That doesn't look like the right `for` loop. The instructions seem to say to print values from index 0 to the `iMax` (which is the parameter `i`), but that isn't what your code does.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27435331

http://stackoverflow.com/comment/43333875
score: 0
has text: The answer is: C:\PHP\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\; Looks like java is not on IUSR path. How can I add JAVA to IUSR path?
comment on: http://stackoverflow.com/q/27432907
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27382949
has comment: http://stackoverflow.com/comment/43214967
has body: Normally for REST based URL nomenclature the operation (PUT, DELETE, GET etc) is decided by the URI and not my the model. So if you follow the right conventions then DELETE and PUT operations should be different actions on your controller. But if you want to push the operation inside the model then you probably don't need multiple actions. Single action with a single request mapping can consume the user model and then in your service or helper you can do an if else check on the model's action attribute to see what to do about it.
downvote count: 0
answers question: http://stackoverflow.com/q/27382810
type: Answer
has comment: http://stackoverflow.com/comment/43214665
upvote count: 1
score: 1

http://stackoverflow.com/comment/43256467
has text: I have done a random number generator (dice game), and i print the x amount of numbers to the label. strOutput=strOutput+" "+nummer; The strOutput is it that i print to the label. I'm pretty knew to java.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27405766
type: Comment

http://stackoverflow.com/a/27436695
answers question: http://stackoverflow.com/q/27436643
has body: You can transform your string into StringBuilder and it had reverse method. And its always better to use foreach rather than for, until there is actual need. public String[] reverseString(String[] words) { String[] t = new String[words.length]; for (String wordTemp : words) { StringBuilder sb = new StringBuilder(wordTemp); t[i] = sb.reverse().toString(); } return t; } Alternate approach :- public String[] reverseString(String[] words) { String[] t=new String[words.length]; for(int i=0;i&lt;words.length;i++) { //added for setting elemennt as emptyString instead of null t[i] = ""; for(int j=words[i].length()-1;j&gt;=0;j--) { t[i]+=words[i].substring(j,j+1); } } //using loop for(int i=0;i&lt;words.length;i++) { System.out.println(t[i]); } //using Arrays Method System.out.println(Arrays.toString(t)); return t; }
has comment: http://stackoverflow.com/comment/43317688
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27436643
type: Answer
has comment: http://stackoverflow.com/comment/129974537
score: 2
has comment: http://stackoverflow.com/comment/43314062
upvote count: 2

http://stackoverflow.com/comment/43311416
comment on: http://stackoverflow.com/a/27434598
score: 0
type: AnswerComment
type: Comment
has text: Nice edit. But then, you had my (up) vote the moment you wrote *"You are invoking ImageIcon(String filename) constructor."* :) Hopefully it will prompt the OP to post an MCVE that *fails.*

http://stackoverflow.com/a/27396653
answers question: http://stackoverflow.com/q/27396495
has body: Have a look at apache commons lang StringUtils: StringUtils.rightPad(String str, int size, String padStr) StringUtils.leftPad(String str, int size, String padStr StringUtils.rightPad("bat", 5, "") = "bat " StringUtils.leftPad("bat", 5, "x") = "xxbat"
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/27396495

http://stackoverflow.com/a/27443526
downvote count: 0
score: 5
has body: There is no concept of "font" with System.out. Edit the console font settings for whatever application you're using as an output console.
type: Answer
upvote count: 5
answers question: http://stackoverflow.com/q/27443510

http://stackoverflow.com/a/27397611
has comment: http://stackoverflow.com/comment/43242421
has comment: http://stackoverflow.com/comment/43242141
has comment: http://stackoverflow.com/comment/43242163
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43241467
has comment: http://stackoverflow.com/comment/43241817
answers question: http://stackoverflow.com/q/27397511
has comment: http://stackoverflow.com/comment/43242647
has body: note: Im not that knowledgeable in android so i dont know about Bundle class nor Intent class just want to share some thoughts. Try this. String shop = argsss.getString("shop"); the value of the Item which is your key (shop) because of this. public static final String Item = "shop"; look at this , //you are putting or passing the value of item3 to Item which is your key named "shop" intent.putExtra(Item,item3); so you can only get the value using the key you set. Update try this // first create a bundle for you to be able to use it later. Bundle sampleBundle = new Bundle(); // then set the values you want. with the Item key. sampleBundle.putString(Item, item3); // then create the intent Intent intent = new Intent(getActivity().getApplicationContext(),ClassB.class); // then put your bundle to intent. intent.putExtras(sampleBundle); startActivity(intent); to get this try this. Bundle bundle = this.getIntent().getExtras(); if(bundle !=null){ //Obtain Bundle String strdata = bundle.getString("shop"); //do the process } note again: i havent compile it i dont have ide for android its just a hint. or if you want to use only intent to pass some value use your code above then on the other class you can get it by : Intent intent = getIntent(); //this is how you retrieve the data String shop = intent.getStringExtra("shop"); Additional ref. Intent Fragment to Fragment Try this dude. :) Fragment to Fragment . Look at the last answer it may help you finding some ways on how fragments work. Another possible solution Passing data fragment to fragment Additional info. I think you cant pass data from fragment to another fragment directly. Often you will want one Fragment to communicate with another, for example to change the content based on a user event. All Fragment-to-Fragment communication is done through the associated Activity. Two Fragments should never communicate directly. Based on Fragment Documentation. Question. //note: not sure about the flow of the program. just want to…
has comment: http://stackoverflow.com/comment/43242308
has comment: http://stackoverflow.com/comment/43242360
has comment: http://stackoverflow.com/comment/43242199
has comment: http://stackoverflow.com/comment/43242822

http://stackoverflow.com/q/27397768
score: 0
tagged with: java
has title: How to insert and search in elasticsearch in one thread use Java?
type: Question
has comment: http://stackoverflow.com/comment/43241940
answer count: 1
has body: I want to insert to database some records and search this records. But due to the fact that the search is performed in another thread I find nothing. I have code: IndexResponse indexResponse = client.prepareIndex(indexName, documentType) .setSource(request.toJSONString()) .setOperationThreaded(false) .execute() .actionGet(); SearchResponse response = client.prepareSearch(indexName) .setTypes(documentType) .setQuery(boolQuery) .setSize(number) .setFrom(offset) .addSort("date", SortOrder.ASC) .execute() .actionGet(); And I doesn't find last record. How to setting 1 thread for insert and search?
has answer: http://stackoverflow.com/a/27398076
type: UnansweredQuestion
tagged with: elasticsearch

http://stackoverflow.com/q/27457639
tagged with: maven
has body: The question started as - maven does not reach into jar for a folder bundle correctly, when running tests. It does work currectly when running some main() though. The stack trace for running test (while building) looked like this: Caused by: java.util.MissingResourceException: Can't find Not found profile: file:\C:\Users\Simon\.m2\repository\ario\TextProcessing\1.0.4-SNAPSHOT\TextProcessing-1.0.4-SNAPSHOT.jar!\lang bundle at java.util.logging.Logger.setupResourceInfo(Logger.java:1942) at java.util.logging.Logger.&lt;init&gt;(Logger.java:380) at java.util.logging.LogManager.demandLogger(LogManager.java:554) at java.util.logging.Logger.demandLogger(Logger.java:455) at java.util.logging.Logger.getLogger(Logger.java:553) at cz.techniserv.ario.tagger.TagDetect.setLangPath(TagDetect.java:126) at cz.techniserv.ario.tagger.TagDetect.&lt;init&gt;(TagDetect.java:58) 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.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147) ... 86 more I triple checked - the lang folder is within the jar. When running a main() within the module however, it does not try to reach into jar withing m2 repository, but will take the lang folder from within the opened dependency project. So it does not try to reach into a jar, just takes the data from project folder. This runs correctly. Apparently, the File() constructor is unable to reach for the resource in the jar. The code, that tries to reach into the jar is within a constructor. It looks like this: this.path = this.getClass().getResource("/" + aLanguageDirectoryName).getPath(); and than there is a File constructor which takes this path. In case of running the app it resolves to the project pa…
type: Question
type: AnsweredQuestion
tagged with: resourcebundle
accepted answer: http://stackoverflow.com/a/27485229
linked to: http://stackoverflow.com/q/1529611
has comment: http://stackoverflow.com/comment/43353278
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27485229
tagged with: jar
has title: java.util.MissingResourceException - new File() does not reach into jar - how to provide external library with a path for this File?
tagged with: dependencies
tagged with: java
has comment: http://stackoverflow.com/comment/43355524

http://stackoverflow.com/q/27401750
has comment: http://stackoverflow.com/comment/43252603
linked to: http://stackoverflow.com/q/21393517
tagged with: spring
tagged with: rabbitmq
score: 2
has answer: http://stackoverflow.com/a/71360659
has comment: http://stackoverflow.com/comment/43250004
has body: When there is some except throw out to the listener, the message will be re-deliver next time and this is good for us, but is it possible to set a limit for the retries? such as I want to retry 3 times, and drop the message after retried 3 times.
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43254735
has comment: http://stackoverflow.com/comment/43252750
upvote count: 2
has comment: http://stackoverflow.com/comment/43248597
answer count: 1
has title: possible to limit retry for a failed message in spring rabbitmq
downvote count: 0
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/43309766
type: QuestionComment
has text: @lexicore - ok so have you considered hacking the ClassLoader - just a thought - no idea how but that seems to be all you have left.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27433291

http://stackoverflow.com/a/27426309
has body: Use EnumSet. EnumSet&lt;TestMe&gt; set = new EnumSet&lt;&gt;(TestMe.class); An EnumSet has the bit properties you desire, though unfortunately does not exhibit them as long[] or such. Otherwise use a BitSet.
type: Answer
has comment: http://stackoverflow.com/comment/43294932
answers question: http://stackoverflow.com/q/27426173
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43295612
has comment: http://stackoverflow.com/comment/43296794
upvote count: 2
has comment: http://stackoverflow.com/comment/43294589

http://stackoverflow.com/comment/43125228
type: QuestionComment
score: 0
has text: I understand, sorry for confusing the terminology. Do you see anything particularly flawed about the `BufferedParseStream`?
comment on: http://stackoverflow.com/q/27334021
type: Comment

http://stackoverflow.com/q/27330347
tagged with: multithreading
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27330379
accepted answer: http://stackoverflow.com/a/27330379
has title: What guarantees are provided if one thread mutates an object already in one of the concurrent collections?
tagged with: concurrency
type: Question
answer count: 1
score: 0
has body: If thread one puts a mutable object A into a concurrent collection, like a ConcurrentSkipListMap, I understand that this is thread-safe in the sense that if thread 2 'get's the object A from the collection, it is guaranteed to be fully visible. However, if thread one has mutated object A while it is in the collection, does getting it by thread two still provide the same full visibility guarantee?

http://stackoverflow.com/q/27364352
upvote count: 2
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/36664157
score: 2
has comment: http://stackoverflow.com/comment/43191245
has title: Android binary xml file error inflating class / cannot make calls to a recycled instance
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/33005591
downvote count: 0
has comment: http://stackoverflow.com/comment/43195580
answer count: 3
has answer: http://stackoverflow.com/a/27372338
favorite count: 0
has body: This crashes an Android app running Android 5 Lollipop, but works fine on Android version 4. It's using the AndroidBootstrap library from here. The relevant code is: public class PreShareFragment extends Fragment { private Handler handler; private BootstrapButton next_button; private View placeholder; LayoutInflater root_inflater; Context context; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View rootView = inflater.inflate(R.layout.preshare_fragment, container, false); root_inflater = inflater; root_container = container; phone_number_field = (BootstrapEditText) rootView.findViewById(R.id.phone_number); next_button = (BootstrapButton) rootView.findViewById(R.id.preshare_next); next_button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { ... } }); return rootView; } My layout XML is: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" &gt; &lt;android.support.v4.view.ViewPager android:id="@+id/pager" android:layout_width="fill_parent" android:layout_height="fill_parent" /&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:id="@+id/placeholder" android:background="@android:color/transparent"&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" android:weightSum="100" &gt; &lt;Space android:layout_height="0dp" android:layout_width="wrap_content" android:layout_weight="96"&gt; &lt;/Space&gt; &lt;com.viewpagerindicator.CirclePageIndicator android:id="@+id/indicator" android:padding="10dp" android:layout_height="wrap_content" android:layout_width="fill_parent" android:layo…

http://stackoverflow.com/a/27405718
downvote count: 0
has body: You defined text as a static variable static String text = "arpan"; So the proper way to access it is to use System.out.println(Superclass.text);
answers question: http://stackoverflow.com/q/27405679
upvote count: 3
type: Answer
score: 3

http://stackoverflow.com/comment/43289940
comment on: http://stackoverflow.com/q/27423353
score: 0
type: QuestionComment
type: Comment
has text: yes the same error, same thing

http://stackoverflow.com/a/27459042
upvote count: 2
has comment: http://stackoverflow.com/comment/43355189
has body: You have specified cascade in Supplier object, so it is applied if you save or update a Supplier. It means, you should either put the cascade in Category object, or change your logic somehow to save the supplier. More explanation: Modify the Category object as below: @ManyToMany(mappedBy = "categories", cascade = CascadeType.ALL) Set&lt;Supplier&gt; suppliers = new HashSet&lt;Supplier&gt;(0); OR modify CategoryController.update() as below: session.update(s);
has comment: http://stackoverflow.com/comment/43355364
has comment: http://stackoverflow.com/comment/43355112
has comment: http://stackoverflow.com/comment/43355385
score: 2
has comment: http://stackoverflow.com/comment/43354964
answers question: http://stackoverflow.com/q/27458877
downvote count: 0
type: Answer

http://stackoverflow.com/q/27345834
has answer: http://stackoverflow.com/a/27345978
answer count: 5
has body: I have a problem with my code. I read a couple of numbers of a text-file. For example: Textfile.txt 1, 21, 333 With my following code I want to split and convert the numbers from String to int. int answer = 0; int factor = 1; // Splitting and deleting the "," AND converting String to int. for (String retval : line.split(",")) { for (int j = retval.length() - 1; j &gt;= 0; j--) { answer = answer + (retval.charAt(j) - '0') * factor; factor *= 1; } System.out.println(answer); answer = (answer - answer); } I get the result in my console (int): 1 3 9 I see that the number 3 is a result of 2 + 1, and the number 9 is a result of 3 + 3 + 3. What can I do, to receive the following result in my console (int)? 1 21 333 /EDIT: I am only allowed to use Java.lang and Java.IO
has answer: http://stackoverflow.com/a/27345910
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43146964
type: Question
tagged with: split
possible better answer: http://stackoverflow.com/a/56716972
has answer: http://stackoverflow.com/a/27345914
tagged with: java
score: 15
tagged with: type-conversion
upvote count: 15
has answer: http://stackoverflow.com/a/56716972
tagged with: for-loop
has answer: http://stackoverflow.com/a/27345893
accepted answer: http://stackoverflow.com/a/27345893
downvote count: 0
tagged with: string
has title: Splitting and converting String to int
favorite count: 0

http://stackoverflow.com/comment/43179576
type: Comment
type: QuestionComment
has text: I am not sure I fully understand what you are trying to achieve. Is setting a custom focus traversal policy (as explained [here](https://docs.oracle.com/javase/tutorial/uiswing/misc/focus.html#customFocusTraversal)) what you are looking for ?
comment on: http://stackoverflow.com/q/27363776
score: 0

http://stackoverflow.com/comment/43333977
score: 0
type: Comment
type: QuestionComment
has text: By the way: you can write `\n` for a new line – so you don't have to use so many `System.out.println` in a row :)
comment on: http://stackoverflow.com/q/27447304

http://stackoverflow.com/q/27462218
answer count: 3
has answer: http://stackoverflow.com/a/27462309
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/27462452
has title: Java: while record exists = Keep adding number to the end of record
downvote count: 0
has body: Basically I am adding a record to database: title and description. I want to make it so if value of title already exists - add (1) or (2) to the end to make it distinguishable. I wrote this function: public boolean existCheck(int userId, String title){ String Validate = "SELECT COUNT(*) FROM memories WHERE userid='"+userId+"' AND title='"+title+"'"; int cnt = 0; boolean result = false; try{ rs = st.executeQuery(Validate); if(rs.next()){ cnt = rs.getInt(1); System.out.println(cnt); if(cnt != 0){ result = true; } } } catch(Exception e){e.printStackTrace();} return result; } It counts how many entries exist with that userID and Title. If not 0 then it exists and returns true that it exists. This code adds record to database. if(existCheck(userId, title) == true){ st.executeUpdate("INSERT INTO memories (userid, title, description) VALUES ('"+userId+"', '"+title+"(1)', '"+desc+"')"); } else{ st.executeUpdate("INSERT INTO memories (userid, title, description) VALUES ('"+userId+"', '"+title+"', '"+desc+"')"); } But flaw in this code is that if title(1) already exists, it will add another title(1) again. Of course I could make lots of if statements but I am sure I can do it with lesser lines using while loop. I don't know how to use it in this case though, I don't want server to fall into infinite loop. How do I apply while() loop to this?
tagged with: while-loop
type: Question
type: AnsweredQuestion
tagged with: sql
score: 3
has answer: http://stackoverflow.com/a/27462242
favorite count: 0
accepted answer: http://stackoverflow.com/a/27462242
possible better answer: http://stackoverflow.com/a/27462309

abstract-class
tags question: http://stackoverflow.com/q/27339624
type: Tag
tag name: abstract-class
tags question: http://stackoverflow.com/q/27367524
tags question: http://stackoverflow.com/q/27330303
tags question: http://stackoverflow.com/q/27407588

http://stackoverflow.com/comment/44116448
type: Comment
comment on: http://stackoverflow.com/q/27397419
type: QuestionComment
score: 0
has text: @StevenBenitez I added an answer below with the code.

http://stackoverflow.com/comment/43355558
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27459437
has text: It worked just perfect on the first try. Thank you very much :)

http://stackoverflow.com/q/27454655
has body: I'm trying to receive the json of this url: https://usecryptos.com/jsonapi/ticker/BTC-USD It's accessible by browser, however, program is given me the following error: GRAVE: null java.io.IOException: Server returned HTTP response code: 403 for URL: https://usecryptos.com/jsonapi/ticker/BTC-USD at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1838) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1439) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254) at java.net.URL.openStream(URL.java:1038) at main.JsonReader.readJsonFromUrl(JsonReader.java:28) at exchanges.brazil.UseCryptos.getTicker(UseCryptos.java:62) at exchanges.brazil.UseCryptos.get24hrVol(UseCryptos.java:50) at exchanges.brazil.UseCryptos.&lt;init&gt;(UseCryptos.java:42) at main.Main.init(Main.java:31) at main.Main.main(Main.java:52) Exception in thread "main" java.lang.NullPointerException at exchanges.brazil.UseCryptos.getTicker(UseCryptos.java:73) at exchanges.brazil.UseCryptos.get24hrVol(UseCryptos.java:50) at exchanges.brazil.UseCryptos.&lt;init&gt;(UseCryptos.java:42) at main.Main.init(Main.java:31) at main.Main.main(Main.java:52) Java Result: 1 I'm calling this function, with "vol" and "BTC_USD" as parameters: @Override public String getTicker(String info, String coin) throws JSONException{ JSONObject json = null; try { String[] parts = coin.split("_"); coin = parts[0]+"-"+parts[1]; System.out.println(base_url + pairs_path_ticker[0][1] + coin); json = JsonReader.readJsonFromUrl(base_url + pairs_path_ticker[0][1] + coin); //json = json.getJSONObject("priVolume"); } catch (IOException ex) { Logger.getLogger(UseCryptos.class.getName()).log(Level.SEVERE, null, ex); } catch (JSONException ex) { Logger.getLogger(UseCryptos.class.getName()).log(Level.SEVERE, null, ex); } switch (info) { case "vol": return Double.toString(json.getDouble("priVolume")); default: return null; } } Other use…
answer count: 1
score: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: UnansweredQuestion
has title: Java get json url Forbidden code
has answer: http://stackoverflow.com/a/27455673
type: Question

http://stackoverflow.com/comment/43180766
type: QuestionComment
comment on: http://stackoverflow.com/q/27364446
score: 0
has text: Did you do this http://stackoverflow.com/a/17881186/4324834?
type: Comment

http://stackoverflow.com/comment/43338093
type: AnswerComment
score: 0
type: Comment
has text: I recommended this because it is what antlr uses and it graphically outputs a tree quite nicely. The class in antlr that uses it is the TreeViewer class. You can search for TreeViewer.java antlr source, or try this: https://github.com/antlr/antlr4/blob/master/runtime/Java/src/org/antlr/v4/runtime/tree/gui/TreeViewer.java. It does seem like layout is not well documented, but the TreeViewer class looks pretty simple.
comment on: http://stackoverflow.com/a/27427775

http://stackoverflow.com/a/27335443
score: 0
has comment: http://stackoverflow.com/comment/43127791
answers question: http://stackoverflow.com/q/27335371
type: Answer
has comment: http://stackoverflow.com/comment/43127733
has body: Well, to answer a part of your question. You should use an ArrayList instead of an Array. See https://docs.oracle.com/javase/7/docs/api/java/util/ArrayList.html An ArrayList doesn't have a fixed size, an Array does after its initial declaration.
has comment: http://stackoverflow.com/comment/43127800

http://stackoverflow.com/a/27431672
score: 0
downvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/27431607
upvote count: 1
has body: You can use process class to run any executable in java code. Process process = Runtime.getRuntime().exec(" // command to execute java code"); process.waitFor(); It will execute any executable. process object will give different type of streams. process.getInputStream(); process.getOutputStream(); process.getErrorStream(); from that stream you can retrieve the output.

http://stackoverflow.com/comment/43380346
comment on: http://stackoverflow.com/a/27472361
type: AnswerComment
score: 0
type: Comment
has text: Thanks, works perfectly now, I'm not too what the 0xFF means though? I understand what it does, but not how, or what the notation means.

http://stackoverflow.com/comment/43282733
score: 0
type: Comment
type: QuestionComment
has text: getContentLength() was larger
comment on: http://stackoverflow.com/q/27405581

http://stackoverflow.com/a/27408922
score: 0
has body: add '\n' where ever you want a new line.
has comment: http://stackoverflow.com/comment/43267978
type: Answer
answers question: http://stackoverflow.com/q/27408889
downvote count: 2
upvote count: 2

http://stackoverflow.com/q/27474752
linked to: http://stackoverflow.com/q/20269083
has answer: http://stackoverflow.com/a/27474763
upvote count: 1
answer count: 1
favorite count: 0
has body: I'm writing an application that adds cards (JPanels) to a CardLayout during runtime. The problem is that some components on the card loads faster than others, making it appear glitchy and not properly rendered before it's displayed. I want it to be ready when shown for the first time. I have solved the issue temporary by a loading screen, which makes the thread sleep for 1500 ms. Is there a more exakt way to know if everything on the panel is loaded? private void showLoadingScreen() { final Component glassPane = getGlassPane(); setGlassPane(loadingPanel); loadingPanel.setVisible(true); Thread thread = new Thread() { public void run() { try {; Thread.sleep(1500); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } setGlassPane(glassPane); } }; thread.start(); }
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
tagged with: swing
type: Question
accepted answer: http://stackoverflow.com/a/27474763
tagged with: cardlayout
has title: Is there a way to know if a JPanel is finished loading it's content?
tagged with: jpanel

http://stackoverflow.com/a/27470291
has body: Actually, you don't need to read the lines into a List at all. If the whole task is just to print them, then you need to read each line, decide if this line is a line you want to print according to your conditions, and if so, just print it. This will save you a lot of memory, especially if the books are long. So how do you do that? You know that you want to print the lines starting with CHAPTER n, and ending with a blank line. So when you read a line, you ask yourself: "Is this line part of the chapter"? Obviously, if you have not read the line CHAPTER n yet, then it is not. After you have read the CHAPTER n, the answer is yes - unless your line is empty. So you keep a flag that says which state you are in: having read CHAPTER n or not. At first, the flag is false. For each line you read: If you are in the state of "didn't read that line yet": Check if the current line is CHAPTER n. If so, change the flag. If you are in the state of "read that line": Check if the current line is blank. If so, close the file and return. If not, print the line. This is known as a "state machine", where you get an input, one at a time, but your behavior is different depending on your state, and that behavior can include moving from one state to another state. boolean inChapter = false; try ( BufferedReader reader = new BufferedReader(new FileReader(bookName +textExtension)); ) { while ((fileContent = reader.readLine()) != null) { if ( inChapter ) { if ( fileContent.isEmpty() ) { return; } System.out.println( fileContent ); } else { if ( fileContent.equals("CHAPTER "+chapterNumber ) { inChapter = true; System.out.println( fileContent ); } } } } catch (Exception e) { e.printStackTrace(); } Note that I used "try with resources" which will close your file automatically.
answers question: http://stackoverflow.com/q/27470097
score: 0
has comment: http://stackoverflow.com/comment/43384361
accepted answer of: http://stackoverflow.com/q/27470097
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43384899
type: Answer
has comment: http://stackoverflow.com/comment/43384821

http://stackoverflow.com/a/27368600
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27326570
type: Answer
answers question: http://stackoverflow.com/q/27326570
upvote count: 5
has body: Unitils seems to do solve the purpose for me. The following APIs can compare objects reflectively. It can compare even if the attributes of a POJO themselves are user defined POJOs : import static org.unitils.reflectionassert.ReflectionAssert.*; // Exact field-by-field comparison assertReflectionEquals(new Person("John", "Doe", new Address("New street", 5, "Brussels")), new Person("John", "Doe", new Address("New street", 5, "Brussels")); // Ignore Null / 0 values in the expected object assertReflectionEquals(new Person("John", null, new Address("New street", 0, null)), new Person("John", "Doe", new Address("New street", 5, "Brussels"), ReflectionComparatorMode.IGNORE_DEFAULTS); // Ignore collection order assertReflectionEquals(Arrays.asList(new Person("John"), new Person("Jane")), new Person[] {new Person("Jane"), new Person("John")}, ReflectionComparatorMode.LENIENT_ORDER); // Ignore null/0 values + collection order assertLenientEquals(Arrays.asList(new Person("John"), null), new Person[] {new Person("Jane", "Doe"), new Person("John", "Doe")}); // Check only the firstName property assertPropertyLenientEquals("firstName", Arrays.asList("John", "Jane"), new Person[] {new Person("Jane", "Doe"), new Person("John", "Doe")}); Further information at Unitils Cookbook
score: 5

http://stackoverflow.com/q/27402463
favorite count: 0
has answer: http://stackoverflow.com/a/27444428
accepted answer: http://stackoverflow.com/a/27444428
upvote count: 1
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
tagged with: jasper-reports
has title: How to use Map as dataset element in JasperReports?
downvote count: 0
answer count: 1
has body: I'm passing a parameter to Jasper which is a collection of Maps. I would like to use this collection as dataset for a table. If I had a collection of normal Java objects I would do: $F{description} to get the field. I would like to do something like: get(description) or values().get(1) Is it possible to retrieve a map value in a table like this?

http://stackoverflow.com/a/27424229
has comment: http://stackoverflow.com/comment/43290717
has comment: http://stackoverflow.com/comment/43290437
has body: FragmentClientes is an Activity. You should not define a custom counstructor, since the method onCreate behaves as constructor and will be called automatically by the system. so put you code into onCreate method. Important: you should never, i mean realy never call new FragmentClientes(1);
has comment: http://stackoverflow.com/comment/43290827
type: Answer
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/43290517
answers question: http://stackoverflow.com/q/27424081
downvote count: 0

resizable
tags question: http://stackoverflow.com/q/27379120
tag name: resizable
type: Tag

http://stackoverflow.com/comment/43258457
comment on: http://stackoverflow.com/a/27406812
type: AnswerComment
has text: this doesn't work. Because graph.get(i) is another arraylist in the hashmap, and if I try to remove an item from the arraylist `i`, then I am modifying the map.
score: 0
type: Comment

http://stackoverflow.com/comment/43233664
score: 0
comment on: http://stackoverflow.com/a/27370060
type: Comment
type: AnswerComment
has text: Thank you for the help :) anyways I could correct it and get the required output. Still learning the basics in OpenCV with Java.

http://stackoverflow.com/a/27388398
type: Answer
has body: I have tested this and your code works just fine. Verify the HTML you are pulling from url and makes sure it contains "br" tag because that's your condition or remove this condition and you will get any html. import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; public class Main { public static void readData(String[] urls) { for (int i=0; i&lt;urls.length; i++) { String str=""; try { URL url=new URL(urls[i]); URLConnection conn=url.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String s; while (( s = in.readLine())!=null) if (s.contains("&lt;br&gt;")) { str += s; } } catch(Exception e) { e.printStackTrace(); } System.out.println("Url No. " + i +"\n\n"); System.out.println(str +"\n"); } } public static void main(String[] args) { String[] urls = {"http://google.com","http://google.com"}; readData(urls); } }
answers question: http://stackoverflow.com/q/27387784
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/q/27416407
has body: After I created a window, which should be completely black, there are white colors at the right and bottom edges. What is it that I may be doing wrong ? this is the constructor where I do initialisation of window :- public Panel() { Thread t = new Thread(this); addKeyListener(this); setFocusable(true); this.setPreferredSize(new Dimension(gameWidth, gameHeight)); JFrame f = new JFrame("AlienBusters"); f.add(this); f.pack(); f.setLocationRelativeTo(null); f.setResizable(false); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); t.start(); } this is the paint method where I made the window black :- @Override public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(Color.BLACK); g.fillRect(0, 0, gameWidth, gameHeight); }
score: 0
tagged with: paintcomponent
has answer: http://stackoverflow.com/a/27416455
tagged with: swing
type: AnsweredQuestion
tagged with: java
has title: White space at the right and bottom edge of the window
type: Question
linked to: http://stackoverflow.com/q/7229226
has comment: http://stackoverflow.com/comment/43276549
accepted answer: http://stackoverflow.com/a/27416455
answer count: 1
tagged with: awt

http://stackoverflow.com/comment/43120611
type: QuestionComment
has text: @DavidWallace I'm creating a mobile version of an application that another company has made, and I'm having an email conversation with one of their supports/developers, and they said that they was going to write a "documentation" or explaination of how the coordinate system was built up, and send it to me, so I'm kind of creating the base, like file reading etc. while I'm waiting. This might be very basic stuff, but I'm young and programming is only my hobby, yet ;)
type: Comment
comment on: http://stackoverflow.com/q/27331336
score: 0

http://stackoverflow.com/comment/54118211
type: Comment
type: QuestionComment
score: 0
has text: @Yuri Forgot to mark as answer. Not sure why. :)
comment on: http://stackoverflow.com/q/27364744

http://stackoverflow.com/comment/43099290
score: 0
type: QuestionComment
type: Comment
has text: Yes, Amdahl's law, more succinct than what I was saying.
comment on: http://stackoverflow.com/q/27319446

http://stackoverflow.com/comment/43088861
score: 1
comment on: http://stackoverflow.com/q/27314083
has text: Not sure if they exist in Java but `[TestFixture]` is an attribute. Essentialy metadata in your code, in this case you decorate the class definition with this and it tells NUnit that this class contains unit tests.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27357863
type: AcceptedAnswer
has body: Yes, this can be done. First however you must know the key in which to work. Assuming plain C major you'd start with the note a1 being 440Hz. Every octave up doubles the frequency, every octave down halves it, so you've got a nice logarithmic scale, with base 2. Within a logarithmic scale, multiplications turn into additions. So if you take the intervals of the notes _ with respect to a the ratio between the frequencies remains the same for all octaves. So all you've to find out, which octave you're in, subtract or add that number and the residual is the logarithm of the frequency interval. Finding the octave is simple as well, just evaluate floor(log2(f/440Hz)).
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27357727
type: Answer
answers question: http://stackoverflow.com/q/27357727
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/43297739

http://stackoverflow.com/comment/44157970
type: Comment
type: QuestionComment
has text: @Adam Yes I have. I've tested it once again using my email and it's counted towards the other quota, after sending one email I see in the console `Recipients Emailed 1 of 100`. I'm sure my email is in `admins` because I receive emails send to admins without any problem.
comment on: http://stackoverflow.com/q/27471921
score: 0

http://stackoverflow.com/comment/43276166
score: 1
comment on: http://stackoverflow.com/a/27415646
type: AnswerComment
type: Comment
has text: Thanks. Using the back reference and capture groups to 2, as suggested by you and another person, seems to have nailed it. I am using the following (?<!\S)(8|9|&|#|%)(\S+)\1(?=\s|$) where the first capture group contains the list of all the characters that can be a part of the paired pattern.

http://stackoverflow.com/a/27330413
has comment: http://stackoverflow.com/comment/43118864
has comment: http://stackoverflow.com/comment/43118899
has comment: http://stackoverflow.com/comment/43137519
answers question: http://stackoverflow.com/q/27330274
has body: This error is due to java.lang.ClassCastException: com.xx.activities.MainActivity$AdFragment cannot be cast to android.app.Fragment Change your fragment_ad.xml to be <?xml version="1.0" encoding="utf-8"?> <com.google.android.gms.ads.AdView android:id="@+id/adView" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerHorizontal="true" ads:adSize="BANNER" ads:adUnitId="@string/banner_ad_unit_id" /> And please see the full project source code. googleads-mobile-android-examples I can't add new comment Please post your layouts with it's names and your AndroidManifest.xml
type: Answer
downvote count: 1
score: -1
upvote count: 0

http://stackoverflow.com/q/27336380
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27336749
has answer: http://stackoverflow.com/a/27336760
tagged with: java
has title: Efficient solution to update a variable based on values of several variables
downvote count: 1
possible better answer: http://stackoverflow.com/a/27336749
type: Question
has answer: http://stackoverflow.com/a/27336959
accepted answer: http://stackoverflow.com/a/27336760
upvote count: 0
tagged with: callback
favorite count: 0
has body: I have an update method which gets called every time the screen refreshes itself. Inside this method I check the value of about about 50 objects to be zero. If all the values are zero I return a true else false is returned. This is how I have implemented and want to know if there is a better way to do it. public boolean update() { float totalVel = 0; for(int i=0; i&lt; this.numOfObjects; i++) { totalVel += BagOfWordsAverage[i]; } if(totalVel == 0) return true; return false; } Depending on the boolean value returned, the caller of the udpate function allows certain inputs from the user. So if False is returned, the user cannot tap on the screen but in the case of true the user is allowed to do whatever she wants. BagOfWordsAverage is a float array. I simply add the values of the entire array and check if the total is 0. No item in the array can take a negative value. Is there a better way to achieve what I want to achieve? The challenge is that if the number of objects increased to 5000 will my method scale? Since this is for an App, speed is very important.
tagged with: design-patterns
has answer: http://stackoverflow.com/a/27336876
answer count: 4
score: -1

http://stackoverflow.com/comment/43225127
type: Comment
comment on: http://stackoverflow.com/a/27387186
has text: Thank you for your help. I have another assignment that I can't finish. It says: make a program that asks the user to enter two numbers and an operation (+,-,/,*). Both entered numbers first multiply by 2 and then perform the operation with the entered numbers obtained after multiplication. Note: Use If, and static methods.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43144552
score: 0
type: Comment
has text: OK I tried a merge and it seems to work but when I get the output I see weird charters instead of the telephone numbers after the names .
comment on: http://stackoverflow.com/a/27335007
type: AnswerComment

http://stackoverflow.com/comment/43291924
score: 0
type: Comment
type: QuestionComment
has text: It better if I could figure out a method to generate group id base on exist group.
comment on: http://stackoverflow.com/q/27424659

http://stackoverflow.com/q/27321766
answer count: 0
type: UnansweredQuestion
type: Question
has title: spring boot multiple modules multiple property files @Propertysource not working
has body: I have 1 main project and 1 dependent project auditmodule. Auditmodule has its own datasource , and database properties are in auditapplication.properties. Main application has its own application.properties.Main project depends on audit project for auditing stuff. When I run my main application , it's not detecting auditapplication.properties in audit module. Below are the databaseconfiguration classes in main project and in audit project: Main project: @Configuration @EnableJpaRepositories(basePackages = "com.staples.mpe.repository", entityManagerFactoryRef = "mpeEntityManager", transactionManagerRef = "mpeTransactionManager") @EnableTransactionManagement public class DatabaseConfiguration implements EnvironmentAware {} Audit project: @Configuration @EnableJpaRepositories(basePackages = "com.staples.em.magnus.audit.repository", entityManagerFactoryRef = "auditEntityManager") @EnableTransactionManagement @PropertySource("classpath:auditapplication.properties") public class AuditDatabaseConfiguration implements EnvironmentAware { } I have mentioned @propertysource annotation on auditdatabaseconfiguration class, so when i run main project , it should not only detect application.properties in main project but should also detect auditapplication.properties in audit project. But its throwing error that it can't configure auditdatasource bean which is pulling the properties from auditapplication.properties. Any help is appreciated. Thanks
score: 0
has comment: http://stackoverflow.com/comment/43153069
tagged with: spring
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/43128707
tagged with: java

deserialization
type: Tag
tags question: http://stackoverflow.com/q/27423071
tags question: http://stackoverflow.com/q/27319850
tags question: http://stackoverflow.com/q/27413818
tags question: http://stackoverflow.com/q/27409808
tags question: http://stackoverflow.com/q/27341653
tags question: http://stackoverflow.com/q/27398578
tag name: deserialization
tags question: http://stackoverflow.com/q/27446065
tags question: http://stackoverflow.com/q/27351698

http://stackoverflow.com/comment/43097699
type: Comment
has text: Child panels sounds very smart. But how can I "add some layout code" to panel? I mean, it's the same panel, so how can I tell the buttonPanel to stay at the top and scroll to stay at the bottom?
type: AnswerComment
comment on: http://stackoverflow.com/a/27319044
score: 0

http://stackoverflow.com/comment/43232278
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27392389
has text: But the `shutdown()` call is **not** irrelevant, and your code needs it.

http://stackoverflow.com/q/27414017
has answer: http://stackoverflow.com/a/27414334
has comment: http://stackoverflow.com/comment/43272210
has comment: http://stackoverflow.com/comment/43272489
favorite count: 0
has comment: http://stackoverflow.com/comment/43272336
tagged with: jframe
type: UnansweredQuestion
downvote count: 2
tagged with: swing
tagged with: jbutton
tagged with: graphics
has comment: http://stackoverflow.com/comment/43272214
has comment: http://stackoverflow.com/comment/43272917
has comment: http://stackoverflow.com/comment/43272227
tagged with: java
has body: So I am making a simple tic tac toe game and ran into a problem at the last minute I am trying to draw a line at the win location but on the final win location(index), the line gets hidden behind the JButton not entirly sure why it is doing this. I know alot of people say do not use getGraphics(), and I am wondering if that is the source of my issues they say to override the paintComponent method but that is not working for me either I have attached a pic of what the result is looking like and code snips of how I am trying to perform these actions PS I am using a JFrame, if any more code is needed I will be glad to show it if(win[i] == 264){ // if one of the the combinations equal 'X','X','X' which equals 264, then there is a winner System.out.println("X is the winner!!!"); System.out.println("Game Over!"); number = i; draw(); }// call draw method private void draw(){ // drawing a line at winning location Graphics2D g1 = (Graphics2D) GUI.getFrame().getGraphics(); // declaring graphics on our Jframe Stroke stroke3 = new BasicStroke(12f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_MITER); // make our strokes cap off round if(number == 0){ // statements will determine the win location, so at win0, XXX, g1.setStroke(stroke3); // we will add stroke to our line g1.drawLine(0,104,500,104); // draw the line starting at the 0,104 and end it at coordinates 500,104 } here is a more runnable code, it is alot though import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.GridLayout; import java.awt.Stroke; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ButtonModel; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.border.Border; import javax.swing.border.LineBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; public class ti…
type: Question
has comment: http://stackoverflow.com/comment/43272145
has comment: http://stackoverflow.com/comment/43272133
has comment: http://stackoverflow.com/comment/43272449
has title: Can not complete drawline on JButton
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/43272349
answer count: 1
has comment: http://stackoverflow.com/comment/43272146
has comment: http://stackoverflow.com/comment/43272405

http://stackoverflow.com/comment/43239005
has text: Do you think it will work? I need to display GUI first. Then appending com data on textfield. With this current code comport () method excute first then it display the data all together.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27396231

http://stackoverflow.com/q/27361618
has comment: http://stackoverflow.com/comment/43175694
type: Question
has answer: http://stackoverflow.com/a/27361694
tagged with: xstream
has answer: http://stackoverflow.com/a/27361721
score: 0
has title: Java PrintWriter Writing to File
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/27361749
has body: package healthbuddy; /** * * @author tpzap_000 */ import java.io.*; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.io.xml.StaxDriver; import com.thoughtworks.xstream.persistence.FilePersistenceStrategy; import com.thoughtworks.xstream.persistence.PersistenceStrategy; import com.thoughtworks.xstream.persistence.XmlArrayList; import java.util.List; import java.util.Scanner; public class PersistentDataModelCntl implements Serializable{ private File theFile = new File("PDM.txt"); private XStream xstream = new XStream(new StaxDriver()); public static PersistentDataModelCntl thePDMCntl; private PersistentDataModel thePDM; public PersistentDataModelCntl(){ this.readPDMFile(); } public static PersistentDataModelCntl getPDMCntl(){ if(thePDMCntl == null){ thePDMCntl = new PersistentDataModelCntl(); } return thePDMCntl; } public void readPDMFile(){ try { System.out.println("in read file"); StringBuilder fileContents = new StringBuilder(); Scanner in = new Scanner(theFile); String tempXML; boolean test = in.hasNextLine(); System.out.println(test); while(in.hasNextLine()){ fileContents.append(in.nextLine()); System.out.println("reading file contents"); } tempXML = fileContents.toString(); thePDM = (PersistentDataModel)xstream.fromXML(tempXML); } //If the file does not exist, thePDM is instantiated to be a new, empty, PDM file. The file is then written to disk, and then read from disk // using some recursive stuff. Also creates a test UserList so that I don't get a NullPointerException in the LoginCntl. catch(FileNotFoundException ex){ System.out.println("FileNotFound"); thePDM = new PersistentDataModel(); thePDM.thePDMFoodList = new FoodList(); thePDM.thePDMMealList = new MealList(); thePDM.thePDMDietList = new DietList(); thePDM.thePDMDiet = new Diet(); //Creates new attributes if things are null. this.writePDMFile(); this.readPDMFile(); System.out.println("FileNotFound Exception"); } catch(IOException ex){ System.out.println("IO Exception"); ex.printS…
has answer: http://stackoverflow.com/a/27361720
answer count: 4
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43175873
tagged with: java
accepted answer: http://stackoverflow.com/a/27361720
possible better answer: http://stackoverflow.com/a/27361694

log-forging
type: Tag
tags question: http://stackoverflow.com/q/27397663
tag name: log-forging

http://stackoverflow.com/comment/43367562
score: 1
comment on: http://stackoverflow.com/q/27465281
type: QuestionComment
type: Comment
has text: Please show the Patient and Appointment entities with the relevant fields and relations.

http://stackoverflow.com/comment/43133804
type: Comment
comment on: http://stackoverflow.com/a/27336713
has text: @JonasHeidelberg I guess you can do it that way if you feel you have to; but the cleaner and simpler way, using just one loop, is far more similar to what Emma had originally.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43356045
score: 0
has text: Try to import as library.
type: AnswerComment
comment on: http://stackoverflow.com/a/27459630
type: Comment

http://stackoverflow.com/q/27466147
has comment: http://stackoverflow.com/comment/43368291
type: UnansweredQuestion
has title: Avoid overwritting constructor content
has answer: http://stackoverflow.com/a/27466180
tagged with: java
has comment: http://stackoverflow.com/comment/43368277
has comment: http://stackoverflow.com/comment/43368320
tagged with: methods
has comment: http://stackoverflow.com/comment/43368541
type: Question
score: -1
downvote count: 2
answer count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/43368266
has answer: http://stackoverflow.com/a/27466238
favorite count: 0
tagged with: getter-setter
tagged with: input
has body: so I have a program that ask(input) for stuff(variable int string etc..)and those elements are after that passed to the constructor.However, each time I input new values,previous are overwritten.How do I make it create a new one instead of overwritting the previous values?I am very new to Java and im kinda confuse.Heres my code: Scanner scan1 = new Scanner(System.in); //user input the name System.out.print("name: \n"); String name = scan1.nextLine(); and then pass it to the constructor: Balloon aballoon = new Balloon(name); my constructor looks like public Balloon(String name){ setName(name); and the method of it public String thename public void setName(String name){ if(name.matches("[a-zA-Z]+$")){ thename = name; } So yeah im wondering how to build multiple object(character) whitout overwritting the previous one,and how to store them(the character). thank you
tagged with: constructor

ssl
tags question: http://stackoverflow.com/q/27471222
tags question: http://stackoverflow.com/q/27350761
tags question: http://stackoverflow.com/q/27401956
tags question: http://stackoverflow.com/q/27327931
tags question: http://stackoverflow.com/q/27400357
tags question: http://stackoverflow.com/q/27450601
type: Tag
tags question: http://stackoverflow.com/q/27438034
tags question: http://stackoverflow.com/q/27421862
tags question: http://stackoverflow.com/q/27420006
tags question: http://stackoverflow.com/q/27362588
tags question: http://stackoverflow.com/q/27437262
tags question: http://stackoverflow.com/q/27388864
tags question: http://stackoverflow.com/q/27323858
tags question: http://stackoverflow.com/q/27473770
tags question: http://stackoverflow.com/q/27407834
tag name: ssl
tags question: http://stackoverflow.com/q/27370859
tags question: http://stackoverflow.com/q/27356440
tags question: http://stackoverflow.com/q/27324954
tags question: http://stackoverflow.com/q/27394621
tags question: http://stackoverflow.com/q/27393840
tags question: http://stackoverflow.com/q/27440450

http://stackoverflow.com/a/65343166
has body: I was trying to do some of these snippets code but most of them didn't work out for me. But @pushkars's code worked well, instead of making a while loop to get many objects, you can simply write and read a single List of objects and handle directly the list instead of reading or writing many objects. See the code of my static IOMannager class: public static class IOMannager { private static List<Produto> lista_produtos = new ArrayList<Produto>(); public static void ler() { ObjectInputStream in = null; try{ in = new ObjectInputStream(new FileInputStream("produtos.txt")); Object obj = in.readObject(); in.close(); lista_produtos = (ArrayList<Produto>) obj; } //catches goes here.... } } Now I have all objects into my List lista_produtos and can deal with them as I wish. Thanks @pushkars
score: 0
answers question: http://stackoverflow.com/q/27409718
has comment: http://stackoverflow.com/comment/122728430
type: Answer

http://stackoverflow.com/a/27463093
has comment: http://stackoverflow.com/comment/43372458
has body: Why not you do it here: @Override public void onSensorChanged(SensorEvent sensorEvent) { gravitySensor.setText("X: "+sensorEvent.values[0]+ "\nY: "+sensorEvent.values[1]+ "\nZ: "+sensorEvent.values[2]); if(sensorEvent.values[2] &gt; 9.5) { Toast.makeText(this, "Z value changed", Toast.LENGTH_SHORT).show(); } } I don't see any problem. To avoid multi-triggering: boolean isChanged = false; @Override public void onSensorChanged(SensorEvent sensorEvent) { gravitySensor.setText("X: "+sensorEvent.values[0]+ "\nY: "+sensorEvent.values[1]+ "\nZ: "+sensorEvent.values[2]); if(sensorEvent.values[2] &gt; 9.5 &amp;&amp; !isChanged) { Toast.makeText(this, "Z value changed", Toast.LENGTH_SHORT).show(); isChanged = true; } else /* if (something more clever)*/ { isChanged = false; } }
has comment: http://stackoverflow.com/comment/43372380
downvote count: 0
has comment: http://stackoverflow.com/comment/43362611
type: Answer
answers question: http://stackoverflow.com/q/27462991
score: 1
upvote count: 1

http://stackoverflow.com/q/27314651
type: Question
has title: Headerenricher Spring Integration and java dsl
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27317581
favorite count: 0
has body: I'me using Spring Integration and java dsl specifications to implement my IntegrationFlow. I want to use an custom header enricher to add some file names to the header, it will be something like : public class FileHeaderNamingEnricher { public Message&lt;File&gt; enrichHeader(Message&lt;File&gt; fileMessage) { // getting some details fom the database ... return messageBuilder .setHeader("filename", "somestuff") .build(); } } And my Integration flow will look like : public IntegrationFlow myflow() { return IntegrationFlows.from("input") .enrich // here I want to enrich the header using my class } Can any one help me with this please ?
tagged with: dsl
accepted answer: http://stackoverflow.com/a/27317581
tagged with: spring
type: AnsweredQuestion
score: 3
tagged with: spring-integration
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/43201562
type: Comment
type: QuestionComment
has text: As @JonK said, `;` immediately after `if` instructs the program to do nothing if the condition is true. In java `{` and `}` mark code blocks, and can be used almost anywhere to group some statements.
score: 0
comment on: http://stackoverflow.com/q/27375776

http://stackoverflow.com/q/27416413
has comment: http://stackoverflow.com/comment/43276625
has comment: http://stackoverflow.com/comment/43276560
score: 0
possible better answer: http://stackoverflow.com/a/27416754
has answer: http://stackoverflow.com/a/27416754
has answer: http://stackoverflow.com/a/27416576
accepted answer: http://stackoverflow.com/a/27416576
has body: I have a JSON structure like below. { "email":"abc.def@gmail.com", "mobile":9911776556, "customerLanguage":"English", "sms_flag":1, "ivr_flag":0, "dateOfBirth":"19-11-1981", "dateOfJoining":"08-10-2001" } Now i want to customize only dateOfBirth field, i have tried below but it changes both dateOfBirth and dateOfJoining. Gson jsonConvertor = new GsonBuilder().setDateFormat("dd/mm/yyyy").create(); TestJson userAuthenticationDTO = jsonConvertor.fromJson(request_body, TestJson.class); My TestJson class has below structure. TestJson --> class TestJson{ Date dateOfBirth; Date dateOfJoining; // other fields..... } TestJson object contains both date field modified ,i want only one to be modified?
has title: How to customize a specific date field in JSON using GSON API in Java?
type: AnsweredQuestion
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has comment: http://stackoverflow.com/comment/43276620
type: Question
answer count: 2

http://stackoverflow.com/comment/43257223
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27389346
has text: Thanks. That answer didn't actually help, because I'm using autogen classes from wsimport, but it told me what to google. This answer is what I ended up using: http://stackoverflow.com/a/7086636/2561658

http://stackoverflow.com/comment/43124562
comment on: http://stackoverflow.com/q/27333582
score: 0
type: Comment
has text: You should use Maven, Gradle or Ant+Ivy for dependency management. Then you don't have to worry about supplying the .jar files, because they will be supplied by the build manager.
type: QuestionComment

http://stackoverflow.com/comment/43376018
type: AnswerComment
has text: Thanks Invexity, but would it actually be possible to "simply put a copy of their exe or .jar into your startup folder." with Windows 7 and newer? I do remember seeing this type of thing on a friends computer in 2001 (result of porn surfing activity) but would it still be possible in today's systems without somehow asking the user to accept the download?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27466709

http://stackoverflow.com/comment/43377775
type: Comment
comment on: http://stackoverflow.com/a/27461896
score: 0
has text: Okay, I think I may have actually raised that many arrays, or maybe made them really huge. My entities go off the map briefly sometimes, and come back in rapidly, so that tile on the edge gets a spike of add/remove whenever a crowd of them is on the edge of screen. Additionally, I switched to LinkedList to alleviate the constant usage, looking at the grepcode, I think LinkedList is the solution, but I have noticed it clears 3000kb every 50k times this remove/add is called, unsure why. Thanks for the help.
type: AnswerComment

http://stackoverflow.com/a/29026948
has body: I had the same error and just now I fixed it! In root build.gradle type task wrapper(type: Wrapper) { gradleVersion = '2.2' } Also it can be useful to fix Gradle settings to recomended in the "Fix Gradle Settings" dialog. Or you can manually download gradle-2.2-all.zip, place it in {project_dir}-gradle-wrapper and run gradlew.bat in terminal.
downvote count: 0
score: 1
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/27375807

http://stackoverflow.com/comment/44019170
comment on: http://stackoverflow.com/q/27314068
has text: the following link has some samples https://github.com/youtube/api-samples
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27458401
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/27438429
answers question: http://stackoverflow.com/q/27438429
type: AcceptedAnswer
has body: Virtual memory allocation is mostly irrelevant (see for an explanation this answer) and very different from actual memory usage. The JVM is not designed to limit virtual memory allocation, see the question about limiting virtual memory usage. The end-user may see a lot of virtual memory usage in the task-manager, but that is mostly meaningless. The different numbers for memory usage shown in the Windows task manager are explained in this article. In summary: in the Windows task manager look at the "Memory (Private Working Set)" and "Page Fault Delta" (the relevance of the latter is explained in this answer).
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43360747

http://stackoverflow.com/a/27334743
answers question: http://stackoverflow.com/q/27334637
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: Thanks to Angad and zawhtut, I changed my web.xml to the following and it works! web.xml <?xml version="1.0" encoding="UTF-8"?> myproject Student Courses myprojectStudentCourses org.springframework.web.servlet.DispatcherServlet 1 myprojectStudentCourses /

http://stackoverflow.com/comment/43120928
type: QuestionComment
has text: I wouldn't do parallel requests, at best it will simply saturate your net connection. At worst, it will get you banned from the other site. You should run the connections serially and process the data in parallel - a classic producer consumer pattern.
score: 0
comment on: http://stackoverflow.com/q/27331486
type: Comment

arraylist
tags question: http://stackoverflow.com/q/27458597
tags question: http://stackoverflow.com/q/27407063
tags question: http://stackoverflow.com/q/27401941
tags question: http://stackoverflow.com/q/27452900
tags question: http://stackoverflow.com/q/27442402
tags question: http://stackoverflow.com/q/27338962
tags question: http://stackoverflow.com/q/27350398
tags question: http://stackoverflow.com/q/27418320
tags question: http://stackoverflow.com/q/27390392
tags question: http://stackoverflow.com/q/27347715
tags question: http://stackoverflow.com/q/27391361
tags question: http://stackoverflow.com/q/27336681
tags question: http://stackoverflow.com/q/27425348
tags question: http://stackoverflow.com/q/27376071
tags question: http://stackoverflow.com/q/27335417
tags question: http://stackoverflow.com/q/27383810
tags question: http://stackoverflow.com/q/27359030
tags question: http://stackoverflow.com/q/27325368
tags question: http://stackoverflow.com/q/27342151
tags question: http://stackoverflow.com/q/27474634
tags question: http://stackoverflow.com/q/27327404
tags question: http://stackoverflow.com/q/27387702
tags question: http://stackoverflow.com/q/27467236
tags question: http://stackoverflow.com/q/27370398
tags question: http://stackoverflow.com/q/27317421
tags question: http://stackoverflow.com/q/27456036
tags question: http://stackoverflow.com/q/27413678
tags question: http://stackoverflow.com/q/27465670
tags question: http://stackoverflow.com/q/27458973
tags question: http://stackoverflow.com/q/27415852
tags question: http://stackoverflow.com/q/27361711
tags question: http://stackoverflow.com/q/27462160
tags question: http://stackoverflow.com/q/27470665
tags question: http://stackoverflow.com/q/27447706
tags question: http://stackoverflow.com/q/27410182
tags question: http://stackoverflow.com/q/27463839
tags question: http://stackoverflow.com/q/27461443
tags question: http://stackoverflow.com/q/27326226
tags question: http://stackoverflow.com/q/27368636
tags question: http://stackoverflow.com/q/27466476
tags question: http://stackoverflow.com/q/27462988
tags question: http://stackoverflow.com/q/27471784
tags question: http://stackoverflow.com/q/27397114
tags question: http://stackoverflow.com/q/27326387
tags question: http://stackoverflow.com/q/27463810
tags question: http://stackoverflow.com/q/27338768
tags question: http://stackoverflow.com/q/27333797
tags question: http://stackoverflow.com/q/27401426
tags question: http://stackoverflow.com/q/27338358
tags question: http://stackoverflow.com/q/27339096
tags question: http://stackoverflow.com/q/27340729
tags question: http://stackoverflow.com/q/27413940
tags question: http://stackoverflow.com/q/27369512
tags question: http://stackoverflow.com/q/27437790
tags question: http://stackoverflow.com/q/27346855
tags question: http://stackoverflow.com/q/27367258
tags question: http://stackoverflow.com/q/27451933
tags question: http://stackoverflow.com/q/27431162
tags question: http://stackoverflow.com/q/27370081
tags question: http://stackoverflow.com/q/27400485
tags question: http://stackoverflow.com/q/27361544
tags question: http://stackoverflow.com/q/27393488
tags question: http://stackoverflow.com/q/27458251
tags question: http://stackoverflow.com/q/27414933
tags question: http://stackoverflow.com/q/27390485
tags question: http://stackoverflow.com/q/27471861
tags question: http://stackoverflow.com/q/27352681
tags question: http://stackoverflow.com/q/27382305
tags question: http://stackoverflow.com/q/27474505
tags question: http://stackoverflow.com/q/27319139
tags question: http://stackoverflow.com/q/27443823
tags question: http://stackoverflow.com/q/27458027
tags question: http://stackoverflow.com/q/27350827
tags question: http://stackoverflow.com/q/27418899
tags question: http://stackoverflow.com/q/27459081
tags question: http://stackoverflow.com/q/27319776
tags question: http://stackoverflow.com/q/27392251
tags question: http://stackoverflow.com/q/27462884
tags question: http://stackoverflow.com/q/27410803
tags question: http://stackoverflow.com/q/27321179

http://stackoverflow.com/comment/43308339
score: 0
type: Comment
type: QuestionComment
has text: @lexicore - Because Prof Kabutz has it all there.
comment on: http://stackoverflow.com/q/27433291

http://stackoverflow.com/comment/43176423
score: 0
has text: @RockOnRockOut That helps, but it is still not changing the number of men. What I'm doing is writing a while loop that runs until 20 weeks has passed. And in that loop i print the to string method and then call the add men method. It just gives me the same amount of men each time.
comment on: http://stackoverflow.com/a/27361457
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27469668
tagged with: java
possible better answer: http://stackoverflow.com/a/27472106
has answer: http://stackoverflow.com/a/27472106
type: Question
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/27474788
favorite count: 0
has body: I'm starting using java 8 stream API. I would like to convert a list of "sql result set" to domain objects, i.e composite structure. Domain objects : a user has a collection of permissions, each permission has a collection of year of applications. For example, John has 2 permissions (MODERATOR and DEV). its moderator permission is only applicable for 2014 and 2015 its dev permission of only applicable for 2014. class User { // some primitives attributes List&lt;Permission&gt; permission; } class Permission { // some primitives attributes List&lt;Integer&gt; years; } Now I make a query and got a list of flat results, something like: [1, "moderator", 2014] [1, "moderator", 2015] [1, "dev", 2014] [2, "dev", 2010] [2, "dev", 2011] [2, "dev", 2012] The 1 and 2 are userId. I tried various construction but at the end it's more complex than fluent. And didn't work :) I read in a Java 8 book that it's "simple" to build dompain objects with collectors. I cried a little when I read that :'( I tried sb.collect( collectingAndThen( groupingBy( Mybean::getUserId, collectingAndThen( groupingBy(Monbean::getPermissionId, mapping(convertPermission, toList())), finisherFonction) ), convertUser) ); and got one hell of generics compilation failure. what's the best way to construct multi level composite domain objects using java 8 streams ? is collectionAndThen / finisher a good idea? or do you use only groupingBy followed by a mapping function? do you transform the classifier to an object (sort of first level mapping function?) Because at the end I want to get rid of the Map and got a List&lt;User&gt; result (I think I can add a map call on the entrySet to finish the transformation).
has comment: http://stackoverflow.com/comment/43389447
upvote count: 6
tagged with: java-stream
score: 6
tagged with: java-8
has answer: http://stackoverflow.com/a/27474788
type: AnsweredQuestion
tagged with: collectors
has title: Java 8 Streams : build multilevel / composite objects

http://stackoverflow.com/comment/43114210
type: QuestionComment
comment on: http://stackoverflow.com/q/27327489
has text: RGB values are numerical...
score: 0
type: Comment

http://stackoverflow.com/q/27448581
has title: Method chaining in python like in java?
has comment: http://stackoverflow.com/comment/43335954
downvote count: 1
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/43335997
has comment: http://stackoverflow.com/comment/43335975
has comment: http://stackoverflow.com/comment/43336040
has answer: http://stackoverflow.com/a/27448618
has answer: http://stackoverflow.com/a/27448637
type: UnansweredQuestion
tagged with: python
has comment: http://stackoverflow.com/comment/43336055
has body: I vaguely remember from my days of Minecraft modding that in java, you can set multiple class variables in one line, like this: SomeBlock.hardness(0.5).isOpaque(True).blastResistance(2).etc.etc Well I was wondering if there was a way to do something similar in python. I have tried doing the same thing in python, but the second one ends up thinking it is supposed to modify the return of the first one instead of the original class. Is there a way to do this?
score: 1
tagged with: java
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/27475776

list
tags question: http://stackoverflow.com/q/27349444
type: Tag
tags question: http://stackoverflow.com/q/27321435
tags question: http://stackoverflow.com/q/27410241
tags question: http://stackoverflow.com/q/27326576
tags question: http://stackoverflow.com/q/27331301
tags question: http://stackoverflow.com/q/27439089
tags question: http://stackoverflow.com/q/27389561
tags question: http://stackoverflow.com/q/27350515
tags question: http://stackoverflow.com/q/27373401
tags question: http://stackoverflow.com/q/27328527
tags question: http://stackoverflow.com/q/27384678
tag name: list
tags question: http://stackoverflow.com/q/27350722
tags question: http://stackoverflow.com/q/27416457
tags question: http://stackoverflow.com/q/27418559
tags question: http://stackoverflow.com/q/27351474
tags question: http://stackoverflow.com/q/27314977
tags question: http://stackoverflow.com/q/27316356
tags question: http://stackoverflow.com/q/27375213
tags question: http://stackoverflow.com/q/27464781
tags question: http://stackoverflow.com/q/27361544
tags question: http://stackoverflow.com/q/27424514
tags question: http://stackoverflow.com/q/27352496
tags question: http://stackoverflow.com/q/27409287
tags question: http://stackoverflow.com/q/27463839
tags question: http://stackoverflow.com/q/27340729
tags question: http://stackoverflow.com/q/27344738
tags question: http://stackoverflow.com/q/27437790
tags question: http://stackoverflow.com/q/27352497
tags question: http://stackoverflow.com/q/27458251
tags question: http://stackoverflow.com/q/27354481
tags question: http://stackoverflow.com/q/27335786
tags question: http://stackoverflow.com/q/27352589

http://stackoverflow.com/comment/43342096
comment on: http://stackoverflow.com/q/27450043
has text: Yes, example: class session, class path, class configs, class roads, etc etc, in the core use vars: this.session = new Session(), etc etc, for example call from activity: this.core.session.login(user, pass); if(this.core.session.errors.has()){ ... the errors is a class Errors with The List<Error> class.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43244405
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27399498
type: QuestionComment
has text: one horizontal and one vertical - what do you want to do with empty space, because description (one horizontal and one vertical) talking about 3rd. and empty area

http://stackoverflow.com/a/27325609
answers question: http://stackoverflow.com/q/27325536
has body: I just found the answer here. You need a job object to access the counters: Counters counters = job.getCounters(); Counter counter = counters.findCounter(MyCountersEnum.SomeCounter); System.out.println(counter.getDisplayName() + ": " + counter.getValue());
type: Answer
score: 3
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27325536
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27382361
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27382259
has body: You can "safely" remove it in that it is not used at runtime. Personally I use it for extracting metadata from a jar and I would not be surprised other tools do as well but that has nothing to do with actually running the code. Disclaimer: I do have a custom classloader that uses this information to dynamically load dependencies

http://stackoverflow.com/comment/43367523
type: Comment
type: QuestionComment
has text: I don't know the reason for the downvote, but it seems that the OP didn't just try it.
score: 0
comment on: http://stackoverflow.com/q/27465648

http://stackoverflow.com/comment/43212519
score: 0
has text: Don't use indexing as part of the iteration as you are removing from the list and changing `i` when selecting `arrayList.get(i)`
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27381849

http://stackoverflow.com/a/27413237
has body: You can't use variable name as type of any method that has to passed as parameter. Else it will give compilation error.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27413112

http://stackoverflow.com/comment/43262864
type: QuestionComment
comment on: http://stackoverflow.com/q/27407987
score: 0
has text: also, thank you @EpicPandaForce for the edit
type: Comment

http://stackoverflow.com/q/27431515
has answer: http://stackoverflow.com/a/27459040
type: Question
tagged with: java
accepted answer: http://stackoverflow.com/a/27459040
answer count: 1
downvote count: 0
favorite count: 0
has body: How to I programmatically properly exit a NetBeans Platform application when the TopComponent has been declared in an XML file?
type: AnsweredQuestion
tagged with: netbeans
score: 2
has title: How do I exit a NetBeans Platform GUI application?
upvote count: 2

http://stackoverflow.com/comment/43302733
type: Comment
comment on: http://stackoverflow.com/a/27428696
has text: As you can also see in the Spring-Data documentation, it is only using interfaces and creating the implementations automatically.
score: 1
type: AnswerComment

http://stackoverflow.com/q/27336725
tagged with: poker
has answer: http://stackoverflow.com/a/27336770
type: Question
answer count: 2
tagged with: arrays
downvote count: 0
accepted answer: http://stackoverflow.com/a/27336770
score: 1
has body: I'm working on a poker project that just deals the 5 top cards from a shuffled deck and lets the user to reject all, some, or none. I understand that there should be ideally 2-3 classes, one with the actual main and the other two being the card and deck. I have created the Deck class and a very basic Tester program that is just supposed to print the shuffled cards. However, when I print the deck, I get something along the lines of "Deck@###d##a". What am I doing wrong? import java.util.Random; public class Deck { // Constructing a deck from two arrays String[] suit = { "Clubs", "Diamonds", "Hearts", "Spades" }; String[] rank = { "Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King" }; String[] deck = new String[suit.length * rank.length]; // Storing public variables int suits = suit.length; int ranks = rank.length; int deckSize = deck.length; public Deck() { for(int i = 0; i &lt; suits; i++) { for(int j = 0; j &lt; ranks; j++) { deck[ranks*i + j] = rank[j] + " of " + suit[i]; } } } // Fisher-Yates Shuffle public void shuffle() { Random rand = new Random(); for (int i = 0; i &lt; deckSize; i++) { int x = rand.nextInt(deckSize); String temp = deck[x]; deck[x] = deck[i]; deck[i] = temp; } } } And the tester class: import java.util.Scanner; public class DeckTester { public static void main(String[] args) { Deck deck = new Deck(); System.out.println(deck); } } Output: Deck@###d###a
favorite count: 0
has title: Basic Poker Program - Printing Deck
has comment: http://stackoverflow.com/comment/43130172
has comment: http://stackoverflow.com/comment/43177348
possible better answer: http://stackoverflow.com/a/27336806
has answer: http://stackoverflow.com/a/27336806
upvote count: 1
tagged with: unit-testing
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/q/27346126
tagged with: nullpointerexception
has comment: http://stackoverflow.com/comment/43147340
tagged with: android
has answer: http://stackoverflow.com/a/27346144
answer count: 4
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27346167
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/43147576
type: Question
has comment: http://stackoverflow.com/comment/43147329
linked to: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/27346187
has answer: http://stackoverflow.com/a/27346167
tagged with: java
has body: I have an issue I need help with. I am running into a NullPointerException no matter what I do with this app, and at this point it is seriously holding up this project. I have reviewed the logcat multiple times, made changes and re run the app and every time it turns out a nullpointerexception. For the life of me I can't seem to figure out what is causing it. Can someone point out where it is, and if possible, why it occurred since as far as I can tell I have everything assigned a value. GameStart.java: package com.saphiric.simproject; import android.app.Activity; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.TextView; /** * Created by Saphiric on 11/12/14. */ public class GameStart extends Activity { /** * Necessary activity variables */ int clickCount = 0; TextView storyText; Button advanceGame; DecisionFragment decisionFragment; ControlsFragment controlsFragment; public View.OnClickListener decisionTime = new View.OnClickListener(){ public void onClick(View v) { clickCount = clickCount + 1; // Increments clickCount by 1 per click // /** // * Will handle checking how far into the story the player is // * and update components as necessary. // */ // switch (clickCount) { // case 1: // storyText.setText(R.string.story_opening_two); // break; // // case 2: // FragmentTransaction decisionTime = fragmentManager.beginTransaction(); // // Replace the fragment currently inside of the fragmentContainer // decisionTime.replace(R.id.fragmentContainer, decisionFragment); // decisionTime.commit(); // break; // // default: // System.out.println("An error occurred"); // } // System.out.println(clickCount); } }; /** * Android activity methods * @param savedInstanceState is the apps savedInstanceState */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_game_start); // UI…
possible better answer: http://stackoverflow.com/a/27346144
score: -1
has title: I can't find this NullPointerException
downvote count: 2
upvote count: 1
has comment: http://stackoverflow.com/comment/43147336
has comment: http://stackoverflow.com/comment/43147313
favorite count: 0
has answer: http://stackoverflow.com/a/27346198

http://stackoverflow.com/comment/43204672
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27374624
has text: Just putting autowired doesn't work becouse the number is not a spring managed property/bean. Using getBean(..) would work but this way the caller would have an unnecessary dependency for B for the sole purpose of using A. Making a factory can be a solution, I never thought about it. If I won't find any way without creating a separate class I go with the factory, thanks.
type: Comment

http://stackoverflow.com/q/27355230
upvote count: 3
possible better answer: http://stackoverflow.com/a/27355275
has title: How does lazy initialization happen in Singleton?
type: Question
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/43163307
has answer: http://stackoverflow.com/a/27355253
linked to: http://stackoverflow.com/q/16106260
tagged with: lazy-initialization
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43163343
answer count: 3
has comment: http://stackoverflow.com/comment/43163414
has answer: http://stackoverflow.com/a/27355328
has answer: http://stackoverflow.com/a/27355275
accepted answer: http://stackoverflow.com/a/27355253
type: AnsweredQuestion
has body: Can anyone explain how does lazy initialization happen in the following singleton pattern code? public class Singleton { private static Singleton INSTANCE = null; private Singleton() {} public static Singleton getInstance() { if (INSTANCE == null) INSTANCE = new Singleton(); return INSTANCE; } }

http://stackoverflow.com/q/27438591
accepted answer: http://stackoverflow.com/a/27465633
tagged with: apache-spark
score: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/27438800
has answer: http://stackoverflow.com/a/27438800
answer count: 4
type: AnsweredQuestion
tagged with: accumulator
has title: Are accumulators thread-safe?
has answer: http://stackoverflow.com/a/36786741
has body: I'm using accumulators and wanted to know if these objects are thread-safe? accumInt is a type of AccumulatorParam&lt;Integer&gt;. // Current value accumInt -&gt; 6 AccumulatorThread t1 = new AccumulatorThread(); t1.setAccum(accumInt); t1.setValueToAdd(5); AccumulatorThread t2 = new AccumulatorThread(); t2.setAccum(accumInt); t2.setValueToAdd(7); new Thread(t1).start(); new Thread(t2).start(); System.out.println(accumInt.value()); // 11 or 13 or 18 AccumlatorThread class: class AccumulatorThread implements Runnable { Accumulator&lt;Integer&gt; accum; Integer valueToAdd; public Integer getValueToAdd() { return valueToAdd; } public void setValueToAdd(Integer valueToAdd) { this.valueToAdd = valueToAdd; } public Accumulator&lt;Integer&gt; getAccum() { return accum; } public void setAccum(Accumulator&lt;Integer&gt; accum) { this.accum = accum; } public void run() { System.out.println("Value to Add in Thread : "+valueToAdd); accum.add(valueToAdd); } } The behavior shows that it is not a thread safe. Am I missing something?
upvote count: 2
has answer: http://stackoverflow.com/a/27465633
tagged with: multithreading
type: Question
tagged with: java
tagged with: thread-safety
has answer: http://stackoverflow.com/a/43912747

http://stackoverflow.com/comment/43217073
type: QuestionComment
score: 5
has text: I prefer `return condition ? string1 : string2;`.
comment on: http://stackoverflow.com/q/27384191
type: Comment

http://stackoverflow.com/comment/43402513
type: AnswerComment
type: Comment
has text: Yes, this works. Thanks a bunch. :-) I couldn't find out how the main window was starting up. Turns out NetBeans magic was starting it. I was looking so I could see how it got shut down when someone clicked the X, but didn't find it.
comment on: http://stackoverflow.com/a/27459040
score: 0

http://stackoverflow.com/comment/43139855
type: Comment
comment on: http://stackoverflow.com/q/27342056
score: 1
has text: You might want to use the **same** EditText. Just add a CheckBox to set the "variant". Or you can use 2 RadioButtons to make the choice even clearer. Depending on the user choice, you'll process the input in `a slightly different` way
type: QuestionComment

http://stackoverflow.com/q/27459510
has title: GUI doesn't appear in IntelliJ IDEA
has answer: http://stackoverflow.com/a/27459554
tagged with: jframe
type: UnansweredQuestion
upvote count: 1
tagged with: swing
answer count: 4
score: 1
tagged with: java
type: Question
tagged with: intellij-idea
has answer: http://stackoverflow.com/a/27460138
has answer: http://stackoverflow.com/a/27459820
has answer: http://stackoverflow.com/a/30961281
tagged with: user-interface
downvote count: 0
has body: I'm learning Java along with IntelliJ IDEA. I want to try the Celsius converter explained in Oracle tutorial so I did the following steps: Created a new GUI form. Created a class called CelsiusConverterGUI. It says that the form is automatically bind to the CelsiusConverterGUI.java. Below is the CelsiusConverterGUI class declaration: import javax.swing.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class CelsiusConverterGUI extends Frame{ private JTextField celsiusDegree; private JButton convertButton; private JLabel fahrenheitDeg; private JPanel panel; public CelsiusConverterGUI(){ setVisible(true); convertButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int fahrDegree = (int)(Double.parseDouble(celsiusDegree.getText())); fahrenheitDeg.setText(fahrDegree+"Fahrenheit"); } }); } public static void main(String[] args){ new CelsiusConverterGUI(); } } When I run it, a Java application window pops up hodling only the menu bar default icons (x - +), and doesn't show the panel or buttons I created in the GUI form. Can anyone explain why does it behave so?
favorite count: 0

http://stackoverflow.com/comment/43333179
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27330176
type: AnswerComment
has text: I succeeded finally in deleting and editing rows from my JTable and database :). I'll post the code. I'll focus on adding messages of control later. Thank you so much.

http://stackoverflow.com/comment/43295209
score: 0
type: AnswerComment
has text: @yaromir The kind of mocking I meant is completely general: it applies equally (using the same mocking API) to interfaces, abstract classes, concrete classes, final classes, enums, etc. In the case of mocking a class, no subclass needs to be created, as that is just one particular technique.
comment on: http://stackoverflow.com/a/27409302
type: Comment

http://stackoverflow.com/a/27474022
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27466447
type: Answer
has body: Try this, in your case you should use it like that: String str=((SoapObject)result.getProperty(0)).getProperty(i).toString();
accepted answer of: http://stackoverflow.com/q/27466447

http://stackoverflow.com/a/27428047
has comment: http://stackoverflow.com/comment/43298772
score: 1
has comment: http://stackoverflow.com/comment/43299580
has comment: http://stackoverflow.com/comment/43298636
has comment: http://stackoverflow.com/comment/43300769
has comment: http://stackoverflow.com/comment/43298090
has body: You're getting the default Object.toString() because array (and array is an Object) doesn't override toString(). You could use Arrays.toString(Object[]) like value="&lt;%=java.util.Arrays.toString(fibSequence)%&gt;" Or add the import for java.util.Arrays to your JSP.
downvote count: 0
has comment: http://stackoverflow.com/comment/43300665
has comment: http://stackoverflow.com/comment/43298544
answers question: http://stackoverflow.com/q/27427981
type: Answer
has comment: http://stackoverflow.com/comment/43299601
has comment: http://stackoverflow.com/comment/43298860
has comment: http://stackoverflow.com/comment/43298057
has comment: http://stackoverflow.com/comment/43300842
upvote count: 1

http://stackoverflow.com/q/27327371
has title: Singly Linked List Delete Value
tagged with: linked-list
type: UnansweredQuestion
downvote count: 2
has answer: http://stackoverflow.com/a/27327454
tagged with: java
has comment: http://stackoverflow.com/comment/43113810
score: -1
tagged with: nodes
type: Question
answer count: 2
upvote count: 1
tagged with: data-structures
favorite count: 0
has answer: http://stackoverflow.com/a/31674338
has body: I am making a singly linked list where I need to put a delete method but getting error any help? public void remove(int index) { getNode(index - 1).Next = getNode(index + 1); }

client-server
tags question: http://stackoverflow.com/q/27400682
tags question: http://stackoverflow.com/q/27440408
tags question: http://stackoverflow.com/q/27391401
type: Tag
tags question: http://stackoverflow.com/q/27473144
tag name: client-server
tags question: http://stackoverflow.com/q/27354971
tags question: http://stackoverflow.com/q/27402968
tags question: http://stackoverflow.com/q/27353502

http://stackoverflow.com/comment/43235009
type: QuestionComment
comment on: http://stackoverflow.com/q/27393969
has text: Should you be doing `new CopperTest()` then?
score: 0
type: Comment

http://stackoverflow.com/comment/43197197
comment on: http://stackoverflow.com/q/27373152
type: QuestionComment
has text: What is at UsbPermissionActivity.java:148 ?
score: 0
type: Comment

http://stackoverflow.com/comment/43212402
has text: Ok thank you, but now I have another problem : could not instantiate cacheprovider ...
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27380435

http://stackoverflow.com/comment/43266707
comment on: http://stackoverflow.com/q/27411148
score: 0
type: Comment
type: QuestionComment
has text: You need make sure your SomeEntity is indeed JSON serializable (say,via JAXB impl)

http://stackoverflow.com/q/27368035
upvote count: 1
tagged with: java
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43188473
has body: I created a simple android app with list view. The app works fine in my tablet and phone but as I uploaded the app in google play, people reported with this error and I couldnot figure out what's wrong with my code. It has a splash screen. A main page screen with list view and a individual web view. I tried to debug the code but as I am new I couldnot figure which part of my code is generating exception. Any help or suggestion is highly appreciated This is my main activity which has a lis public class MainActivity extends Activity { public final static String DIRECTORY_NAME = "com.example.DIRECTORY_NAME"; public final static String FILE_NAME = "com.example.FILE_NAME"; String directory; // save the sub folder which user chose Intent toViewer; ListView listView; ArrayAdapter&lt;String&gt; adapter; EditText inputSearch; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.list_view); toViewer = new Intent(this, ViewerActivity.class); listView = (ListView)findViewById(R.id.listView); inputSearch = (EditText) findViewById(R.id.inputSearch); ArrayList&lt;String&gt; files = new ArrayList&lt;String&gt;(); AssetManager assetManager = this.getAssets(); // used to get list of files in asset String[] fileNames; // store all file names directory= "Questions"; // get all pdf files from chosen directory try { fileNames = assetManager.list(directory); directory += "/"; for (int i = 0; i &lt; fileNames.length; i++) { String fileName = fileNames[i].toString(); fileName = this.RemoveFileExtension(fileName); fileName = fileName.replace("_", " "); files.add(fileName); } } catch (IOException e1) { } // show all chosen PDF file on the list view Comparator&lt;String&gt; normalSort = new Comparator&lt;String&gt;() { public int compare(String lhs, String rhs) { return lhs.compareTo(rhs); } }; Comparator&lt;String&gt; inverseSort = new Comparator&lt;String&gt;() { public int compare(String lhs, String rhs) { return rhs.compareTo(lhs); }…
has comment: http://stackoverflow.com/comment/43188296
downvote count: 0
answer count: 0
score: 1
favorite count: 0
has title: java.lang.RuntimeException: Unable to start activity ComponentInfo java.lang.java.lang.NullPointerException
type: Question
tagged with: android

http://stackoverflow.com/q/27350500
tagged with: polymer
has title: I am looking for some help to use Polymer with server side Scala/java using Play framework
has comment: http://stackoverflow.com/comment/43313549
has comment: http://stackoverflow.com/comment/43288830
has body: I am trying to experiment with Polymer in my scala project with Play framework. I followed the getting started at https://www.polymer-project.org/docs/start/creatingelements.html. In my index.scala.html I have included my-element.html and trying to access my-element. I am not seeing my contents in element as expected. Any suggestions about if what I am trying to do is feasible. Thank you in advance On Mac, created a play-java app in IntelliJ. Installed latest play framework 2.3.7 from https://www.playframework.com/download. Extracted zip file and ran the activator command activator new to create new project Opened Intellij IDEA and imported the new project Ran project by activator run Code attached below... octo-element.html: Hello from octo-element. This is my Shadow DOM. index.scala.html @(message: String) @main("Welcome to Play") { @message } main.scala.html @(title: String)(content: Html) @title @content Application.java package controllers; import play.mvc.Controller; import play.mvc.Result; import views.html.index; public class Application extends Controller { public static Result index() { return ok(index.render("Your new application is ready.")); } }
tagged with: playframework
upvote count: 1
answer count: 1
favorite count: 0
tagged with: scala
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27455325
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43155622
type: Question

http://stackoverflow.com/comment/43310703
comment on: http://stackoverflow.com/q/27434893
type: Comment
type: QuestionComment
has text: Can you show a sample file name of the Images?
score: 2

http://stackoverflow.com/comment/43151314
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27348333
has text: But, the String is for example: `max(YX,X)=YX;max(s(Y))=Y0;max(0,X)=0X;` and had created before the cleaning. I need to clean up after that to generate (for example): `max(Y,X)=X;max(s(Y))=Y;max(0,X)=0;`
type: AnswerComment

http://stackoverflow.com/q/27369145
tagged with: enums
has answer: http://stackoverflow.com/a/27437085
has answer: http://stackoverflow.com/a/27369480
score: 0
answer count: 3
has title: where best to define enumerations java?
has body: Is there a "best practice" for the place at which an enum should be defined in java? One option is to have a separate .java file for each enum, and any class that uses that enum can include it. example: Direction.java: public enum Direction { INPUT, OUTPUT, UNKNOWN } Type.java public enum Type{ DATA, VALID, READY, UNKNOWN } Another option is to have one big file with all the enums in my application, and if a class uses any of the enums, it will have to include that big file. example: MyEnums.java public class MyEnums{ public enum Direction { INPUT, OUTPUT, UNKNOWN } public enum Type{ DATA, VALID, READY, UNKNOWN } } Which of the two options is better, both in terms of performance and code portability/extensibility? or is it a matter of choice and there is no one better option? What is the best way to define enumerations in Java?
favorite count: 0
accepted answer: http://stackoverflow.com/a/27369480
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/27369389
upvote count: 1
has answer: http://stackoverflow.com/a/27369389
downvote count: 1
type: Question

http://stackoverflow.com/comment/43217528
has text: Then use an array of size 25 and check the number of grades inserted previously to insert a new one.
comment on: http://stackoverflow.com/a/27381132
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27454366
has comment: http://stackoverflow.com/comment/43347000
score: 0
has comment: http://stackoverflow.com/comment/43347607
has comment: http://stackoverflow.com/comment/43347144
has comment: http://stackoverflow.com/comment/43346876
answers question: http://stackoverflow.com/q/27454000
has body: Until you call the method getWritableDatabase() or getReadableDatabase() of SQLiteOpenHelper class, database won't be created. What you can do is store a variable field SQLiteDatabase db; and then in the constructor call db = db.getWriteableDatabase()/readable(); I think this will solve your problem :) Edit: Try this: private SQLiteDatabase db; public DatabaseHandler(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } public void open(){ db = getWritableDatabase(); } And then do something like this: DatabaseHandler dh = new DatabaseHandler(); dh.open() If this still doesn't work, try https://www.google.se/?gws_rd=ssl#q=android+sqlite+oncreate+not+called Good luck!
has comment: http://stackoverflow.com/comment/43347031
has comment: http://stackoverflow.com/comment/43346929
type: Answer

training-data
tags question: http://stackoverflow.com/q/27353575
type: Tag
tag name: training-data

http://stackoverflow.com/q/27424409
upvote count: 1
type: AnsweredQuestion
has body: Experiencing concurrency issues when authenticating and other read requests with Open LDAP (version tested 2.3.43 and 2.4.39) When making 100 concurrent bind requests the test code takes around 150 milliseconds. Increasing this to 1000 concurrent requests sees the time taken increase to 9303 milliseconds. So from x10 concurrent requests we are seeing a x62 increase in time taken. Is this expected behaviour? Or is there something missing in our OpenLDAP server configuration/linux host configuration? NOTE: We have run this test code against a Windows based Apache DS server 2.0.0 (same tree structure, etc) for comparison and against that server, the performance results where what we would normally expect (i.e. 100x takes ~80ms, 1000x takes ~400ms, 10,000x takes ~2700ms) Settings in slapd.conf: cachesize 100000 idlcachesize 300000 database bdb suffix "dc=company,dc=com" rootdn "uid=admin,ou=system" rootpw secret directory /var/lib/ldap index objectClass eq,pres index ou,cn,mail,surname,givenname eq,pres,sub index uidNumber,gidNumber,loginShell eq,pres index uid,memberUid eq,pres,sub index nisMapName,nisMapEntry eq,pres,sub sizelimit 100000 loglevel 256 Test code: import java.util.ArrayList; import javax.naming.NamingException; import javax.naming.directory.DirContext; import org.springframework.ldap.core.LdapTemplate; import org.springframework.ldap.core.support.LdapContextSource; public class DirectoryServiceMain { public static void main(String[] args) { int concurrentThreadCount = 100; LdapContextSource ctx = new LdapContextSource(); ctx.setUrls(new String [] { "ldap://ldap1.dev.company.com:389/", "ldap://ldap1.dev.company.com:389/" }); ctx.setBase("dc=company,dc=com"); ctx.setUserDn("uid=admin,ou=system"); ctx.setPassword("secret"); ctx.setPooled(true); ctx.setCacheEnvironmentProperties(false); LdapTemplate template = new LdapTemplate(); template.setContextSource(ctx); long startTime = System.currentTimeMillis(); ArrayList&lt;Thread&gt; threads = new ArrayList&lt;&g…
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27445730
type: Question
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/27445730
favorite count: 0
has comment: http://stackoverflow.com/comment/43305749
has title: OpenLDAP 2.3/2.4 concurrency issue
tagged with: ldap
tagged with: linux
tagged with: openldap

http://stackoverflow.com/a/27386096
has comment: http://stackoverflow.com/comment/43220567
upvote count: 1
has comment: http://stackoverflow.com/comment/43220495
has comment: http://stackoverflow.com/comment/43220525
downvote count: 0
answers question: http://stackoverflow.com/q/27386015
has comment: http://stackoverflow.com/comment/43220509
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27386015
has body: I won't give you full solution, however, it'll be helpful if you pay attention to: int division as you said, does your loop terminate? Is someone changing i? Hint: No, and how do you ask for input? Do you see any loops there? Why it's asking you for only one input? Not an error, but pay attention to Java Naming Conventions, class name should begin with upper case
type: Answer
score: 1

http://stackoverflow.com/a/27390795
upvote count: 1
downvote count: 0
type: Answer
has body: All variables of type List&lt;WebElement&gt; (and any class type in java) are references. When you say divElements = driver.findElements(By.tagName("div")); it sets divElements to whatever reference is returned by findElements. It may be that findElements has instantiated a new object, which is a List (it could be any class that implements List); or maybe findElements is returning a reference to some object that was created previously; or maybe it returns null. It doesn't much matter. Whatever object divElements was referencing before, if any, doesn't matter either. The reference gets replaced by a new reference. The thing is here, unless findElements returns null, an object that implements a List does or did get instantiated, somewhere. Doing this first: List&lt;WebElement&gt; divElements = new ArrayList&lt;&gt;(); simply means that you set divElements to a reference to a new object that's just going to get thrown out. It has no beneficial effect.
answers question: http://stackoverflow.com/q/27390672
score: 1

http://stackoverflow.com/a/45388533
score: 4
has body: "jsonschema2pojo" project contains notations for this purpose. On the JSON schema, just include something like this; "extendsJavaClass" : "com.somecompany.SomeBaseClass", i.e. { "title": "....", "description": "....", "type": "object", "extendsJavaClass" : "com.somecompany.SomeBaseClass", "properties": { "...": { "items": { "$ref": "#/definitions/...." }, "type": "array" } ....... } then the class generated by the project will have its "extends" clause as; /** * ... * &lt;p&gt; * ... * */ @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ ... }) public class MyNewClass extends SomeBaseClass { ... } Also you can search for similar notations in here. PS: Theese notations are not "standard JSON schema constructs". They are added for the sake of "just doing it" until a standard way of doing it is possible. Hope it helps..
downvote count: 0
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/27410216

http://stackoverflow.com/comment/43315837
comment on: http://stackoverflow.com/q/27437454
has text: what was the problem you are facing ??. be specific.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43203144
score: 0
comment on: http://stackoverflow.com/q/27376192
has text: I do not want to do that sorry. :/ I have the correct one in my class.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43277015
has text: Sorry, I included the android-studio tag but I also edited the question to include that I am running Android Studio.
comment on: http://stackoverflow.com/a/27416763
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/a/27349121
score: 0
has comment: http://stackoverflow.com/comment/43226544
has comment: http://stackoverflow.com/comment/43223370
has comment: http://stackoverflow.com/comment/43226731
type: Answer
has comment: http://stackoverflow.com/comment/43223130
has comment: http://stackoverflow.com/comment/43226554
answers question: http://stackoverflow.com/q/27348711
has comment: http://stackoverflow.com/comment/43226395
has comment: http://stackoverflow.com/comment/43226634
has comment: http://stackoverflow.com/comment/43226522
has body: Recursion to the rescue, bonus point if it is tail recursive: String tst = repeat(y, x, ""); ... private String repeat(y, x, b) { if (x == 0) { return b; } return repeat(y, x - 1, b + y) ; }

http://stackoverflow.com/comment/43346434
comment on: http://stackoverflow.com/q/27454084
type: Comment
type: QuestionComment
score: 0
has text: https://docs.oracle.com/javase/tutorial/essential/io/

http://stackoverflow.com/q/27327958
tagged with: arrays
has comment: http://stackoverflow.com/comment/43114767
has body: What is the time complexity of the method Collection.toArray()? is it O(n), if yes than what benefits does it offer over looping and individually assigning the values in the list to an array( beside nice look and some extra effort of course).
answer count: 2
tagged with: time-complexity
possible better answer: http://stackoverflow.com/a/27327978
has answer: http://stackoverflow.com/a/27327978
favorite count: 0
has answer: http://stackoverflow.com/a/27327971
accepted answer: http://stackoverflow.com/a/27327971
upvote count: 5
has title: What is the time complexity of Collection.toArray()?
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: collections
type: Question
score: 5
tagged with: performance

http://stackoverflow.com/comment/43272167
comment on: http://stackoverflow.com/q/27414023
score: 0
has text: You seem to be expecting to get all four values back from the method. But Java doesn't work that way - it's "pass by value", not "pass by reference". If you need to get all four values back from the method, one option is to return an array. You might want to have one method that just fetches the values from the user, and a separate method which figures out the largest one.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27464552
tagged with: swing
has body: I have JTextPane as in picture: The border name is view_desc I tried following things: view_desc.setBorder(BorderFactory.createEmptyBorder()); //and view_desc.setBorder(null); But it's still there, how can I remove it?
score: 2
has comment: http://stackoverflow.com/comment/43365480
tagged with: java
has comment: http://stackoverflow.com/comment/43365429
type: Question
has comment: http://stackoverflow.com/comment/43365414
has title: Java: Annoying JTextPane border, how to remove it?
has answer: http://stackoverflow.com/a/29723140
answer count: 2
has comment: http://stackoverflow.com/comment/43365625
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/36337000
upvote count: 2
type: UnansweredQuestion

http://stackoverflow.com/a/27398703
answers question: http://stackoverflow.com/q/27398650
type: Answer
has body: 1 - no, it's NEW 2 - NEW is waiting to be executed, RUNNABLE is executing 3 - NEW Who could answer better than Oracle: https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.State.html
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/43140556
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27341703
has text: @Dmitry JAXB won't work here so easy.

http://stackoverflow.com/comment/43129238
score: 0
type: Comment
has text: Thank you very much for a detailed answer, very helpfull i will check out the ABSArrayAdapter. Thanks
type: AnswerComment
comment on: http://stackoverflow.com/a/27336220

http://stackoverflow.com/comment/43349781
type: QuestionComment
comment on: http://stackoverflow.com/q/27456108
has text: @ElliottFrisch A weird situation I am in where I kind of need a family of Singletons. It's horrendous. I'll just think of another way of doing what I want to achieve.
score: 0
type: Comment

http://stackoverflow.com/a/27381186
accepted answer of: http://stackoverflow.com/q/27380406
has comment: http://stackoverflow.com/comment/43213027
has body: You need to have the main class on the path after the jars are included "net.minecraft.client.main.Main" unless mainClass means that already, then I don't know.
has comment: http://stackoverflow.com/comment/43212801
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43212731
has comment: http://stackoverflow.com/comment/43213756
has comment: http://stackoverflow.com/comment/43211563
answers question: http://stackoverflow.com/q/27380406
type: Answer

http://stackoverflow.com/comment/43360108
has text: @almasshaikh So are you saying logically, `method 1` makes more sense?
comment on: http://stackoverflow.com/q/27461857
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43149823
type: Comment
has text: but why the average temp of month one is always being zero
comment on: http://stackoverflow.com/a/27347424
score: 0
type: AnswerComment

http://stackoverflow.com/q/27455315
tagged with: java
type: Question
has title: How do I make a Java JAR unkillable by Windows user accounts
has comment: http://stackoverflow.com/comment/43348435
score: 0
has comment: http://stackoverflow.com/comment/43348484
tagged with: windows
favorite count: 0
has comment: http://stackoverflow.com/comment/43348385
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43348580
tagged with: process
upvote count: 1
has comment: http://stackoverflow.com/comment/43348655
downvote count: 1
has body: Basically, I am creating some software to limit access to a few applications for my friend. I've written the framework and it works perfectly fine, but the Java application needs to sit there minimized in the tray without being killed by the user. 3 Questions What is the best way to start this JAR with Windows? How to I keep the application minimized in the system tray? I am using a CardLayout. How do I keep the JAR from being killed?

http://stackoverflow.com/a/27418920
has comment: http://stackoverflow.com/comment/43281056
has comment: http://stackoverflow.com/comment/43281468
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43281273
score: 0
has comment: http://stackoverflow.com/comment/43281019
has body: First thing, you should initialize the ArrayList&lt;Student&gt; students list. Integer.parseInt(args[30]) is also suspicious, since for that not to throw an exception, you have to supply 31 command line arguments. Same goes for all your other attempts to access elements of args array without checking its length first.
type: Answer
accepted answer of: http://stackoverflow.com/q/27418899
answers question: http://stackoverflow.com/q/27418899
has comment: http://stackoverflow.com/comment/43281216

option-type
tags question: http://stackoverflow.com/q/27316312
tag name: option-type
tags question: http://stackoverflow.com/q/27315959
type: Tag

filereader
tags question: http://stackoverflow.com/q/27448803
tags question: http://stackoverflow.com/q/27327011
tag name: filereader
tags question: http://stackoverflow.com/q/27338182
tags question: http://stackoverflow.com/q/27382193
tags question: http://stackoverflow.com/q/27471861
type: Tag
tags question: http://stackoverflow.com/q/27379404
tags question: http://stackoverflow.com/q/27338882
tags question: http://stackoverflow.com/q/27354718
tags question: http://stackoverflow.com/q/27325042
tags question: http://stackoverflow.com/q/27410178

http://stackoverflow.com/q/27430264
accepted answer: http://stackoverflow.com/a/27430293
tagged with: netbeans
linked to: http://stackoverflow.com/q/25706216
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43301732
has title: For loops cannot find symbol Netbeans
duplicate of: http://stackoverflow.com/q/25706216
tagged with: java
has answer: http://stackoverflow.com/a/27430293
type: AnsweredQuestion
upvote count: 0
favorite count: 0
has body: Beginner at Java here. I cannot figure why I am getting a cannot find symbol on line 16. package loops; public class forloops { public static void main(String[] args) { int loopVal; int end_value = 11; int addition = 0; for (loopVal = 0; loopVal &lt; end_value; loopVal++) { System.out.prinln("Loop Value = " + loopVal); } } }
type: Question
has comment: http://stackoverflow.com/comment/43301674
score: -1

http://stackoverflow.com/comment/43222471
has text: @Dawnkeeper then I don't know then.
type: Comment
comment on: http://stackoverflow.com/a/27387193
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43258070
comment on: http://stackoverflow.com/a/27406311
score: 0
type: AnswerComment
type: Comment
has text: You can print value of count to know the count of bytes you are reading.Try to make make sure you are getting data.

http://stackoverflow.com/comment/49630208
has text: +1 for renaming resources. Unfortunately doesn't work if multiple third party libraries have their own ic_launcher though. I ended up manually importing some of them and removing the ic_launcher inside my project as a result which is unfortunate but was unavoidable.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/30343480

http://stackoverflow.com/comment/43109754
score: 0
comment on: http://stackoverflow.com/q/27323421
type: Comment
type: QuestionComment
has text: Maybe it is better to print rs.getString(3) and cmb.getSelectedIndex(). What is the combo box model used to initialize `cmb`?

http://stackoverflow.com/q/27400919
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27402828
has comment: http://stackoverflow.com/comment/43447740
downvote count: 0
upvote count: 13
tagged with: variables
has comment: http://stackoverflow.com/comment/43247395
answer count: 3
has answer: http://stackoverflow.com/a/27401076
has title: is there a way to check instanceof primitives variables java
favorite count: 0
possible better answer: http://stackoverflow.com/a/27402828
tagged with: primitive-types
has body: We can know object reference is-a test by using instanceof operator. But is there any operator to check primitive types. For example: byte b = 10; Now if I only consider the value 10. Is there any way I could find out that it was declared as a byte?
has comment: http://stackoverflow.com/comment/43246847
score: 13
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27400967
accepted answer: http://stackoverflow.com/a/27400967

http://stackoverflow.com/comment/43271948
score: 0
has text: Try a debugger. My guess is `SpriteSheet.class.getResourceAsStream(path)` returned `null`.
comment on: http://stackoverflow.com/q/27413927
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43105736
has text: @ajb How is that not legal Java?
type: QuestionComment
comment on: http://stackoverflow.com/q/27323087
score: 0
type: Comment

http://stackoverflow.com/comment/43320670
score: 0
has text: Sorry, I haven't done TCP hole punching yet, just pointing at general flaws in that code. Maybe you continue reading about it, looking at implementations in other languages and post your solution here? :-) This codes *make a server socket, bind it, bind another socket to the same port, try to connect to another instance of the program, try to use any connected socket...* seems quite messy and as it never could have run.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27427171

http://stackoverflow.com/comment/43305731
type: Comment
has text: ...at one time and unequal at some other time, and having the hash code change would break the map in a situation where having the hash code stay the same would have worked, most code which uses maps properly shouldn't care if changes that affect equality also affect the hash code.
comment on: http://stackoverflow.com/a/27393253
score: 0
type: AnswerComment

http://stackoverflow.com/a/27449927
has body: The Computer part in your assignment is invalid - you're trying to declare anything. It should just be: c[0] = new Computer(...); At that point it will compile - but you'll get a NullPointerException when i is 1. You'll need to either check whether c[i] is null before dereferencing it, or make sure you popuate the whole array rather than just the first element.
score: 1
answers question: http://stackoverflow.com/q/27449906
downvote count: 0
type: Answer
upvote count: 1

http://stackoverflow.com/comment/43371351
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27455709
has text: please show definition of Account
score: 0

http://stackoverflow.com/q/27360435
score: 2
downvote count: 0
favorite count: 0
type: Question
tagged with: jcurses
has answer: http://stackoverflow.com/a/27651073
upvote count: 2
has title: Java Eclipse JCurses Library doesnt work after hours of triing of fixing it
tagged with: java
answer count: 1
has body: Greatings, i hope you guys outthere can help me to solve my problem. i've try to setup the Jcurses Library but the result of it was just starting the cmd.exe without any content there was only the path of the workspace. I readed a lot of howtos but non of this did work. I also tried with the original tutorial of Jcurses: ======================================================== How to run a JCurses application To work around the above mentioned problem, you first need to determine the command being used to start your program. Instructions: Step 1) Run Java app as usual (it does not matter if it fails), and switch to the debug view. Step 2) Right click on the process, and open the property window by selecting "Properties". Step 3) Select and copy the command-line parameter used to launch the program. Step 4) Hit the arrow-button next to "External Tools" (The play icon with a small red toolbox), and hit "External Tools Configuration" Step 5) Create a new configuration, with the following data: Location: The path to the cmd.exe of your Windows OS. For Example: C:\WINXP\system32\cmd.exe Working Directory: Whatever working directory you want. Arguments: "/c start C:\WINXP\system32\cmd.exe /k " followed by the previously copied command. For Example: /c start C:\WINXP\system32\cmd.exe /k C:\Programme\Java\jre6\bin\java.exe -Dfile.encoding=Cp1252 -classpath "C:\Dokumente und Einstellungen\mccae\Eigene Dateien\javawork\TWCC+\bin" at.co.lipski.twcc2.console.TWCCDaemon Please note, that you need to wrap paths containing whitespace with quotes (“). The above command will start your application in a new, detached console window, which will stay open until you manually close it. Now you can launch your newly created configuration and enjoy your application from inside Eclipse. My external-tools-config looks like this Position: C:\Windows\System32\cmd.exe Workspace: ${workspace_loc:/Azubi Storys} Arguments: "/c start C:\Windows\System32\cmd.exe /k" "C:\Program Files\Java\jre1.8.0_2…
type: UnansweredQuestion
tagged with: eclipse

http://stackoverflow.com/comment/43262224
score: 0
type: Comment
type: QuestionComment
has text: Sorry about my bad code, I am a student in an intro to java class. I am pretty clueless, but thanks for the help.
comment on: http://stackoverflow.com/q/27407987

http://stackoverflow.com/comment/43183520
comment on: http://stackoverflow.com/a/27365724
type: AnswerComment
score: 0
type: Comment
has text: I gave you answers to your two questions but you already have that information? Then why are you asking a question here? :) It is pretty trivial to translate this pseudo-code to `Java` syntax

http://stackoverflow.com/comment/43123891
comment on: http://stackoverflow.com/q/27325154
type: Comment
has text: Also, it doesn't work with arabic characters: [link](http://en.wikipedia.org/wiki/Arabic_alphabet)(counts as 2), and whitespace characters(spacebar, tab) which are ignored.
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43145478
score: 0
comment on: http://stackoverflow.com/q/27345055
type: Comment
type: QuestionComment
has text: @Rami, if u know and can help me, please help!

http://stackoverflow.com/comment/43208751
type: Comment
type: QuestionComment
has text: Is this the only way? I'm looking for a more "compact" form to achieve this. Let's asume I've to build queries with 50 such addWhereClause-Conditions. 50 such if/else constructs are not very nice.
score: 0
comment on: http://stackoverflow.com/q/27379482

http://stackoverflow.com/comment/43140973
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27342571
type: QuestionComment
has text: no, visible is correct.

http://stackoverflow.com/comment/43190539
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27356350
has text: Not only when you run it, also when you try to compile.
score: 0

http://stackoverflow.com/q/27394587
score: 2
has title: The Network Adapter could not establish the connectionDSRA0010E: SQL State = null, Error Code = 17,002″
tagged with: java
has answer: http://stackoverflow.com/a/59734998
type: Question
upvote count: 2
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has body: I am facing below issue. 1- I have data source on my local websphere6.1 and when i do test connection from web console server ,it was successful but when i tried to do the same from my application code it giving me error java.sql.SQLException: Io exception: The Network Adapter could not establish the connectionDSRA0010E: SQL State = null, Error Code = 17,002 Note : I am connecting to remote oracle db in my machine , I have only raid,toad &amp; web sphere installed. I have already tried following things but issue is yet not resolved. Replace my server names with the ip addresses. Change minimum connection setting from web sphere server configuration The same configuration is running to my other colleague but issue is occurring only on my laptop. Please any body help me. Advance thank you
has answer: http://stackoverflow.com/a/27394733
has comment: http://stackoverflow.com/comment/43236041
has answer: http://stackoverflow.com/a/45331835
answer count: 4
has answer: http://stackoverflow.com/a/28426455

http://stackoverflow.com/comment/43138856
type: Comment
type: QuestionComment
has text: from is `youremail@gmail.com` username `youremail` or full mail address
score: 0
comment on: http://stackoverflow.com/q/27341520

http://stackoverflow.com/comment/43093920
type: QuestionComment
comment on: http://stackoverflow.com/q/27316933
has text: Please post more complete code. It's not clear from the snippet above.
score: 0
type: Comment

http://stackoverflow.com/comment/43103460
type: QuestionComment
has text: Please provide an [MCVE](http://stackoverflow.com/help/mcve) that we can copy-paste, and see the same error as you. You say: `it just doesnt work`. What exactly doesn't work? The save part?, open part? In any case, provide those codes too please.
comment on: http://stackoverflow.com/q/27316734
score: 0
type: Comment

http://stackoverflow.com/comment/43414764
has text: @Xaerxess There is too much detail in between `FooDao` and `DAO`. This means A LOT of boiler plate for me for EVERY DAO just to be able to write a clean test.
type: Comment
comment on: http://stackoverflow.com/q/27474349
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43354208
has text: Can you explain what advantage a LinkedList offers against an ArrayList in this case? (Hint: the answer is none. Iterating on a LinkedList is much slower than over an ArrayList).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27458547
type: Comment

http://stackoverflow.com/q/27431845
tagged with: java
score: 0
type: Question
has answer: http://stackoverflow.com/a/27432347
tagged with: datetime-format
has answer: http://stackoverflow.com/a/27431932
answer count: 3
has title: How to present a date that can be parsed by any DateTimeFormatter pattern in Java?
has answer: http://stackoverflow.com/a/35161478
type: UnansweredQuestion
tagged with: datetime
has body: I'm working with a software that uses a lot of DateTimeFormat parsing, in order to minimize the errors, I wonder if I can present the date String in a certain way that it can be parsed by any DateTimeFormat pattern. Ideally it should work as follows: String date = "...." DateTimeFormatter format = DateTimeFormat.forPattern(any pattern I want); DateTime result = format.parseDateTime(date); Or does the date have to follow the pattern? Thanks for your help

http://stackoverflow.com/comment/43151414
type: Comment
score: 0
has text: What are you trying to do? Replace `' '` with `'\n'`?
type: QuestionComment
comment on: http://stackoverflow.com/q/27348378

http://stackoverflow.com/comment/43336141
comment on: http://stackoverflow.com/a/27447040
type: AnswerComment
type: Comment
has text: `update` is an instance method. To call an instance method, you need an instance to call it on, right? Until constructor has finished, the instance does not exist. Therefore nobody can call `update` before constructor is finished. Think about it.
score: 2

http://stackoverflow.com/a/27478221
score: 1
upvote count: 1
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27465052
has body: GAE does not allow front end instances (GAE instances) to spawn threads, and an attempt to do so results in AccessControlException. You will need to run the Aerospike client on a GCE machine and then use your GAE application to connect to the GCE machine instead of running the Aerospike Client on GAE.
answers question: http://stackoverflow.com/q/27465052
downvote count: 0

http://stackoverflow.com/q/27405169
has comment: http://stackoverflow.com/comment/43256863
tagged with: java
has answer: http://stackoverflow.com/a/27405321
has answer: http://stackoverflow.com/a/27405999
has answer: http://stackoverflow.com/a/27405464
type: Question
tagged with: hashmap
has body: How can we restrict a HashMap to accept a particular string key. Restriction here can have one of following meanings- 1. It can throw an error or 2. It can simply ignore that entry which has that specific key. But the condition is that it should be implemented without overriding put method of HashMap and without using if condition while adding an entry to given map. Suppose I have a HashMap m and I want to restrict a particular string key "myKey". What I want is, whenever we try to add any entry with key "myKey", m should follow point 1 or point 2 as mentioned above. m.put("otherKey", "value"); // should add to the map&lt;br/&gt; m.put("myKey","value"); // Either throw an error or ignore this entry and should not add to the map. I can restrict a type of keys using Genetics but how to do it for a single given string key. It was an interview question. Thanks in Advance !!
has answer: http://stackoverflow.com/a/27405412
has title: Restrict HashMap to accept a particular string key
downvote count: 0
favorite count: 0
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43255836
score: 3
has answer: http://stackoverflow.com/a/27405635
upvote count: 3

http://stackoverflow.com/a/27386399
has comment: http://stackoverflow.com/comment/94249921
has comment: http://stackoverflow.com/comment/127588975
accepted answer of: http://stackoverflow.com/q/27385780
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43249805
answers question: http://stackoverflow.com/q/27385780
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/43245365
has body: Try combining all the action into one action as shown below and try again. public class Helper { public static void scrollToElementAndClick(WebDriver driver, WebElement webelement){ Actions actions = new Actions(driver); actions.moveToElement(webelement).click(); action = action.build; action.perform(); } Also you can try JavascriptExecuter as shown below: ((JavascriptExecutor)driver).executeScript("arguments[0].click();", selectAddress); Also consider the possibility of the td containing some other element (input, link) which can be clicked(I dont know your html code). Hope this helps you.
downvote count: 1
score: 5
has comment: http://stackoverflow.com/comment/43229665

http://stackoverflow.com/comment/43235997
comment on: http://stackoverflow.com/a/27394489
has text: No, I mean Java Swing. The OP needs one place where he can keep all formatting options, so a properties file or XML can be used. If he wants true CSS support, he'll have to interpret CSS probably using a 3rd party library. But if the mention of CSS is confusing, I'll edit my answer.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27435978
downvote count: 0
answers question: http://stackoverflow.com/q/27435857
has body: Have a look at this answer https://superuser.com/questions/323238/how-can-i-determine-the-os-of-a-remote-computer which suggests using either systeminfo or wmic
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/a/27315362
has comment: http://stackoverflow.com/comment/43139462
has comment: http://stackoverflow.com/comment/43091421
has body: We need your service code to be able to know for sure what the problem is. But, my guess is that you didn't add that b1 to A's list of Bs. If that's the case, your next query for A is returning it from the cache, where it doesn't have b1 in its list. Bottom line is, if my assumption is correct, you need to handle both sides of bidirectional relationship. B b1 = new B(); b1.setA(a); // I guess you are skipping this next step a.getBs().add(b1); save(a);
score: 0
answers question: http://stackoverflow.com/q/27315227
type: Answer

http://stackoverflow.com/a/27352780
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: Try below code, Map key should be unique so when you put value to same key n times the value is just replaced for the key, In your code you are replacing the value for same key(clientName) and adding it to list so it is printing the same value which you put in last to map. List&lt;Map&gt; clientList=new ArrayList&lt;Map&gt;(); Map&lt;String,String&gt; clientNameMap = new HashMap&lt;String,String&gt;(); clientNameMap.put("clientName-1","abcd"); clientList.add(clientNameMap); clientNameMap.put("clientName-2","defg"); clientList.add(clientNameMap);
answers question: http://stackoverflow.com/q/27352496

http://stackoverflow.com/comment/43198583
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27373807
has text: I do a edit with the ns uris

http://stackoverflow.com/comment/43232519
comment on: http://stackoverflow.com/a/27392538
type: Comment
has text: @RELENTLESS00G your list holds `Class` objects (not to be confused with `java.lang.Class`??), not variables. You need to address it in whatever manner you access individual fields within your `Class` object. `System.out.println(list.get(0).myField1);` or something similar
score: 0
type: AnswerComment

http://stackoverflow.com/q/27344097
upvote count: 4
accepted answer: http://stackoverflow.com/a/27344155
has body: According to the documentation on "method references", it's possible to create: Reference to an instance method of an arbitrary object of a particular type Link: https://docs.oracle.com/javase/tutorial/java/javaOO/methodreferences.html I wrote the following code: public class App { public static void main(String[] args) { Function&lt;String, String&gt; f1 = String::toString; Function&lt;String, String&gt; f2 = App::toString; // Compilation error } public String toString() { return "test"; } } However the "method reference" using the class "String" compiles fine, whereas the same "method reference" using my own App class doesn't compile fine. Can someone tell why?
type: AnsweredQuestion
score: 2
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/27344164
has title: Reference to an instance method of an arbitrary object of a particular type... not working with custom classes?
tagged with: java-8
has answer: http://stackoverflow.com/a/27344158
has answer: http://stackoverflow.com/a/27344155
tagged with: java
downvote count: 2
answer count: 3
possible better answer: http://stackoverflow.com/a/27344158

http://stackoverflow.com/q/27343836
type: Question
answer count: 1
has body: I have a project and it is shopping cart. In the checkout I have a jTable, I want to take the amount and price and multiple them. I tried to put them in variables but I failed. This is my code: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: try{ query="SELECT productName,size,amount,price FROM Checkout where cphone="+jTextField1.getText(); rs=stm.executeQuery(query); int i=0; while(rs.next()) { jTable1.setValueAt(rs.getString(1),i,0); jTable1.setValueAt(rs.getString(2),i,1); jTable1.setValueAt(rs.getString(3),i,2); jTable1.setValueAt(rs.getString(4),i,3); i++; } } catch(Exception e){ System.out.println(e); } }
has comment: http://stackoverflow.com/comment/43143263
has answer: http://stackoverflow.com/a/27344086
has title: geting values form jtable to calculate it
type: UnansweredQuestion
score: 0
tagged with: swing
tagged with: java

http://stackoverflow.com/q/27438815
tagged with: maven
upvote count: 1
tagged with: spring
downvote count: 1
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27442450
has title: How to send request use AngularJS use war name?
type: Question
has comment: http://stackoverflow.com/comment/43327704
answer count: 1
has body: I wand to send request: var response = $http({ method: "post", url: "/Test/hello", data: { action:"action", } }); where is /Test/ - my war name. But if I rename war, I will have an error. How to setting request use war name? Note. web.xml dispatcher / Spring controller @Controller public class ProjectController { @RequestMapping(method = RequestMethod.POST, value = "/hello") @ResponseBody public String hello(@RequestBody JSONObject request) { return "hello@; }
favorite count: 0
tagged with: angularjs
type: UnansweredQuestion

http://stackoverflow.com/a/27376582
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27364452
has comment: http://stackoverflow.com/comment/43209844
answers question: http://stackoverflow.com/q/27364452
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43202939
has comment: http://stackoverflow.com/comment/43209761
type: Answer
has comment: http://stackoverflow.com/comment/43203200
has body: I think what's happening here is that some Java code from seams (and your app) is compiled using a java 8 compiler. Then org.drools.compiler.PackageBuilder is called to compile some DRL. This will, eventually, call a Java compiler to compile the Java code generated from the DRL. For this, a Java compiler is called up via Eclipse, and this compiler isn't happy when it encounters (due to import statements) classes that have been compiled by Java 8. Therefore, it is a question of fixing your Eclipse and Java installation. There's a way to configure the Java compiler to be used by Drools, but normally this works well using the default, i.e., via Eclipse.

http://stackoverflow.com/comment/43368038
comment on: http://stackoverflow.com/a/27460709
type: AnswerComment
score: 0
has text: THX,I think it's because every class you defined inherits from the Object class. And when I use this() function to call another constructor , the super(name,age) function in that constructor cannot be executed for var name and age haven't been initialized yet. And in other words, before the execution of superclass' constructor, the vars of subclass cannot be initialized , so you cannot call this(name,age,"professor").
type: Comment

http://stackoverflow.com/a/27333647
answers question: http://stackoverflow.com/q/27333474
accepted answer of: http://stackoverflow.com/q/27333474
has body: Write your method in the BinarySearchPerson class so that it looks something like public int lookupAge(String name) {... Once written, if someone calls the method like in your example, bt.lookupAge("Tom"), the 'this' parameter will refer to bt. You'll then compare this.person.getName() to name and either return this.person.getAge(), or return something like this.lookupAge(getRight().getPerson().getName())
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/43553897
comment on: http://stackoverflow.com/a/27485703
type: AnswerComment
has text: In loadAppSettingsAsync the only anonymous inner class is an anonymous implementation of AsyncTask without any static initialization. As an anonymous class is only used locally the crash should occur on first run. So I would exclude the third option, because this anonymous class could not be initialized at any other place.
score: 0
type: Comment

http://stackoverflow.com/a/27395134
downvote count: 0
has comment: http://stackoverflow.com/comment/43237884
score: 21
has body: If you move your dog instance in the end, you may find the output becomes -2 public class Dog { static final int val1 = -5;// This is final, so will be initialized at compile time static int val2 = 3; public int val3; public static Dog dog = new Dog();//move to here public Dog() { val3 = val1 + val2; } public static void main(String[] args) { System.out.println(Dog.dog.val3);//output will be -2 } } The final fields(whose values are compile-time constant expressions) will beinitialized first, and then the rest will be executed at in textual order. So , in your case when dog instance is initialized, static int val2(0) is not initialized yet, while static final int val1(-5) does since it is final. http://docs.oracle.com/javase/specs/jls/se5.0/html/execution.html#12.4.2 states that: execute either the class variable initializers and static initializers of the class, or the field initializers of the interface, in textual order, as though they were a single block, except that final class variables and fields of interfaces whose values are compile-time constants are initialized first Updated a newer doc Here is the jdk7 version from http://docs.oracle.com/javase/specs/jls/se7/html/jls-12.html#jls-12.4.2 final field is at step6: Then, initialize the final class variables and fields of interfaces whose values are compile-time constant expressions while static field is at step 9: Next, execute either the class variable initializers and static initializers of the class, or the field initializers of the interface, in textual order, as though they were a single block.
upvote count: 21
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27394945
answers question: http://stackoverflow.com/q/27394945
type: Answer

http://stackoverflow.com/a/44923402
score: 728
has comment: http://stackoverflow.com/comment/83739990
has comment: http://stackoverflow.com/comment/129648542
has comment: http://stackoverflow.com/comment/106248400
upvote count: 728
answers question: http://stackoverflow.com/q/27405713
has body: It is as simple as this: @EventListener(ApplicationReadyEvent.class) public void doSomethingAfterStartup() { System.out.println("hello world, I have just started up"); } Tested on version 1.5.1.RELEASE
has comment: http://stackoverflow.com/comment/101073435
has comment: http://stackoverflow.com/comment/123309142
has comment: http://stackoverflow.com/comment/83751697
has comment: http://stackoverflow.com/comment/117941692
has comment: http://stackoverflow.com/comment/123662273
has comment: http://stackoverflow.com/comment/128530786
has comment: http://stackoverflow.com/comment/123836309
type: Answer
has comment: http://stackoverflow.com/comment/106075293
has comment: http://stackoverflow.com/comment/92577558
has comment: http://stackoverflow.com/comment/88146124
downvote count: 0
has comment: http://stackoverflow.com/comment/137759259
has comment: http://stackoverflow.com/comment/77115904

generics
tags question: http://stackoverflow.com/q/27442206
tags question: http://stackoverflow.com/q/27327182
tags question: http://stackoverflow.com/q/27339388
tags question: http://stackoverflow.com/q/27459777
tags question: http://stackoverflow.com/q/27327930
tags question: http://stackoverflow.com/q/27354848
tags question: http://stackoverflow.com/q/27422460
tags question: http://stackoverflow.com/q/27470383
tags question: http://stackoverflow.com/q/27323729
tags question: http://stackoverflow.com/q/27321741
tags question: http://stackoverflow.com/q/27391862
tags question: http://stackoverflow.com/q/27320705
type: Tag
tags question: http://stackoverflow.com/q/27318939
tags question: http://stackoverflow.com/q/27410910
tags question: http://stackoverflow.com/q/27349093
tags question: http://stackoverflow.com/q/27380088
tags question: http://stackoverflow.com/q/27386580
tags question: http://stackoverflow.com/q/27415693
tags question: http://stackoverflow.com/q/27440191
tags question: http://stackoverflow.com/q/27371022
tags question: http://stackoverflow.com/q/27413818
tags question: http://stackoverflow.com/q/27409915
tags question: http://stackoverflow.com/q/27314649
tags question: http://stackoverflow.com/q/27464042
tags question: http://stackoverflow.com/q/27439532
tags question: http://stackoverflow.com/q/27330303
tags question: http://stackoverflow.com/q/27323761
tags question: http://stackoverflow.com/q/27358792
tags question: http://stackoverflow.com/q/27336283
tags question: http://stackoverflow.com/q/27407894
tags question: http://stackoverflow.com/q/27381523
tags question: http://stackoverflow.com/q/27427798
tags question: http://stackoverflow.com/q/27348283
tags question: http://stackoverflow.com/q/27460295
tags question: http://stackoverflow.com/q/27465348
tags question: http://stackoverflow.com/q/27318536
tag name: generics
tags question: http://stackoverflow.com/q/27411071
tags question: http://stackoverflow.com/q/27340012

http://stackoverflow.com/comment/43112189
type: QuestionComment
comment on: http://stackoverflow.com/q/27324092
type: Comment
score: 1
has text: 2 ways to solve this, you don't need void as return value, return ModelAndView or String will be much easier.

http://stackoverflow.com/q/27374445
tagged with: java
type: Question
has title: Update common post in different ListView with different data in adapter
has answer: http://stackoverflow.com/a/27381397
tagged with: listview
score: 0
answer count: 3
tagged with: android-listview
has answer: http://stackoverflow.com/a/27374579
has answer: http://stackoverflow.com/a/27377710
type: UnansweredQuestion
tagged with: android
has body: Assume That an app Firstly List all post in a ListView in Fragment ( 1st ) with a custom adapter. and that custom adapter data is ArrayList&lt;Hashmap&lt;String,String&gt;&gt; Then users can go to another fragments like category fragment ( 2nd ), that we have another listview with different data. We using back stack for fragments and user can back to prev fragment by clicking back button. Issue: in these fragments some post can be common! Like image attached, in first image, we can see a post in all post List, and when click on category and goes to category fragment, we can see that post again. Then if user click on this post and goes to single post activity ( 3rd ), user can see like button and can like this post ( 4th ). Until now every thing is OK! But trouble is happen when user click back button! first user goes to category fragment ( 5th ) and we should show like button on List View as liked button. And if user goes further and back to all post we should like button in that list view as liked too!! ( 6th ) what's the best strategy to handle this issue? :)
tagged with: android-fragments

google-oauth
type: Tag
tags question: http://stackoverflow.com/q/27440241
tag name: google-oauth
tags question: http://stackoverflow.com/q/27329846

swing
tags question: http://stackoverflow.com/q/27353482
tags question: http://stackoverflow.com/q/27395123
tags question: http://stackoverflow.com/q/27460476
tags question: http://stackoverflow.com/q/27458635
tags question: http://stackoverflow.com/q/27344947
tags question: http://stackoverflow.com/q/27474565
tags question: http://stackoverflow.com/q/27336547
tags question: http://stackoverflow.com/q/27465014
tags question: http://stackoverflow.com/q/27339552
tags question: http://stackoverflow.com/q/27383811
tags question: http://stackoverflow.com/q/27408649
tags question: http://stackoverflow.com/q/27396231
tags question: http://stackoverflow.com/q/27318130
tags question: http://stackoverflow.com/q/27348249
tags question: http://stackoverflow.com/q/27446985
tags question: http://stackoverflow.com/q/27360091
tags question: http://stackoverflow.com/q/27365878
tags question: http://stackoverflow.com/q/27364098
tags question: http://stackoverflow.com/q/27360314
tags question: http://stackoverflow.com/q/27465993
tags question: http://stackoverflow.com/q/27360733
tags question: http://stackoverflow.com/q/27387985
tags question: http://stackoverflow.com/q/27382579
tags question: http://stackoverflow.com/q/27362165
tags question: http://stackoverflow.com/q/27365377
tags question: http://stackoverflow.com/q/27333990
tags question: http://stackoverflow.com/q/27391049
tags question: http://stackoverflow.com/q/27457235
tags question: http://stackoverflow.com/q/27474695
tags question: http://stackoverflow.com/q/27414017
tags question: http://stackoverflow.com/q/27322260
tags question: http://stackoverflow.com/q/27458794
tags question: http://stackoverflow.com/q/27347929
tags question: http://stackoverflow.com/q/27399910
tags question: http://stackoverflow.com/q/27323709
tags question: http://stackoverflow.com/q/27344395
tags question: http://stackoverflow.com/q/27381713
tags question: http://stackoverflow.com/q/27425472
tags question: http://stackoverflow.com/q/27334429
tags question: http://stackoverflow.com/q/27427890
tags question: http://stackoverflow.com/q/27347189
tags question: http://stackoverflow.com/q/27316734
tags question: http://stackoverflow.com/q/27422421
tags question: http://stackoverflow.com/q/27323421
tags question: http://stackoverflow.com/q/27337234
tags question: http://stackoverflow.com/q/27459394
tags question: http://stackoverflow.com/q/27472482
tags question: http://stackoverflow.com/q/27443938
tags question: http://stackoverflow.com/q/27444293
tags question: http://stackoverflow.com/q/27394353
tags question: http://stackoverflow.com/q/27316237
tags question: http://stackoverflow.com/q/27370296
tags question: http://stackoverflow.com/q/27423563
tags question: http://stackoverflow.com/q/27419390
tags question: http://stackoverflow.com/q/27445321
tags question: http://stackoverflow.com/q/27400444
tags question: http://stackoverflow.com/q/27368235
tags question: http://stackoverflow.com/q/27453979
tags question: http://stackoverflow.com/q/27414070
tags question: http://stackoverflow.com/q/27348665
tags question: http://stackoverflow.com/q/27431036
tags question: http://stackoverflow.com/q/27393969
tags question: http://stackoverflow.com/q/27422336
tags question: http://stackoverflow.com/q/27465670
tags question: http://stackoverflow.com/q/27347783
tags question: http://stackoverflow.com/q/27327078
tags question: http://stackoverflow.com/q/27314772
tags question: http://stackoverflow.com/q/27421324
tags question: http://stackoverflow.com/q/27458361
tags question: http://stackoverflow.com/q/27448803
tags question: http://stackoverflow.com/q/27328866
tags question: http://stackoverflow.com/q/27389225
tags question: http://stackoverflow.com/q/27404864
tags question: http://stackoverflow.com/q/27393076
tags question: http://stackoverflow.com/q/27383803
tags question: http://stackoverflow.com/q/27422646
tags question: http://stackoverflow.com/q/27405985
tags question: http://stackoverflow.com/q/27334869
type: Tag
tags question: http://stackoverflow.com/q/27412096

http://stackoverflow.com/comment/43201145
type: QuestionComment
score: 1
has text: As for me. I don't see an issue.
comment on: http://stackoverflow.com/q/27375489
type: Comment

http://stackoverflow.com/a/27363452
has comment: http://stackoverflow.com/comment/43179229
downvote count: 0
answers question: http://stackoverflow.com/q/27363255
type: Answer
has body: You may want to try typecasting autoset since it isn't of type BstSetKTUx... you can only equate objects that are from the same class. i.e. autoSetBst = (BstSetKTUx&lt;Automobilis&gt;)autoset;
upvote count: 1
has comment: http://stackoverflow.com/comment/43178801
score: 1
has comment: http://stackoverflow.com/comment/43179192
has comment: http://stackoverflow.com/comment/43179147

http://stackoverflow.com/a/27358390
has body: You can remove common items from current saveList using saveList.removeAll(updateList);
upvote count: 2
has comment: http://stackoverflow.com/comment/43169501
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/103807668
answers question: http://stackoverflow.com/q/27358263

http://stackoverflow.com/q/27419567
type: UnansweredQuestion
has body: I'm learning how to use htmlunit and found one problem when trying to get table element. I'm using following Java code: for (final HtmlTableRow row : table.getRows()) { System.out.println("Found row"); for (final HtmlTableCell cell : row.getCells()) { System.out.println(" Found cell: " + cell.asText()); } } as it is described in htmlunit web page. I'm trying to get element from code where elements are getting from document.write() function and as result I'm getting empty element. I've searched answers in Google but no result.
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43287570
tagged with: htmlunit
score: 0
has comment: http://stackoverflow.com/comment/43305544
has comment: http://stackoverflow.com/comment/43379354
has title: HtmlUnit Working with tables
answer count: 0

http://stackoverflow.com/q/27382088
accepted answer: http://stackoverflow.com/a/27427333
tagged with: oracle10g
type: Question
has title: Joining on a varchar to a char does not work in JPA (oracle)
has comment: http://stackoverflow.com/comment/43215134
score: -1
tagged with: varchar2
answer count: 1
tagged with: jpa
favorite count: 0
has answer: http://stackoverflow.com/a/27427333
has body: I have an existing DB that two tables are joined based on a string. The problem is that one table column is defined as a varchar2 and the other is a char. Oracle will pad the char with spaces and the varchar2 will not so that when JPA tries to join the two one has space and one does not so the equality is not met. How can I get the join to work in JPA? Is there a JPA annotation that would do the trick?
tagged with: oracle-database
type: AnsweredQuestion
tagged with: java
downvote count: 2
linked to: http://stackoverflow.com/q/5725491
upvote count: 1

http://stackoverflow.com/comment/43383680
type: QuestionComment
has text: What does this have to do with MySQL?
score: 0
comment on: http://stackoverflow.com/q/27474626
type: Comment

http://stackoverflow.com/q/27466517
has comment: http://stackoverflow.com/comment/43435007
has comment: http://stackoverflow.com/comment/43429586
has answer: http://stackoverflow.com/a/27466641
type: Question
tagged with: user-interface
answer count: 1
has comment: http://stackoverflow.com/comment/43429325
has comment: http://stackoverflow.com/comment/43428712
has comment: http://stackoverflow.com/comment/43369451
score: 0
tagged with: netbeans
type: UnansweredQuestion
tagged with: swing
has body: I have been using Netbeans recently for developing Java applications especially Swing components and Design tab has been a boon. I felt Swing component [jTable] was insufficient to my needs and so I thought of writing the application from scratch using GTK framework. I installed the library like: sudo apt-get install libjava-gnome-java and everything is working fine. But I DO NOT FIND THE DESIGN tab anymore. It is just a console application which is invoking a window! Can we not change that? Is the Design tab available to only Swing framework? I have checked it with GTK so don't know much about Qt. I was told Eclipse has a plugin for Qt [don't know...google search hinted me] but I would like to stick with Netbeans. Is there anyway to 'ivoke' the Design tab for developing GTK or Qt appliations?
tagged with: qt
has title: GUI Designer in Netbeans [Qt or GTK]
tagged with: java

http://stackoverflow.com/q/27340180
score: 0
has comment: http://stackoverflow.com/comment/43136791
answer count: 1
accepted answer: http://stackoverflow.com/a/27340236
has answer: http://stackoverflow.com/a/27340236
type: AnsweredQuestion
has title: String-1 > startWord
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43136648
has body: I was going through practice questions on CodingBat and I came across this one. It said: "Given a string and a second "word" string, we'll say that the word matches the string if it appears at the front of the string, except its first char does not need to match exactly. On a match, return the front of the string, or otherwise return the empty string. So, so with the string "hippo" the word "hi" returns "hi" and "xip" returns "hip". The word will be at least length 1. " So far this is the solution I came up with. It works for the most part, however I get one error shown below: Exception:java.lang.StringIndexOutOfBoundsException: String index out of range: -1 (line number:3) This occurs for the case -->> startWord("", "i"). How could this error be fixed? public String startWord(String str, String word) { String first = str.substring(1, str.length()); String second = word.substring(1, word.length()); if (str.length() == 0) { return ""; } if (str.startsWith(word)) { return str.substring(0, word.length()); } else if (first.startsWith(second)) { return str.substring(0, word.length()); } return ""; }

http://stackoverflow.com/q/27410530
has comment: http://stackoverflow.com/comment/43265460
type: Question
has comment: http://stackoverflow.com/comment/43265492
has comment: http://stackoverflow.com/comment/43265588
accepted answer: http://stackoverflow.com/a/27410681
score: -2
answer count: 1
has comment: http://stackoverflow.com/comment/43265808
has comment: http://stackoverflow.com/comment/43265674
has comment: http://stackoverflow.com/comment/43266047
has comment: http://stackoverflow.com/comment/43265443
tagged with: sparse-matrix
has comment: http://stackoverflow.com/comment/43265603
has comment: http://stackoverflow.com/comment/43265403
tagged with: matrix
favorite count: 0
has body: public class SparseMatrix { static SparseObjectMatrix2D matrix = new SparseObjectMatrix2D(1000000, 1000000); public static void main(String[] args) { matrix.set(1, 2, 3.0); } } Here is the error that I'm getting: java.lang.ExceptionInInitializerError Caused by: java.lang.IllegalArgumentException: matrix too large at cern.colt.matrix.impl.AbstractMatrix2D.setUp(Unknown Source) at cern.colt.matrix.impl.AbstractMatrix2D.setUp(Unknown Source) at cern.colt.matrix.impl.SparseObjectMatrix2D.&lt;init&gt;(Unknown Source) at cern.colt.matrix.impl.SparseObjectMatrix2D.&lt;init&gt;(Unknown Source) at SparseMatrix.&lt;clinit&gt;(SparseMatrix.java:18) Exception in thread "main"
has comment: http://stackoverflow.com/comment/43265543
tagged with: colt
has title: How can I create 1000000 x 1000000 sparse matrix using Java Colt?
upvote count: 1
has answer: http://stackoverflow.com/a/27410681
has comment: http://stackoverflow.com/comment/43265451
has comment: http://stackoverflow.com/comment/43265445
has comment: http://stackoverflow.com/comment/43265515
type: AnsweredQuestion
tagged with: java
downvote count: 3

http://stackoverflow.com/comment/43278331
comment on: http://stackoverflow.com/q/27417412
score: 0
type: QuestionComment
type: Comment
has text: Can you enable spring debug level logs and see whats happening behind the scenes?

http://stackoverflow.com/comment/43295336
score: 0
type: Comment
has text: Ok, I guess you want something like a .next() which test whether the next one exist?
comment on: http://stackoverflow.com/a/27426558
type: AnswerComment

http://stackoverflow.com/a/27337385
accepted answer of: http://stackoverflow.com/q/27335792
answers question: http://stackoverflow.com/q/27335792
score: 0
has body: Technically you can use a static initializer block to set your staic final Scanner variable. Inside the initializer block you can use try/catch: public static final Scanner NAME; static { // Be sure scanner is initialized even in the case of an exception Scanner scanner = null; try { new Scanner(new File("names.txt")); } catch (FileNotFoundException e) { e.printStackTrace(); } NAME = scanner; } BUT: It is bad style to hold an instance of a class like Scanner as a static constant. A Scanner is a one way object. You are about to consume the file content and that's it. It doesn't make sense to hold such an object as a constant and much less if it is public. A static variable will be intialized as soon as the class is loaded and lives as long as your program. In most cases this is not what you want. A better approach would be to make it an instance variable and initilize it in the constructor. And make it private to the class. You can hold the file name as a constant and create the constructor to accept any file name. The methods intro(), personName() and graph() can be made instance methods, too. public class BabyNames { public static final String NAMES_FILE_NAME = "names.txt"; public static final int YEAR=1900; public static final int LS=11; public static final int WIDTH=50; private final Scanner name; public BabyNames(String fileName) throws FileNotFoundException { name = new Scanner(new File(fileName)); } public static void main(String[] args) throws FileNotFoundException { BabyNames babyNames = new BabyNames(NAMES_FILE_NAME); babyNames.intro(); babyNames.personName(); babyNames.graph(); } public void graph() { // ... } public void personName() { // ... } public void intro() { // ... } // ... } As a consequence the Scanner variable is only known to the BabyNames class and lives as long as the particular BabyNames instance. This is more modular, better to maintain and easier to test. E.g. you can write a unit test and initialize your class with a test file.
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/43098980
type: QuestionComment
comment on: http://stackoverflow.com/q/27318536
has text: For declaration, as I said below is: private IClass IClass_Istance; @OldCurmudgeon: IClass<long> was just to reduce 6 files and a few thousands lines of code to something understandable, in the real code both the class implements the interface with T being two other custom classes from the project itself.
score: 0
type: Comment

http://stackoverflow.com/comment/43281826
type: Comment
comment on: http://stackoverflow.com/a/27419387
has text: It makes me slightly queasy to see Windows batch files described as *shell scripts*, but I suppose the command processor just about qualifies as a shell :)
score: 0
type: AnswerComment

http://stackoverflow.com/q/27437536
favorite count: 0
tagged with: android
score: 6
possible better answer: http://stackoverflow.com/a/36718660
upvote count: 6
accepted answer: http://stackoverflow.com/a/27515749
type: AnsweredQuestion
has body: Working with the Google Fit API at the moment and having a bit of trouble with the Sensors API. I'm trying to get user's current speed for my app's workouts but the documentation is a bit confusing. In this code snippet is an example from Google's info page: Fitness.SensorsApi.add( mClient, new SensorRequest.Builder() // Optional but recommended for custom data sets. .setDataType(DataType.TYPE_SPEED)// Can't be omitted. .setSamplingRate(1, TimeUnit.SECONDS).setAccuracyMode(SensorRequest.ACCURACY_MODE_HIGH) .build(), mListener3) .setResultCallback(new ResultCallback&lt;Status&gt;() { @Override public void onResult(Status status) { if (status.isSuccess()) { Log.i(TAG, "Listener registered!"); } else { Log.i(TAG, "Listener not registered."); } } }); //Adding a Listener mListener3 = new OnDataPointListener() { @Override public void onDataPoint(DataPoint dataPoint) { final float speed = dataPoint.getValue(Field.FIELD_SPEED).asFloat(); runOnUiThread(new Runnable() { @Override public void run() { Log.i(TAG, "In Speed" + speed ); speedTxtView.setText("" + speed ); } }); } Currently, I am getting all other datatype values like distance, heart rate ,step count and current activity but unable to get user's current speed. Is i am doing correctly?
tagged with: java
type: Question
answer count: 2
tagged with: google-maps
has comment: http://stackoverflow.com/comment/44070350
tagged with: google-fit
has answer: http://stackoverflow.com/a/27515749
downvote count: 0
has answer: http://stackoverflow.com/a/36718660
has title: How to get the user's current speed using Google Fit's API?

http://stackoverflow.com/comment/43135592
score: 0
has text: @AlexK - Actually, there aren't that many calls done "under the hood" like that. String concatenation and `toString` are probably the biggies.
comment on: http://stackoverflow.com/q/27339393
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27348729
answer count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43153717
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43152178
type: Question
tagged with: network-programming
has title: Unable to send more than one message from server to client and vice versa
has comment: http://stackoverflow.com/comment/43159065
upvote count: 1
has body: This is a a program in which the client and server will exchange user inputted messages to each other. However, I am only able to send one message each to both server and client. I am not able to input anything else after that. Client side output: count is 0 -&gt;enter message -&gt;hi -&gt;hello-&gt;reached 1 times Server side output: (port number varies)59262-&gt;count is 0-&gt;hi-&gt;enter message-&gt;hello-&gt;reached 1 times I think it does not enter the for loop after the first time but i do not know why. Any help is appreciated. Client code: public class MessageClient { public static void main(String[] arg) { BufferedReader in = null; int count = 0; try { Socket s = new Socket(arg[0],Integer.parseInt(arg[1])); PrintWriter out = new PrintWriter(s.getOutputStream(),true); in = new BufferedReader(new InputStreamReader(s.getInputStream())); Scanner scan = new Scanner(System.in); do { System.out.println("count is "+count); System.out.println("enter message"); String message = scan.nextLine(); out.println(message); System.out.println(in.readLine()); count++; System.out.println("reached "+count+" times"); } while(in.readLine() != "quit"); }catch(IOException e ) { System.out.println(e); } } } Server code: import java.util.*; import java.net.*; import java.io.*; public class MessageServer { public Socket d; public ServerSocket serverSocket; public MessageServer() throws IOException { serverSocket = new ServerSocket(0); } public void run() { BufferedReader in; int count = 0; try { d = serverSocket.accept(); in = new BufferedReader(new InputStreamReader(d.getInputStream())); Scanner scan = new Scanner(System.in); PrintWriter pw = new PrintWriter(d.getOutputStream(),true); do{ System.out.println("count is "+count); System.out.println(in.readLine()); System.out.println("Enter message"); String message = scan.nextLine(); pw.println(message); count++; System.out.println("reached "+count+" times"); }while(in.readLine()!= "quit"); } catch(IOException e) { System.out.println(e)…
favorite count: 0

http://stackoverflow.com/a/27392727
score: 1
upvote count: 1
has body: It's hard to help without any code to see what you are doing but ... The way this works is you have a a GoogleMap object so something like this private GoogleMap mMap; you then call mMap.setOnMarkerClickListener(someObject); where someObject is an instance of a class that implements OnMarkerClickListener, which means it has a method like this. @Override public boolean onMarkerClick(Marker marker) { // identify the marker you want and then do what ever you think should be done // for example when you added the marker, you could have given it a unique title // which you can check of here using if (marker.getTitle.equals("blah") { // do something } else { // do something else } return true; }
answers question: http://stackoverflow.com/q/27392407
type: Answer
downvote count: 0

http://stackoverflow.com/q/27358829
has body: How do i save same pdf file generated from jasper in java without overriding the existing pdf file like report1, report2, report 3 etc Note: its a java application not for web application, but solutions for both would be helpful. enter code here JRDesignQuery newQuery = new JRDesignQuery(); newQuery.setText(sql1); jd.setQuery(newQuery); JasperReport jr = JasperCompileManager.compileReport(jd); JasperPrint jp = JasperFillManager.fillReport(jr, null,con); JasperExportManager.exportReportToPdfFile(jp,reportDest); JasperViewer.viewReport(jp); '
has comment: http://stackoverflow.com/comment/43171596
upvote count: 1
has answer: http://stackoverflow.com/a/27375824
accepted answer: http://stackoverflow.com/a/27375824
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43195209
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has title: How to save the same PDF report several times from jasper using java without overriding the existing file in the directory

http://stackoverflow.com/comment/43218540
type: AnswerComment
has text: @niiraj874u Kind of, yes. It's explored in some depth by Knuth in "The Art of Computer Programming" vol 3. Exploring in more depth requires quite a bit of knowledge of maths and probability. This is, of course, only for Javas linked list as bucket implementation. Scatter or open addressing implementations will simply stop working if the hashmap is full.
type: Comment
comment on: http://stackoverflow.com/a/27384645
score: 0

http://stackoverflow.com/a/27398166
answers question: http://stackoverflow.com/q/27398030
downvote count: 1
score: -1
upvote count: 0
has body: This is how it should look like: PersonalServlet PersonalServlet 1 PersonalServlet /PersonalServlet/*
type: Answer

http://stackoverflow.com/a/27386924
has body: With Dropwizard, we don't need any special configuration for basic Jackson POJO mapping support. As explained in the Dropwizard User Guide: How it's Glued Together: When your application starts up, it will spin up a Jetty HTTP server, see DefaultServerFactory. This server will have two handlers, one for your application port and the other for your admin port. The application port has an HttpServlet as well, this is composed of DropwizardResourceConfig, which is an extension of Jersey’s resource configuration that performs scanning to find root resource and provider classes. DropwizardResourceConfig is where the various ResourceMethodDispatchAdapter are registered to enable the following functionality: Enables using Jackson to parse request entities into objects and generate response entities from objects, all while performing validation.
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27370685
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27370685
type: Answer
upvote count: 1

http://stackoverflow.com/comment/43198829
has text: @Tony I have to show both the columns along with a third column containing the number of times a particular system_name appears
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27373401

http://stackoverflow.com/comment/43111739
has text: Could you indent your code, please? Would make it more readable.
comment on: http://stackoverflow.com/q/27325968
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/27473178
has comment: http://stackoverflow.com/comment/43385390
has body: Annotations types are used as meta data. The typical use case for annotations, at runtime, is with reflection. You annotate something, then you use reflection to retrieve the annotation, process it, and possibly enhance the target. The annotation instances are created and given to you by the JVM through calls to the reflection API. In that regard, creating your own annotation type instances, which AnnotationLiteral makes easier to do, is kind of pointless since you have no target, since nothing was actually annotated. It can be useful for cases where you need to mock an annotation type instance or you want to inject some functionality that only exists when processing annotations. Intellij is simply warning you that it's uncommon.
type: Answer
has comment: http://stackoverflow.com/comment/43389835
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/43389909
has comment: http://stackoverflow.com/comment/43404035
has comment: http://stackoverflow.com/comment/43403738
downvote count: 0
answers question: http://stackoverflow.com/q/27472580

http://stackoverflow.com/q/27441716
accepted answer: http://stackoverflow.com/a/29622906
tagged with: spring
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/29622906
downvote count: 0
tagged with: java
tagged with: annotations
type: Question
has answer: http://stackoverflow.com/a/27445498
has body: I'm using Spring Batch 2.2 with Spring 3. I'm trying to configure my job with Java config instead of the usual XML Config. Below is my AppConfig class : @Configuration @EnableBatchProcessing public class AppConfig { @Autowired private JobBuilderFactory jobs; @Autowired private StepBuilderFactory steps; private Tasklet simpleTasklet = new SimpleTasklet(); @Bean public Job job() { return jobs.get("myJob").start(step1(simpleTasklet)).build(); } @Bean protected Step step1(Tasklet tasklet) { return steps.get("step1").tasklet(tasklet).build(); } } And runs it using this class below : public class App { public static void main(String[] args) { ApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class); JobLauncher jobLauncher = (JobLauncher)context.getBean("jobLauncher"); Job job = (Job) context.getBean("myJob"); try{ JobExecution execution = jobLauncher.run(job, new JobParameters()); System.out.println("Exit status : " + execution.getStatus()); } catch (Exception e){ e.printStackTrace(); } } } It yields this error : Exception in thread "main" org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: org.springframework.batch.core.configuration.annotation.BatchConfigurationSelector was imported as a @Configuration class but was not actually annotated with @Configuration. Annotate the class or do not attempt to process it. Offending resource: class path resource [org/springframework/batch/core/configuration/annotation/BatchConfigurationSelector.class] and the error stack points at this line : ApplicationContext context = new AnnotationConfigApplicationContext(AppConfig.class); What am I doing wrong? Ideas anyone?
has title: Spring Batch Java Config @EnableBatchProcessing Annotation Error
upvote count: 2
tagged with: spring-batch
answer count: 2
possible better answer: http://stackoverflow.com/a/27445498
favorite count: 0

http://stackoverflow.com/comment/43231914
type: Comment
type: QuestionComment
has text: Calculate the md5 hash of the file before deployment, and of the same file deployed in the webapp?
score: 0
comment on: http://stackoverflow.com/q/27387365

http://stackoverflow.com/q/27467236
has body: a = [1, "Hello", 3.5] println a.getClass() Yields class java.util.ArrayList But isn't ArrayList only capable of holding one type of value? How can my ArrayList hold an integer, a string and a float?
type: Question
score: 3
possible better answer: http://stackoverflow.com/a/27467542
tagged with: java
has answer: http://stackoverflow.com/a/27467261
has answer: http://stackoverflow.com/a/27467542
answer count: 2
tagged with: groovy
downvote count: 0
favorite count: 0
tagged with: arraylist
accepted answer: http://stackoverflow.com/a/27467261
type: AnsweredQuestion
has title: How can ArrayLists in Groovy hold different types of values?
upvote count: 3

http://stackoverflow.com/q/27349300
has comment: http://stackoverflow.com/comment/43153593
has comment: http://stackoverflow.com/comment/43153187
tagged with: defaulttreemodel
tagged with: swing
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43153394
tagged with: java
has comment: http://stackoverflow.com/comment/43153401
has comment: http://stackoverflow.com/comment/43153907
has comment: http://stackoverflow.com/comment/43153387
type: Question
tagged with: jtree
has comment: http://stackoverflow.com/comment/43153175
has title: How to insert and display new node in a JTree of the file system contents
has comment: http://stackoverflow.com/comment/43154025
answer count: 1
has comment: http://stackoverflow.com/comment/43153233
has comment: http://stackoverflow.com/comment/43153149
has answer: http://stackoverflow.com/a/27349862
has body: I have successfully created a small program that will display the file system contents in a JTree. It shows only folders and plain text files by design. I would now like to add a folder to the tree when it is created. The example program will display the tree and create a folder, but it will not insert a new node for the folder that was just created. How can I insert a node into the tree when a folder is created and have the tree display the new folder? Many thanks! This class creates and displays the tree. import javax.swing.*; import javax.swing.event.TreeSelectionEvent; import javax.swing.event.TreeSelectionListener; import javax.swing.tree.*; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; public class TreeFrame extends JFrame{ private JTree fileTree = null; private String USER_HOME = System.getProperty("user.home"); public TreeFrame(){ super("File Tree"); setDefaultCloseOperation(EXIT_ON_CLOSE); //Create tree DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode(new File(USER_HOME)); fileTree = new JTree(new FileTreeModelTest(rootNode)); fileTree.setCellRenderer(new TreeCellRendererTest()); fileTree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { //Commented out the next part because it causes a null pointer exception. //I believe it is caused by the tree not inserting a node. //JTree tree = (JTree)e.getSource(); //DefaultMutableTreeNode node = (DefaultMutableTreeNode)tree.getLastSelectedPathComponent(); //Object obj = node.getUserObject();//Causes a null pointer exception //if(obj instanceof File){ // File f = (File)node.getUserObject(); // System.out.println(f.getAbsolutePath()); //} } }); JPanel panel = new JPanel(); JLabel folderLabel = new JLabel("Name:"); panel.add(folderLabel, BorderLayout.WEST); final JTextField textField = new JTextField(25); textField.setPreferredSize(new Dimension(100, 28)); panel.add(textField, Bo…
score: 0
accepted answer: http://stackoverflow.com/a/27349862

http://stackoverflow.com/a/27437494
type: Answer
has comment: http://stackoverflow.com/comment/43318173
has comment: http://stackoverflow.com/comment/43318106
score: 0
has body: static final String DB_URL = "jdbc:mysql://localhost/"; Where is your database name and port in DB_URL ? Please change as below and let us know again the status ? static final String DB_URL = "jdbc:mysql://localhost/3306/yourdb"; Here is the best example for Connect to MySQL with JDBC. http://www.mkyong.com/jdbc/how-to-connect-to-mysql-with-jdbc-driver-java/
answers question: http://stackoverflow.com/q/27437391

http://stackoverflow.com/comment/43197977
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27373152
has text: My code was posted Above after Debugging @MysticMagic
score: 0

http://stackoverflow.com/a/27421480
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43288218
type: Answer
has body: I would do that with css, just set a class to the label you want to wrap the text and use the white-space and text-overflow properties grid.addStyleName("fixed") label.addStyleName("wrap") .fixed { table-layout: fixed; } .wrap { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
has comment: http://stackoverflow.com/comment/43285531
accepted answer of: http://stackoverflow.com/q/27421279
has comment: http://stackoverflow.com/comment/43285845
answers question: http://stackoverflow.com/q/27421279
score: 0

gwt
tags question: http://stackoverflow.com/q/27432635
tags question: http://stackoverflow.com/q/27382397
tags question: http://stackoverflow.com/q/27421279
tag name: gwt
tags question: http://stackoverflow.com/q/27433642
tags question: http://stackoverflow.com/q/27400741
tags question: http://stackoverflow.com/q/27376506
tags question: http://stackoverflow.com/q/27415627
type: Tag
tags question: http://stackoverflow.com/q/27453701
tags question: http://stackoverflow.com/q/27383517
tags question: http://stackoverflow.com/q/27358867
tags question: http://stackoverflow.com/q/27384033
tags question: http://stackoverflow.com/q/27400907
tags question: http://stackoverflow.com/q/27445857
tags question: http://stackoverflow.com/q/27346361
tags question: http://stackoverflow.com/q/27320573
tags question: http://stackoverflow.com/q/27458617
tags question: http://stackoverflow.com/q/27428830
tags question: http://stackoverflow.com/q/27359368
tags question: http://stackoverflow.com/q/27377608
tags question: http://stackoverflow.com/q/27431636
tags question: http://stackoverflow.com/q/27388713
tags question: http://stackoverflow.com/q/27364752
tags question: http://stackoverflow.com/q/27405492
tags question: http://stackoverflow.com/q/27395877
tags question: http://stackoverflow.com/q/27426869
tags question: http://stackoverflow.com/q/27329910
tags question: http://stackoverflow.com/q/27438467
tags question: http://stackoverflow.com/q/27316096
tags question: http://stackoverflow.com/q/27375857
tags question: http://stackoverflow.com/q/27458951

http://stackoverflow.com/comment/43223897
type: AnswerComment
type: Comment
has text: @Trollkemada: I guess I misunderstood what you were trying to achieve. I'll update my answer.
comment on: http://stackoverflow.com/a/27383445
score: 0

http://stackoverflow.com/q/27422582
type: AnsweredQuestion
has title: How to create a unique new file
tagged with: java
tagged with: file
type: Question
has comment: http://stackoverflow.com/comment/43288519
accepted answer: http://stackoverflow.com/a/27422700
has comment: http://stackoverflow.com/comment/43288415
score: 0
has comment: http://stackoverflow.com/comment/43290239
has answer: http://stackoverflow.com/a/27422700
answer count: 1
has comment: http://stackoverflow.com/comment/43315155
has comment: http://stackoverflow.com/comment/43288694
has comment: http://stackoverflow.com/comment/43288756
has body: I´m running a test getting some information from the web, and I send it to excel file. But everytime that I run my test, it overwrites the previous file. Is there anyway to create a new file and not overwrite the other one with another name? If possible, can the name of the file be something that I want with the date that i ran the test? This is the part that I create the excel file: public void xlWrite(String strXLWrite) { try{ FileOutputStream outTestDataStream = new FileOutputStream("C:/Users/P_701362/Desktop/resultadoSiconv.xls"); HSSFWorkbook xlWorkBook = new HSSFWorkbook(); HSSFSheet mySheet = xlWorkBook.createSheet("Sheet1"); for (int i = 0; i &lt; xlRows; i++) { HSSFRow row = mySheet.createRow(i); for (int j = 0; j &lt; 6; j++) { HSSFCell cells = row.createCell(j); cells.setCellValue(new HSSFRichTextString(localArray[i][j])); } } xlWorkBook.write(outTestDataStream); }catch (Exception e) { } }
has comment: http://stackoverflow.com/comment/43288316

http://stackoverflow.com/a/27438548
has body: When you make a HTTPS connection, the server you connect to sends his certificate to prove you got the right server. This certificate is normally signed by another certificate, either by that of a CA (certificate authority), or by just another certificate, which in turn is signed. However long that chain is, on the bottom you find the certificate of a CA. How do you know that this CA certificate is ok? Java solves this problem by storing the certificates of all trusted CAs in a keystore (cacerts). The error you are facing is most likely the result of a certificate signed by a CA that is not in the keystore. It is either a self-signed certificate (the certificate itself acting as its own CA), a certificate signed by an in-house CA of some company, or by a small unknown CA. Yo have to decide whether you want to trust all certificates signed by this CA. In that case take the CA certificate, and put it in your cacerts file. I have no idea on how to do that on android, though. The standard java tool to do this is keytool.
score: 0
answers question: http://stackoverflow.com/q/27438034
type: Answer

http://stackoverflow.com/comment/43330955
score: 1
type: AnswerComment
has text: This doesn't apply to powers of two. Every bit has an equal chance of being 0 or 1 and when you `% powerOf2` you mask out the upper bits and the lower bits are unchanged, just as random as they were.
type: Comment
comment on: http://stackoverflow.com/a/27445931

http://stackoverflow.com/q/27335292
linked to: http://stackoverflow.com/q/27334155
score: 0
duplicate of: http://stackoverflow.com/q/27334155
tagged with: jtextcomponent
has body: I got this error after I extended JTextComponent UIDefaults.getUI() failed: no ComponentUI class for: com.mypackage.components.FlowComponent[,0,0,0x0,invalid,alignmentX=0.0,alignmentY=0.0,border=,flags=0,maximumSize=,minimumSize=,preferredSize=,caretColor=,disabledTextColor=,editable=true,margin=,selectedTextColor=,selectionColor=] java.lang.Error I am know this has something to do with the UI however I have no idea how UI works and because of that I am using the default lookandFeel The full text of the class that throws the exception every time it is called: public class FlowComponent extends JTextComponent { /////// Constructor /////// FlowType type; String data = null; FontMetrics fm; PlainDocument doc = new PlainDocument(); public FlowComponent(FlowType type) { this.type = type; setDocument(doc); } /////// Main Methods //////// @Override public Dimension getPreferredSize() { switch(type) { case START: return new Dimension(200, 60); case END: return new Dimension(200, 60); case PROCESS: return new Dimension(200, 60); case INPUT_OUTPUT: return new Dimension(200, 60); case DECISION: return new Dimension(180, 100); default: return null; } } /////// Paint Methods //////// @Override public void paintComponent(Graphics g) { Graphics2D g2 = (Graphics2D) g; super.paintComponent(g2); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); try { paintChoice(g2); } catch (BadLocationException e) { e.printStackTrace(); } } public void paintChoice(Graphics2D g2) throws BadLocationException { fm = g2.getFontMetrics(); switch (type) { case START: data = "Start"; doc.insertString(0, data, null); paintStartEnd(g2); break; case END: data = "End"; paintStartEnd(g2); break; case PROCESS: data = ""; paintProcess(g2); break; case INPUT_OUTPUT: data = ""; paintInputOutput(g2); break; case DECISION: data = ""; paintDecision(g2); break; } } private void paintStartEnd(Graphics2D g2) { int stringx = (getWidth() - fm.stringWidth(data)) / 2; int stringy = (ge…
has comment: http://stackoverflow.com/comment/43127870
tagged with: exception
type: UnansweredQuestion
has title: UIError after extending JTextComponent
linked to: http://stackoverflow.com/q/11454506
has comment: http://stackoverflow.com/comment/43128276
answer count: 0
tagged with: java
tagged with: swing
tagged with: uimanager
type: Question
has comment: http://stackoverflow.com/comment/43133497
has comment: http://stackoverflow.com/comment/43128306

http://stackoverflow.com/a/28594573
accepted answer of: http://stackoverflow.com/q/27326981
upvote count: 5
score: 5
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27326981
has body: Unfortunately, this is not the type of warning you can suppress. At least it looks like the fix has been back-ported to the 4.4.2 maintenance release of Luna, which is due to be released on February 27, 2015: https://projects.eclipse.org/projects/eclipse/releases/4.4.2/plan

http://stackoverflow.com/q/27440446
score: 0
has body: To receive Jboss JMS messsage, I have written the JMS Asynchronous Message Receiver See below code public class QueueReceive implements MessageListener { public final static String JNDI_FACTORY="org.jnp.interfaces.NamingContextFactory"; public final static String JMS_FACTORY="ConnectionFactory"; public final static String QUEUE="/queue/requestQueue"; private QueueConnectionFactory qconFactory; private QueueConnection qcon; private QueueSession qsession; private QueueReceiver qreceiver; private Queue queue; private boolean quit = false; public void onMessage(Message msg) { try { System.out.println("onMessage"); String msgText; if (msg instanceof TextMessage) { msgText = ((TextMessage)msg).getText(); } else { msgText = msg.toString(); } System.out.println("Message Received: "+ msgText ); if (msgText.equalsIgnoreCase("quit")) { synchronized(this) { quit = true; this.notifyAll(); // Notify main thread to quit } } } catch (JMSException jmse) { System.err.println("An exception occurred: "+jmse.getMessage()); } } public void init(Context ctx, String queueName) throws NamingException, JMSException { qconFactory = (QueueConnectionFactory) ctx.lookup(JMS_FACTORY); qcon = qconFactory.createQueueConnection(); qsession = qcon.createQueueSession(false, Session.AUTO_ACKNOWLEDGE); queue = (Queue) ctx.lookup(queueName); qreceiver = qsession.createReceiver(queue); qreceiver.setMessageListener(this); qcon.start(); } public void close()throws JMSException { qreceiver.close(); qsession.close(); qcon.close(); } public static void main(String[] args) throws Exception { InitialContext ic = getInitialContext("jnp://host:port"); QueueReceive qr = new QueueReceive(); System.out.println("Ready to initialize"); qr.init(ic, QUEUE); System.out.println("JMS Ready To Receive Messages (To quit, send a \"quit\" message)."); // qr.onMessage(qr.qreceiver.receive()); System.out.println("Message Receivd"); // Wait until a "quit" message has been received. synchronized(qr) { while (!qr.quit) { try { qr.wa…
tagged with: jms
has comment: http://stackoverflow.com/comment/43445642
answer count: 0
type: UnansweredQuestion
upvote count: 1
downvote count: 1
tagged with: java
has title: How to implement the JMS Asynchronous Message Receiver
type: Question
has comment: http://stackoverflow.com/comment/43320637
favorite count: 0
has comment: http://stackoverflow.com/comment/43321840

http://stackoverflow.com/comment/43289040
comment on: http://stackoverflow.com/q/27423318
score: 0
type: Comment
has text: Do you have the 'Preferences > General > Workspace > Refresh using native hooks or polling' option selected?
type: QuestionComment

http://stackoverflow.com/comment/43292653
comment on: http://stackoverflow.com/a/27423647
score: 0
type: AnswerComment
has text: Just tested this out on a Windows Server and would you believe that /work/logs/20141211.log found this C:/work/logs/20141211.log - Thanks Alex
type: Comment

http://stackoverflow.com/q/27403966
tagged with: java
has body: I try to find the best way to make an image clickable with different action depending on the area you click. For now, my window display an EFTPOS (image found on google image) using : getContentPane().add(new JPanelBackground("./img/background.png", "./img/eftposAboveBackground.png", this.getWidth(), this.getHeight())); Now, I would like to click on every EFTPOS's buttons. I was thinking of create some transparent buttons at the buttons's positions but : First, I don't want to use an absolute layer Second, the Swing GUI design editor (Netbeans) doesn't display my background image since I used the code above. I'm pretty sure there is another way than setting my eftpos on the background, maybe using the ImageIcon class.. Any help would be greatly appreciated!
tagged with: image
tagged with: clickable
accepted answer: http://stackoverflow.com/a/27405295
downvote count: 0
answer count: 1
tagged with: button
favorite count: 0
has title: Java Swing : best way to set background image clickable
upvote count: 1
tagged with: swing
has answer: http://stackoverflow.com/a/27405295
type: Question
type: AnsweredQuestion
score: 1

http://stackoverflow.com/q/27432575
tagged with: jpa
has title: JPA dont want to fetch OneToMany Object (One Level deep)
has answer: http://stackoverflow.com/a/27432610
tagged with: rest
has body: I am using Spring Data Rest. It works great except that I have a REST call that I need to just return the top object and not have the OneToMany object returned. How do I do this? For example: So I have a Rest interface with "/States" and "StatesWithHotels". There is a OneToMany from the State JPA object to the Hotel JPA object. The "/States" should just return just the States and the "StatesWithHotels" should return State object with the corresponding Hotel objects. The "StatesWithHotels" works perfect in which it returns States and Hotels. But the "States" I just need to return just States, but it is returning both.
type: UnansweredQuestion
tagged with: spring
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27434485
score: 0
answer count: 2

http://stackoverflow.com/q/27466041
has comment: http://stackoverflow.com/comment/43369067
tagged with: button
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43369204
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/27466764
has title: How to make a parse.com log out button to take me to another activity which lets me either log in or sign up?
tagged with: parse-platform
has body: i have an activity that lets me sign up or simply log in, when the user has been logged in, four fragments, which can be navigated through scrollable tabs are displayed, the last fragment has a log out button, i need that log out button to 1)log out directly from parse.com and 2)get the user to the activity where they can sign up or sign in. This is the code that i have so far THIS IS THE SIGN IN OR SIGN UP ACTIVITY @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.signup_or_login); // Log in button click handler ((Button) findViewById(R.id.login)).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Starts an intent of the log in activity startActivity(new Intent(SignUpOrLogInActivity.this, LoginActivity.class)); } }); // Sign up button click handler ((Button) findViewById(R.id.signup)).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Starts an intent for the sign up activity startActivity(new Intent(SignUpOrLogInActivity.this, SignUpActivity.class)); } }); } THIS IS THE SET UP FRAGMENT WHERE THE LOG OUT BUTTON IS LOCATED @Override public View onCreateView(LayoutInflater inflater,ViewGroup container,Bundle savedInstanceState) { return inflater.inflate(R.layout.setup_fragment,container,false); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); logout = (Button) getView().findViewById(R.id.logout_button); // Logout Button Click Listener logout.setOnClickListener(new OnClickListener() { public void onClick(View view) { // Logout current user ParseUser.logOut(); startActivity(new Intent(getActivity(), SignUpOrLogInActivity.class)); } }); } } The problems are 1)that when i run the app, it first starts at the scrollable tabs (the fragments) and not at the sign in or sign up activity and 2)when i go to the set up fragment where the log out button is located the app crashes and a message is displayed…
has comment: http://stackoverflow.com/comment/43369151
upvote count: 1
tagged with: fragment
has comment: http://stackoverflow.com/comment/43369110
answer count: 1
has comment: http://stackoverflow.com/comment/43369088
tagged with: java
has answer: http://stackoverflow.com/a/27466764
has comment: http://stackoverflow.com/comment/43369181
type: AnsweredQuestion

http://stackoverflow.com/comment/43379217
type: AnswerComment
score: 0
type: Comment
has text: Great, thanks! (And I learned sth about protected prefix, I never used before on that way ;-) )
comment on: http://stackoverflow.com/a/27471987

http://stackoverflow.com/q/27332438
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27332461
has body: The app is crashing the second i open it... it says it crashes due to NullPointerException but i cant figure out why. this is the logCat: 12-06 08:37:58.217: D/AndroidRuntime(1138): Shutting down VM 12-06 08:37:58.217: W/dalvikvm(1138): threadid=1: thread exiting with uncaught exception ( (group=0xb2aeaba8) 12-06 08:37:58.247: E/AndroidRuntime(1138): FATAL EXCEPTION: main 12-06 08:37:58.247: E/AndroidRuntime(1138): Process: com.example.batandball, PID: 1138 12-06 08:37:58.247: E/AndroidRuntime(1138): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.batandball/com.example.batandball.MainActivity}: java.lang.NullPointerException 12-06 08:37:58.247: E/AndroidRuntime(1138): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195) 12-06 08:37:58.247: E/AndroidRuntime(1138): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2245) 12-06 08:37:58.247: E/AndroidRuntime(1138): at android.app.ActivityThread.access$800(ActivityThread.java:135) 12-06 08:37:58.247: E/AndroidRuntime(1138): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196) 12-06 08:37:58.247: E/AndroidRuntime(1138): at android.os.Handler.dispatchMessage(Handler.java:102) 12-06 08:37:58.247: E/AndroidRuntime(1138): at android.os.Looper.loop(Looper.java:136) 12-06 08:37:58.247: E/AndroidRuntime(1138): at android.app.ActivityThread.main(ActivityThread.java:5017) 12-06 08:37:58.247: E/AndroidRuntime(1138): at java.lang.reflect.Method.invokeNative(Native Method) 12-06 08:37:58.247: E/AndroidRuntime(1138): at java.lang.reflect.Method.invoke(Method.java:515) 12-06 08:37:58.247: E/AndroidRuntime(1138): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779) 12-06 08:37:58.247: E/AndroidRuntime(1138): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595) 12-06 08:37:58.247: E/AndroidRuntime(1138): at dalvik.system.NativeStart.main(Native Method) 12-06 08:37:58.247: E/AndroidRuntime(1138): Caused…
accepted answer: http://stackoverflow.com/a/27332461
type: Question
has comment: http://stackoverflow.com/comment/43122399
has comment: http://stackoverflow.com/comment/43122449
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43123787
has comment: http://stackoverflow.com/comment/43122425
tagged with: android
has title: App crashes.... NullPointerException

http://stackoverflow.com/comment/43448880
type: Comment
has text: right, but for some apps that is OK since it's more of a now or never requirement ... ie if you are requesting the device to send it's location to the server you might only be interested in the location at that moment.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27471347

http://stackoverflow.com/q/27319051
upvote count: 7
has comment: http://stackoverflow.com/comment/43133711
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/45271635
tagged with: spring-data-jpa
has body: I have a project that uses Spring Boot to generate an executable JAR that exposes a REST API with Spring Data REST. It is also integrated with Spring Security OAuth. That works fine. My problem is the following, I want to have different modules for the REST API that I want to enable only if the correspondent JAR with the JPA repositories is in the classpath (it has been defined as a dependency). The thing is I want them to be independent from each other. I want to be able to serve them under different dispatcher servlets with different mappings so I can specify different baseUri for each one and have different root URLs for the resources discovery. I´m gonna try to make it more clear: Module A of API: A JAR containing for example XRespository and YRespository for resources X and Y. Dispatcher servlet A. Servlet mapping: /api/moduleA/ Base URI for Spring Data REST: /api/moduleA/ If I check URL /api/moduleA/ I should discover resources X and Y. Module B of API: A JAR containing for example PRespository and QRespository for resources P and Q. Dispatcher servlet B. Servlet mapping: /api/moduleB/ Base URI for Spring Data REST: /api/moduleB/ If I check URL /api/moduleB/ I should discover resources P and Q. More modules... Apart from that I can have another dispatcher servlet where I hold /oauth/* endpoints along with other custom controllers, and the security configuration has to work properly for all (/*) I know I can define more dispatcher servlets through ServletRegistrationBean but I don´t know how to attach to each one different spring data rest configurations. I´ve also been trying to do this with hierarchical application contexts with SpringApplicationBuilder by having in each child context the configuration that defines each dispatcher servlet, each RepositoryRestMvcConfiguration and having each @EnableJpaRepositories annotation defining different packages to scan. Anyway I can´t not even load the context as they are not created as WebApplicationContext thus faili…
tagged with: spring
downvote count: 0
has answer: http://stackoverflow.com/a/28499159
accepted answer: http://stackoverflow.com/a/28499159
type: AnsweredQuestion
tagged with: spring-boot
score: 7
tagged with: java
has title: Spring Boot (JAR) with multiple dispatcher servlets for different REST APIs with Spring Data REST
type: Question
tagged with: spring-data-rest

http://stackoverflow.com/q/27374624
tagged with: java
has answer: http://stackoverflow.com/a/27375014
has comment: http://stackoverflow.com/comment/43204672
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/27375038
has comment: http://stackoverflow.com/comment/43207288
downvote count: 0
favorite count: 0
has title: Spring autowiring bean with mixed constructor
has comment: http://stackoverflow.com/comment/43202863
upvote count: 3
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/58790893
score: 3
has comment: http://stackoverflow.com/comment/43206101
has body: I have two beans like this: @Component @Scope("prototype") class A { A(int number, B anotherBean) { //... } } @Component class B { //.. } How can I build A and have B autowired? If I use new I won't get anotherBean's value, if I use autowiring I won't get number's value. Edit: The number is calculated at runtime, so I can't use @Value like answers suggested.

http://stackoverflow.com/q/27348232
has title: Is log4j compatible with Mac OS Leopard
has answer: http://stackoverflow.com/a/27348429
accepted answer: http://stackoverflow.com/a/27348429
score: 0
answer count: 1
has body: I am developing a Java application on a Mac OS Leopard. And I want to use Log4J and various logging. Is Log4J compatible with Mac OS ? So far I've only seen Log4J used on Windows machines.
tagged with: log4j
type: AnsweredQuestion
tagged with: log4j2
type: Question
tagged with: java

http://stackoverflow.com/q/27387031
has answer: http://stackoverflow.com/a/27387092
accepted answer: http://stackoverflow.com/a/27387092
type: Question
type: AnsweredQuestion
tagged with: enums
tagged with: java
answer count: 2
upvote count: 1
has title: Refer to value of enum itself in static method of an enum
has answer: http://stackoverflow.com/a/27387081
favorite count: 0
tagged with: static-methods
has comment: http://stackoverflow.com/comment/43223021
possible better answer: http://stackoverflow.com/a/27387081
has comment: http://stackoverflow.com/comment/43222604
has body: I have a Java enum with a static method and I want to refer to the value of the enum in the method: public enum SpeedUnits { knots { @Override public String getAbbreviation(){ return "kts"; } }, feetpersecond { @Override public String getAbbreviation(){ return "fps"; } }; public abstract String getAbbreviation(); public static SpeedUnits forAbbreviation( String sAbbreviation ){ if( sAbbreviation == null ) return null; if( sAbbreviation.equalsIgnoreCase( "kts" ) ) return knots; if( sAbbreviation.equalsIgnoreCase( "fps" ) ) return feetpersecond; return null; } public static int convertToIntegerKnots( int value ){ if( *** speed-type-goes-here *** == knots) return value; if( *** speed-type-goes-here *** == feetpersecond ) return (int)( value * 0.592483801295896 ); } } So, for example, I want to call convert like follows: SpeedUnits eMySpeedUnit = SpeedUnits.feetpersecond; int knots = eMySpeedUnit.convertToIntegerKnots( 80 ); How do I refer to the current value of the enum variable within the static method (see *** places in code above) ?
downvote count: 0
score: 1

http://stackoverflow.com/comment/43431218
type: Comment
has text: Your answer looks most complete for other people with similar problems thats why I select it for the bounty.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27380007

http://stackoverflow.com/comment/43297665
type: AnswerComment
has text: When do you get 83? It should only be 0 and 1.
type: Comment
comment on: http://stackoverflow.com/a/27373724
score: 0

http://stackoverflow.com/q/27469999
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27470113
accepted answer: http://stackoverflow.com/a/27471320
has title: Auto_increment ID in Java-Sqlite code
type: Question
downvote count: 0
answer count: 2
tagged with: sql
tagged with: sqlite
has answer: http://stackoverflow.com/a/27471320
has body: I'm trying to use SQLite with java, I wrote a piece of code that given three String(s) name sname1 sname2 has to populate the table |---------------------| |ID|NAME|SNAME1|SNAME2| |1 |Ale |test |test2 | |---------------------| How could I auto_increment the ID? I tried to use auto_increment in the creation of the table but I got exceptions in populating the table, so I'm looking for a good way to do it. As you can see from the code, at the moment everytime I execute the program I can INSERT only one row. package database; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Scanner; /** * * @author MITROTTA */ public class Database { /** * @param args the command line arguments */ public static void main(String[] args) throws SQLException { Connection c = null; Statement stmt = null; String sql; //Variabili Database String name; String sname1, sname2; Scanner in = new Scanner(System.in); try { Class.forName("org.sqlite.JDBC"); c = DriverManager.getConnection("jdbc:sqlite:test.db"); c.setAutoCommit(false); System.out.println("Opened database successfully"); //Creazione tabella stmt = c.createStatement(); sql = "CREATE TABLE IF NOT EXISTS COMPANY " + "(ID INT PRIMARY KEY NOT NULL," + " NAME CHAR(30) NOT NULL, " + " SNAME1 CHAR(30) NOT NULL, " + " SNAME2 TEXT)"; stmt.executeUpdate(sql); System.out.print("Type name: "); name = in.nextLine(); System.out.print("Type sname1: "); sname1 = in.nextLine(); System.out.print("Type sname2: "); sname2 = in.nextLine(); sql = "INSERT INTO COMPANY (ID,NAME,SNAME1,SNAME2) " + "VALUES (2, '" + name + "','" + sname1 + "','" + sname2 + "');"; stmt.executeUpdate(sql); ResultSet rs = stmt.executeQuery( "SELECT * FROM COMPANY;" ); while ( rs.next() ) { int id = rs.getInt("ID"); String name1 = rs.getString("NAME"); String name2 = rs.getString("SNAME1"); String name3 = rs.getString("SNAME2"); System.out.println( "ID = " + id ); System.ou…
favorite count: 0
has comment: http://stackoverflow.com/comment/43375183
upvote count: 1
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27470113

http://stackoverflow.com/a/27489572
type: Answer
upvote count: 3
score: 3
answers question: http://stackoverflow.com/q/27464781
downvote count: 0
has body: If you're using Eclipse Collections (formerly GS Collections), you can use the method distinct(). ListIterable&lt;Integer&gt; listInts = FastList.newListWith(1, 1, 3, 77, 2, 19, 77, 123, 14, 123); Assert.assertEquals( FastList.newListWith(1, 3, 77, 2, 19, 123, 14), listInts.distinct()); The advantage of using distinct() instead of converting to a Set and then back to a List is that distinct() preserves the order of the original List, retaining the first occurrence of each element. It's implemented by using both a Set and a List. MutableSet&lt;T&gt; seenSoFar = UnifiedSet.newSet(); int size = list.size(); for (int i = 0; i &lt; size; i++) { T item = list.get(i); if (seenSoFar.add(item)) { targetCollection.add(item); } } return targetCollection; If you cannot convert your original List into a GS Collections type, you can use ListAdapter to get the same API. MutableList&lt;Integer&gt; distinct = ListAdapter.adapt(integers).distinct(); There's no way to avoid the creation of the Set. Still, UnifiedSet is more efficient than HashSet so there will be some speed benefit. If all you want is the number of distinct items, it's more efficient to just create a set without creating the list. Verify.assertSize(7, UnifiedSet.newSet(listInts)); Eclipse Collections 8.0 requires Java 8. Eclipse Collections 7.x works well with Java 8, but only requires Java 5. Note: I am a committer for Eclipse collections.

http://stackoverflow.com/q/27438473
accepted answer: http://stackoverflow.com/a/27438780
favorite count: 0
linked to: http://stackoverflow.com/q/11952212
has body: How to make the RequestMapping to handle GET parameters in the url? For example i have this url localhost:8080/MyApplication/spm/gcNkyLXkwv how to get the spm value from the above url
upvote count: 2
downvote count: 2
has title: SpringMVC RequestMapping for GET url parameters
answer count: 1
tagged with: spring-mvc
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/18373165
has answer: http://stackoverflow.com/a/27438780
has comment: http://stackoverflow.com/comment/82931999
linked to: http://stackoverflow.com/q/4904092
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/43124376
has text: From a performance point of view, you have to read the results at least once. If you need to traverse it more than once then copying might be faster.
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27333465

http://stackoverflow.com/a/27320877
has comment: http://stackoverflow.com/comment/43101363
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27320717
type: Answer
answers question: http://stackoverflow.com/q/27320717
has body: The program has thrown a RuntimeException, but you "swallow" the exception by just printing out "caught". You ignore the reference to the RuntimeException catch block. Append e.getClass() to your System.out like below and you will see the RuntimeExcetion. class RTExcept { public static void throwit(){ System.out.print("throwit "); throw new RuntimeException(); } public static void main(String[] args) { try{ System.out.print("hello "); throwit(); } catch (Exception e){ System.out.print(" caught " + e.getClass()); } finally{ System.out.print(" finally "); } System.out.print(" after "); } } prints: hello throwit caught class java.lang.RuntimeException finally after

http://stackoverflow.com/a/27371696
has comment: http://stackoverflow.com/comment/43194724
answers question: http://stackoverflow.com/q/27371565
has comment: http://stackoverflow.com/comment/43196909
upvote count: 7
has comment: http://stackoverflow.com/comment/43230099
accepted answer of: http://stackoverflow.com/q/27371565
downvote count: 0
has comment: http://stackoverflow.com/comment/43194881
has comment: http://stackoverflow.com/comment/43196638
has comment: http://stackoverflow.com/comment/43230362
has comment: http://stackoverflow.com/comment/43230556
type: AcceptedAnswer
score: 7
has comment: http://stackoverflow.com/comment/58086241
has comment: http://stackoverflow.com/comment/43230215
has comment: http://stackoverflow.com/comment/43219684
has comment: http://stackoverflow.com/comment/43196659
type: Answer
has body: What I've found is the "best" way to do it (in my opinion, of course) is to do the following: Have the fragment contain methods to set the customizable data (background, text, etc) Note: Be careful of trying to load the data in when first creating the fragment. You may be able to set the data before onCreateView() even runs, or at other times it may run after onCreateView(). I personally use a boolean to check if the data has been set. Inside onCreateView() [or onActivityCreated()], I check if the data has been set already. If it has, load in the data. Alternatively, while setting the data, I check if the views have been created/cached already. This is done by simply having variables to cache the data, say private ImageView mBackgroundView. If the view is not null, then I safely set the data on the views. The above is also an alternative to using newInstance, although both methods work pretty well. However, for more flexibility, I only use newInstance if a) the data is already known before the fragment has to be inserted and b) the data doesn't need to change according to input from elsewhere much. Let the ViewPager handle all the data Pass in all the data - a list of ImageViews, a array of Strings, define where all the data is in Resources, etc - at the very beginning [say, in the constructor] Have the ViewPager create an ArrayList of the fragments- set up each fragment as early as possible (say when first getting all the data) and add it to the list Let getCount() just use the size of the list Let getItem() just get the item in the list at the position Note: If you have any dynamic data, set it up in the getItem() method. Furthermore, you can always add more data+fragments during runtime as well [just notify the adapter that the dataset has been changed] Essentially, the fragment is like a simple servant- it does simply the least work necessary. If it doesn't have to handle choosing the data, all the better. It'll thus be far more flexible. Just give methods to se…
has comment: http://stackoverflow.com/comment/43230537

http://stackoverflow.com/comment/43121194
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27331522
has text: Probably this question is better fit for http://programmers.stackexchange.com/

http://stackoverflow.com/a/27329052
has comment: http://stackoverflow.com/comment/43116648
has body: You need catch SocketTimeoutException and a return statement in catch block then only it will go to onPostExecute catch (SocketTimeoutException ste) { return null; } catch (IOException e) { return null; } And handle it in onPostExecute @Override protected void onPostExecute(String result) { super.onPostExecute(result); Log.i("RAE"," Asyc finished"); if (result !=null) { // your code } else { // You got an exception }
has comment: http://stackoverflow.com/comment/43116661
upvote count: 1
score: 1
accepted answer of: http://stackoverflow.com/q/27329001
has comment: http://stackoverflow.com/comment/43116665
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43116855
downvote count: 0
has comment: http://stackoverflow.com/comment/43116888
answers question: http://stackoverflow.com/q/27329001
has comment: http://stackoverflow.com/comment/43116887
type: Answer

http://stackoverflow.com/a/27362293
answers question: http://stackoverflow.com/q/27362129
type: Answer
has body: Yes...but Yes, you can have an array of Vehicles, eg Bus1, Bus2 and Bike1. ...But that doesn't stop your Bike being a Bike, or turn it into a Bus. An array is a list of references to objects, it doesn't take a new copy of the object and turn it into the type of the array: the objects will still be instances of their original class The Array can hold vehicles regardless of their sub-class, it doesn't change them into Buses, Bikes or Vehicles: the type stays the same. You can try to cast a bike as a bus, however: if you accept that you'll lose any non-bus attributes. You can also use instanceof to decide if the Vehicle is a Bus already, or a Bike, and do conversion stuff if required ie for (Vehicle v: myFleet){ // For each vehicle in the fleet Bus b = (Bus) v; // Turn the vehicle into a bus b.issueTicket(1.50); System.out.println(b); }
score: 0

http://stackoverflow.com/q/27470451
favorite count: 0
has comment: http://stackoverflow.com/comment/43384376
downvote count: 0
has body: I'm trying to access a mysql database through R console using RJDBC in a mac os X system, but R console crash just after type in " > library('RJDBC') ". Immediately shows up a message indicating is necessary install the old Java 6 mac os version. I already installed the package typing " > install.packages('RJDBC', dependencies=TRUE) " My system have: OSX = Mac Os X (Yosemite) R version 3.1.2 (2014-10-31) java 7 installed and set JAVA_HOME env variable in my ./bash_profile file. echo $JAVA_HOME /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home And also if it is useful R CMD javareconf Java interpreter : /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/jre/bin/java Java version : 1.7.0_60 Java home path : /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home Java compiler : /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/bin/javac Java headers gen.: /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/bin/javah Java archive tool: /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/bin/jar System Java on OS X trying to compile and link a JNI progam detected JNI cpp flags : -I/System/Library/Frameworks/JavaVM.framework/Headers detected JNI linker flags : -framework JavaVM clang -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I/System/Library/Frameworks/JavaVM.framework/Headers -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -fPIC -Wall -mtune=core2 -g -O2 -c conftest.c -o conftest.o conftest.c:1:10: fatal error: 'jni.h' file not found #include &lt;jni.h&gt; ^ 1 error generated. make: *** [conftest.o] Error 1 Unable to compile a JNI program JAVA_HOME : /Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home Java library path: JNI cpp flags : JNI linker flags : Updating Java configuration in /Library/Frameworks/R.framework/Resources Done. What Am I doing wrong? I even checked an old post how to get rJava 0.9-3 to work on OS X 10.7.4 with Oracle Java 1…
type: UnansweredQuestion
tagged with: rjdbc
has comment: http://stackoverflow.com/comment/43377265
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/29110702
answer count: 1
linked to: http://stackoverflow.com/q/13610293
tagged with: http://stackoverflow.com/tag/r
upvote count: 1
has title: executing library('RJDBC') on R console shows java 6 installation message
tagged with: macos

http://stackoverflow.com/comment/43242158
comment on: http://stackoverflow.com/q/27398096
score: 0
type: Comment
type: QuestionComment
has text: Also if you are using something to randomize your cards, make sure you don't recreate the randomizer in every loop

http://stackoverflow.com/a/27447695
has body: Just change the code like this an you will be able to access the data everywhere. import android.util.Log; public class User { private static final User instance = new User(); public static User getInstance() { return instance; } private User() { super(); } private int account_id; private String user_id; private String sip_id; private String username; private String fullname; private boolean active; private boolean status; public int getAccount_id() { return account_id; } public void setAccount_id(int account_id) { Log.e("myphone", account_id + ""); this.account_id = account_id; } public String getUser_id() { return user_id; } public void setUser_id(String user_id) { this.user_id = user_id; } public String getSip_id() { return sip_id; } public void setSip_id(String sip_id) { this.sip_id = sip_id; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getFullname() { return fullname; } public void setFullname(String fullname) { this.fullname = fullname; } public boolean isActive() { return active; } public void setActive(boolean active) { this.active = active; } public boolean isStatus() { return status; } public void setStatus(boolean status) { this.status = status; } } You can set data to the user obj by accessing the instance like this //get user data from table public void getUserDetails() { String selectQuery = "SELECT * FROM user"; SQLiteDatabase db = this.getReadableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); cursor.moveToFirst(); if (cursor.getCount() &gt; 0) { //If you want you can hold the reference in a User obj = User.getInstance(); just to write less code User.getInstance().setSip_id(cursor.getString(1)); User.getInstance().setAccount_id(cursor.getString(2)); .... and so on } cursor.close(); db.close(); } If you need the data somewhere after you get the data, just do this for example: mEditText.setText(User.getInstance().getUsername());
upvote count: 2
type: Answer
score: 2
answers question: http://stackoverflow.com/q/27447282
downvote count: 0

http://stackoverflow.com/a/27462986
accepted answer of: http://stackoverflow.com/q/27462931
score: 0
type: Answer
has body: A more efficient way to get small random numbers is to use Random.nextInt(n) Random random = new Random(); String fourDigits = String.format("%04d", random.nextInt(10000));
answers question: http://stackoverflow.com/q/27462931
type: AcceptedAnswer

http://stackoverflow.com/comment/43184597
score: 0
has text: `if(yards[i] <= 0 || yards[i] >= 0)` What is the use of this?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27366329

http://stackoverflow.com/comment/43188474
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27367908
type: Comment
has text: @chazzlabs This means jacoco is not the source of the problem anymore. Try checking for the path to the jacoco report for sonar and see if it fits the exec files. If not, check for your sonar version support of java 8

http://stackoverflow.com/comment/96579474
type: Comment
has text: Work too if you use it on a .fxml instead of `url="@../../../../resources/iconfinder_heartbeat_1930261.png"` `url="file:resources/iconfinder_heartbeat_1930261.png"`
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27489048

jakarta-ee
tags question: http://stackoverflow.com/q/27367411
tags question: http://stackoverflow.com/q/27444934
tags question: http://stackoverflow.com/q/27344165
tags question: http://stackoverflow.com/q/27377423
tags question: http://stackoverflow.com/q/27419686
type: Tag
tags question: http://stackoverflow.com/q/27362221
tags question: http://stackoverflow.com/q/27341665
tags question: http://stackoverflow.com/q/27439463
tags question: http://stackoverflow.com/q/27418988
tags question: http://stackoverflow.com/q/27378694
tags question: http://stackoverflow.com/q/27423445
tags question: http://stackoverflow.com/q/27386639
tags question: http://stackoverflow.com/q/27386358
tags question: http://stackoverflow.com/q/27354321
tags question: http://stackoverflow.com/q/27459747
tags question: http://stackoverflow.com/q/27332658
tags question: http://stackoverflow.com/q/27363520
tags question: http://stackoverflow.com/q/27353493
tags question: http://stackoverflow.com/q/27356918
tags question: http://stackoverflow.com/q/27398584
tags question: http://stackoverflow.com/q/27474008
tags question: http://stackoverflow.com/q/27464343
tag name: jakarta-ee
tags question: http://stackoverflow.com/q/27426315
tags question: http://stackoverflow.com/q/27457810
tags question: http://stackoverflow.com/q/27381390
tags question: http://stackoverflow.com/q/27375192
tags question: http://stackoverflow.com/q/27352702
tags question: http://stackoverflow.com/q/27383780
tags question: http://stackoverflow.com/q/27332742
tags question: http://stackoverflow.com/q/27397925
tags question: http://stackoverflow.com/q/27436547
tags question: http://stackoverflow.com/q/27334574
tags question: http://stackoverflow.com/q/27356794
tags question: http://stackoverflow.com/q/27342154
tags question: http://stackoverflow.com/q/27424349
tags question: http://stackoverflow.com/q/27381427
tags question: http://stackoverflow.com/q/27470713
tags question: http://stackoverflow.com/q/27411885
tags question: http://stackoverflow.com/q/27387484
tags question: http://stackoverflow.com/q/27369404
tags question: http://stackoverflow.com/q/27337936
tags question: http://stackoverflow.com/q/27459210
tags question: http://stackoverflow.com/q/27397894
tags question: http://stackoverflow.com/q/27325728
tags question: http://stackoverflow.com/q/27425998
tags question: http://stackoverflow.com/q/27348803
tags question: http://stackoverflow.com/q/27317608
tags question: http://stackoverflow.com/q/27405071
tags question: http://stackoverflow.com/q/27393430
tags question: http://stackoverflow.com/q/27416251
tags question: http://stackoverflow.com/q/27406143
tags question: http://stackoverflow.com/q/27332326
tags question: http://stackoverflow.com/q/27472052
tags question: http://stackoverflow.com/q/27429484
tags question: http://stackoverflow.com/q/27465771
tags question: http://stackoverflow.com/q/27393098
tags question: http://stackoverflow.com/q/27397883

http://stackoverflow.com/q/27339089
has comment: http://stackoverflow.com/comment/43134765
has body: Lets say i have a hashmap with about 40k values. I need to get the top 10 keys with high values in descending order. HashMap&lt;String,Double&gt; balances = new HashMap&lt;String,Double&gt;(); I know that I can get the highest balance easily by just looping and checking against the last value, but how can i get the top 10 efficiently without multiple loops? Desired output: 1. &lt;key&gt; has balance of 500 2. &lt;key&gt; has balance of 400 3. &lt;key&gt; has balance of 300 4. &lt;key&gt; has balance of 200 5. &lt;key&gt; has balance of 100 6. &lt;key&gt; has balance of 50 7. &lt;key&gt; has balance of 45 8. &lt;key&gt; has balance of 40 9. &lt;key&gt; has balance of 30 10. &lt;key&gt; has balance of 10
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27339111
type: Question
has comment: http://stackoverflow.com/comment/43134790
has comment: http://stackoverflow.com/comment/43134749
answer count: 1
has answer: http://stackoverflow.com/a/27339111
score: 0
has title: Fastest way to arrange sort and print large HashMap?
has comment: http://stackoverflow.com/comment/43134696

http://stackoverflow.com/comment/43373687
type: Comment
has text: can you post your Log?
comment on: http://stackoverflow.com/a/27469260
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43229732
comment on: http://stackoverflow.com/q/27379075
score: 1
type: Comment
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete Verifiable Example) or [SSCCE](http://www.sscce.org/) (Short, Self Contained, Correct Example). But @mKorbel has given some good advice. Note that what you are doing now, by shoving a lot of code lines together is what I call 'programming by magic'. Unfortunately it does not work. You actually need to **read the documentation** for the methods being used, and try to ***understand*** what the documentation is telling you.
type: QuestionComment

http://stackoverflow.com/q/27419743
tagged with: spring
has comment: http://stackoverflow.com/comment/43283207
upvote count: 13
tagged with: spring-mvc
tagged with: java
has answer: http://stackoverflow.com/a/41630446
has answer: http://stackoverflow.com/a/27434034
answer count: 4
downvote count: 0
score: 13
accepted answer: http://stackoverflow.com/a/41630446
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/33826204
has body: I am trying to set up a REST endpoint that allows querying a user by their email address. The email address is the last portion of the path so Spring is treating foo@example.com as the value foo@example and truncating the extension .com. I found a similar question here Spring MVC @PathVariable with dot (.) is getting truncated However, I have an annotation based configuration using AbstractAnnotationConfigDispatcherServletInitializer and WebMvcConfigurerAdapter. Since I have no xml configuration, this solution will not work for me: &lt;bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"&gt; &lt;property name="useDefaultSuffixPattern" value="false" /&gt; &lt;/bean&gt; I have also tried this solution which uses regex but it has not worked either. @RequestMapping(value = "user/by-email/{email:.+}") Does anyone know how to turn off the suffix pattern truncation without xml?
has title: Spring - Path variable truncate after dot - annotation
favorite count: 0
has answer: http://stackoverflow.com/a/47795011
tagged with: rest
type: Question
possible better answer: http://stackoverflow.com/a/33826204
tagged with: spring-annotations

http://stackoverflow.com/q/27470341
score: 2
answer count: 0
type: UnansweredQuestion
has body: Could someone please shed some light on how the RecordReader initialize, progress and close method are invoked in MapReduce API. All I could find(w.r.t initialize) was 'initialize will be called once at initialization'. I know that using the InputFormat we get the split and pass it to the createRecordReader to get the instance of RecordReader. In the mapper run method we'll be using the nextKeyValue, getCurrentKey and getCurrentValue.
has comment: http://stackoverflow.com/comment/43375550
tagged with: java
tagged with: mapreduce
type: Question
upvote count: 2
tagged with: hadoop
has comment: http://stackoverflow.com/comment/43504106
downvote count: 0
has comment: http://stackoverflow.com/comment/43391079
favorite count: 0
has title: How is RecordReader initialize invoked in MapReduce API?
has comment: http://stackoverflow.com/comment/43376999

http://stackoverflow.com/a/27398321
has comment: http://stackoverflow.com/comment/43242532
upvote count: 2
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27398096
has body: It seems like you are never changing the value of tempCard in your for loop, thus both redHand and blackHand hold exactly the same cards, i.e. numerous references to the same initial tempCard. Maybe you have to pick a new tempCard in each iteration of the loop? for (index=0; index&lt;Deck.MAX_CARDSPER_DECK; index++){ tempCard=theDeck.getNextCard(); // move this line here? Also, it seems very odd that you add the card at first, depending on the color, to either redHand or blackHand, and then again to both hands, so there are effectively three copies of each card. Similarly to the first problem, you are never updating redCard and blackCard in your while loop; they remain the same card turned before the loop for the entire duration of the game. You have to turn new cards at the end of the while loop, e.g. blackCard = blackHand.turnCard(tempCard); redCard = redHand.turnCard(tempCard); } // end while Also, those lines like blackHand.tossFromHand(tempCard); should probably read blackHand.tossFromHand(blackCard); (and analogously for red).
type: Answer

http://stackoverflow.com/comment/43133711
comment on: http://stackoverflow.com/q/27319051
type: Comment
type: QuestionComment
has text: Since you are working with spring boot, why not deploy each spring data rest app in different tomcat and context(totally independently)? Perhaps you will need to setup a CORS to prevent cross domain. I can't see any problem with this approach.
score: 0

http://stackoverflow.com/q/27389990
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43227937
tagged with: java
score: -4
type: Question
has answer: http://stackoverflow.com/a/27390103
has title: I'm trying to do stuff with inheritance but none of it will work
tagged with: inheritance
tagged with: eclipse
downvote count: 4
has comment: http://stackoverflow.com/comment/43228047
upvote count: 0
answer count: 1
has body: Im trying to get different variables from loan but none of them ever get to loan.java. My inheritance goes from Loan.Java > BusinessLoan.java > CreateLoan.java. I can get a variable from CreateLoan to display in business but when I set it in business I can't grab it. And I know some of this stuff is stupid but this is my final so some of the stuff was required. Heres my code Loan.java package Construction; public class Loan implements LoanConstant{ public static int loanNumber; public static String lastName; public static int loanAmount; public static int interestRate; public static int term; public int primeRate; public int getLoanNumber() { return loanNumber; } public void setLoanNumber(int n) { n = loanNumber; } public String getLastName() { return lastName; } public void setLastName(String s) { s = lastName; } public int getLoanAmount() { return loanAmount; } public void setLoanAmount(int n) { n = loanAmount; if (loanAmount &gt; MAX_LOAN_AMOUNT) loanAmount = MAX_LOAN_AMOUNT; } public int getTerm() { return term; } public void setTerm(int n) { n = term; if (term == 1) { term = SHORT_TERM; } else if (term == 3) { term = MEDIUM_TERM; } else if(term == 5) { term = LONG_TERM; } else term = SHORT_TERM; } public int getInterestRate() { return interestRate; } public void setInterestRate(int i) { i = interestRate; } public static void displayAll() { System.out.println("The Company's Name is " + COMPANY_NAME); System.out.println("The loan number is " + loanNumber); System.out.println("The last name on the loan is " + lastName); System.out.println("The loan amount is " + loanAmount); System.out.println("The interest rate on the loan is " + interestRate); System.out.println("The term on the account is " + term); } } PersonalLoan.java package Construction; public class PersonalLoan extends Loan{ public PersonalLoan(int ln, String last, int la, int term) { setLoanNumber(ln); setLastName(last); setLoanAmount(la); setTerm(term); interestRate = (int)((primeRate * 0.02) + primeRa…
has comment: http://stackoverflow.com/comment/43228109
has comment: http://stackoverflow.com/comment/43228063

http://stackoverflow.com/comment/60427131
comment on: http://stackoverflow.com/q/27432256
has text: Hello @Joel, I am having problem in testing opencv with hadoop. As you said, you have successfully tested it, Can you please help me. I am getting error, UnsatisfiedLinkError , native method not found. I have also posted question regarding this , http://stackoverflow.com/questions/36270351/opencv-library-loaded-in-hadoop-but-not-working
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43328292
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27410298
has text: @fge - `$merge` or `$patch` would actually *break* inheritance, which is why I've been fighting it. At that point, there is no theoretical connection between the two schemas A and B - instead of extending the constraints, you've patched the document that describes the constraints. As an example, you could just as easily *remove* a property from A, which flies in the face of OOP inheritance.

http://stackoverflow.com/q/27377259
has body: I have something like: @Entity public class First { &lt;...&gt; @OneToMany @JoinColumn(name = "first-id", nullable = false) private List&lt;Second&gt; seconds = new ArrayList&lt;Second&gt;(); } @Entity @Subselect(...) public class FirstView { &lt;...&gt; private List&lt;Second&gt; seconds = new ArrayList&lt;Second&gt;(); } What should I do to have FirstView.seconds loaded on session.createCriteria(FirstView.class).add(&lt;...&gt;).list().
has answer: http://stackoverflow.com/a/27377260
type: AnsweredQuestion
has title: Hibernate @Subselect one to many field
type: Question
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/27377260
score: 0
answer count: 1

http://stackoverflow.com/q/27331263
has answer: http://stackoverflow.com/a/27331318
tagged with: readline
type: AnsweredQuestion
has body: I'm creating a forum with a Java interface and a C server. I have trouble sending a message from C to Java.... I created a socket (named "socket") that works, like this : socket = new Socket(adr, port); //adr and port are defined before But when doing this on the Java: String str =null; try { BufferedReader br = new BufferedReader( new InputStreamReader(socket.getInputStream()) ); while ((str=br.readLine()) != null &amp;&amp; str.length()&gt;0) { System.out.println("str = " + str); } br.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } It just can't receive the message from the server. It only shows the message when I brutally close the C server. Here is how the server sends the message through the Socket : write(client_sock,"0\0",strlen("0\0")); I have no idea how to receive this "0" without closing the server. Any ideas ?
downvote count: 0
score: 1
tagged with: java
type: Question
tagged with: forum
tagged with: http://stackoverflow.com/tag/c
answer count: 2
upvote count: 1
has title: Socket (C/Java) BufferedReader readLine() doesn't stop
favorite count: 0
has answer: http://stackoverflow.com/a/27333088
accepted answer: http://stackoverflow.com/a/27333088
tagged with: sockets
possible better answer: http://stackoverflow.com/a/27331318

http://stackoverflow.com/comment/43242674
type: QuestionComment
has text: Artifact change can't cause a `NoSuchMethodError`. Is the source code for Geoserver available? I'd go snoop around `org.geoserver.attachmentRS.AttachmentRS.getFile(AttachmentRS.java:310)`, but it still doesn't change the fact that `NSME` comes from the simple reason of having a different compile vs. runtime API. But if the method has been around since 7.3, it seems unlikely that you have a pre-7.3 JAR file lying hidden somewhere.
comment on: http://stackoverflow.com/q/27397894
score: 0
type: Comment

http://stackoverflow.com/q/27416333
score: -5
tagged with: java
has comment: http://stackoverflow.com/comment/43324090
type: Question
has title: what is this image gallery called in android
has comment: http://stackoverflow.com/comment/43276374
answer count: 2
possible better answer: http://stackoverflow.com/a/27416483
has answer: http://stackoverflow.com/a/27416483
has comment: http://stackoverflow.com/comment/43323981
favorite count: 0
has body: I am planning to build this kind of a image view in android i could use your help in how to get started.
has comment: http://stackoverflow.com/comment/43318829
tagged with: android-gallery
has answer: http://stackoverflow.com/a/27442387
accepted answer: http://stackoverflow.com/a/27442387
linked to: http://stackoverflow.com/q/21905049
downvote count: 5
has comment: http://stackoverflow.com/comment/43324022
has comment: http://stackoverflow.com/comment/43324068
tagged with: android
type: AnsweredQuestion
upvote count: 0

http://stackoverflow.com/comment/43266702
type: Comment
comment on: http://stackoverflow.com/q/27409133
has text: I would imagine the SurfaceView is causing the problem. Please temporarily remove it, and test your drawers.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43324332
type: AnswerComment
comment on: http://stackoverflow.com/a/27440669
type: Comment
score: 0
has text: @Voo: you *always* have the guaranty “to get a clone of the instance at one particular point in time”; that’s the “no values out of thin air” guaranty. If you want consistency across multiple property values, a class having multiple setters can’t guaranty that; it requires measures taken by the calling threads. Thus, what the OP wants *is* a “special requirement”; the OP wants a guaranty that `B`’s call to `setN(43)` happens after `A`’s call to `clone` and simply making the methods `synchronized` can’t provide that.

http://stackoverflow.com/comment/43350831
comment on: http://stackoverflow.com/q/27355720
score: 0
type: Comment
type: QuestionComment
has text: I solved this by creating a Converter class to enable conversion from Date to String and vice versa. I didn't have to use a global ConverterFactory and I used the DateField's setConverter method. The reason I still get an error is because of a ComboBox that I use in the same way...

http://stackoverflow.com/comment/43089609
type: QuestionComment
has text: @Ironluca certainly not, this problem could be solved in million ways, why would somebody choose worst solution?!
comment on: http://stackoverflow.com/q/27314326
score: 0
type: Comment

http://stackoverflow.com/comment/43367292
has text: If you need more detailed help, please modify the OP with the code you have tried so far.
type: Comment
comment on: http://stackoverflow.com/a/27465129
score: 1
type: AnswerComment

http://stackoverflow.com/comment/43314220
type: Comment
has text: Is it possible to share spring configuration?
type: AnswerComment
comment on: http://stackoverflow.com/a/27436570
score: 0

http://stackoverflow.com/a/27391173
has comment: http://stackoverflow.com/comment/43230247
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27391135
has body: Like you've already done for r1==r2, use the == operator to compare; = is assign. if (r1 &gt; 9 || r1 == 1) Also, Arrays.sort sorts the array in place; it doesn't return anything. Use Arrays.sort(rankArray); and use rankArray after that line.
type: Answer
upvote count: 1

http://stackoverflow.com/a/27388704
downvote count: 0
type: Answer
has body: Well, x[i] is null, otherwise there won't be any exception. Also, you should compare Strings using equals, not ==. Your if should look like this: if (x[i] != null &amp;&amp; "QB".equals(x[i].getPos()) { //... } By the way, I would recommend you using a List&lt;Yourclass&gt; rather than an array. Take into account than an array is filled with null values by default.
upvote count: 5
answers question: http://stackoverflow.com/q/27388686
has comment: http://stackoverflow.com/comment/43225355
has comment: http://stackoverflow.com/comment/43225391
score: 5

http://stackoverflow.com/a/27419101
downvote count: 0
answers question: http://stackoverflow.com/q/27418426
has body: If i understood well you want to hide the navigation bar. You can do this but when the user touch on the screen bar will appear again. Otherwise, if your app crashes for any reason, user couldn't interact with the device. You can find more details about how you can do this in Android Api http://developer.android.com/training/system-ui/navigation.html Also you can find a fully worked example here http://android-er.blogspot.gr/2012/05/hide-and-auto-show-navigation-bar-for.html
type: Answer
score: 1
upvote count: 1

heap-memory
tag name: heap-memory
tags question: http://stackoverflow.com/q/27345261
type: Tag
tags question: http://stackoverflow.com/q/27359885
tags question: http://stackoverflow.com/q/27415368

http://stackoverflow.com/comment/43255609
type: AnswerComment
comment on: http://stackoverflow.com/a/27391898
has text: Good suggestion, I believe that will work. Do you know how to animate my ImageView to rotate 180 degree clockwise and counter-clockwise(to return to the original position)? I am able to animate and rotate the arrow 180 clockwise to point up when expanded but I cannot rotate it counter-clockwise to return it to the original position when the list is collapsed.
score: 0
type: Comment

http://stackoverflow.com/comment/43275338
has text: It would really help if you post only the relevant code.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27415627
score: 0

http://stackoverflow.com/a/27333568
has comment: http://stackoverflow.com/comment/43124552
accepted answer of: http://stackoverflow.com/q/27333329
has comment: http://stackoverflow.com/comment/43124456
has body: import android.app.Activity; import android.os.AsyncTask; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.TextView; import java.util.Calendar; public class MainActivity extends Activity { private TextView daysBox; private boolean running; private Calendar thatDay; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); daysBox = (TextView) findViewById(R.id.main_day); thatDay = Calendar.getInstance(); thatDay.set(Calendar.DAY_OF_MONTH, 25); thatDay.set(Calendar.MONTH, 11); // 0-11 so 1 less thatDay.set(Calendar.YEAR, 2014); thatDay.set(Calendar.HOUR, 0); thatDay.set(Calendar.MINUTE, 0); thatDay.set(Calendar.SECOND, 0); thatDay.set(Calendar.AM_PM, 0); startDateCalculator(); } protected void onPause() { super.onPause(); running = false; } protected void onResume() { super.onResume(); running = true; } private class CountdownTask extends AsyncTask&lt;Void, Void, Void&gt; { protected Void doInBackground(Void... args) { while (running) { try { Thread.sleep(1000); } catch (Exception e) { } publishProgress(); } return null; } protected void onProgressUpdate(Void... res) { super.onProgressUpdate(res); long diff = (thatDay.getTimeInMillis() - System.currentTimeMillis()) / 1000; long days = diff / (60 * 60 * 24); long hours = diff / (60 * 60) % 24; long minutes = diff / 60 % 60; long seconds = diff % 60; daysBox.setText("" + "" + days + "d " + hours + ":" + minutes + ":" + seconds + " "); } } public void startDateCalculator() { new CountdownTask().executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } }
has comment: http://stackoverflow.com/comment/43124434
has comment: http://stackoverflow.com/comment/43124476
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43125319
has comment: http://stackoverflow.com/comment/43124663
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27333329
has comment: http://stackoverflow.com/comment/43125189

http://stackoverflow.com/comment/43273605
type: Comment
type: QuestionComment
has text: Tip: Since you use Dependency Walker, you could also use its Profile feature. It would show the paths of the DLLs loaded at runtime.
score: 0
comment on: http://stackoverflow.com/q/27400352

http://stackoverflow.com/q/27320396
has comment: http://stackoverflow.com/comment/43100010
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27320553
tagged with: java
type: Question
score: 0
answer count: 2
tagged with: printing
duplicate of: http://stackoverflow.com/q/409784
has body: I have created a function which finds the maximum of groups of 3 in my array. When I come to print this, the memory address [I@43c46747 gets printed instead of the maximums which should be contained within the array. I am not allowed to use any import statements/ anything advanced to solve this - trying to possibly use a helper function? Thanks :)
tagged with: arrays
has answer: http://stackoverflow.com/a/27320448
has title: Java prints array memory address rather than array contents

http://stackoverflow.com/q/27314066
answer count: 2
accepted answer: http://stackoverflow.com/a/30106146
downvote count: 0
has title: Generate XSD from XML programmatically in Java
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: xsd
has answer: http://stackoverflow.com/a/30106146
has body: I'm looking for a leightweight library that allows me to genereate an XSD from XML in Java (no commandline tool). I know that it is not a clean way to generate it, but in this case I need to do it. Also the XML is very simple in terms of structure. I already looked into Trang, but there is no API documentation except how to call it from command line. Also I checked out xsd-gen, but the issue with that library is that one would need to modify some package declrations in the source code which I couldn't find. Any other suggestions?
possible better answer: http://stackoverflow.com/a/29707900
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/29707900
upvote count: 3
tagged with: java
type: Question

http://stackoverflow.com/a/27341981
accepted answer of: http://stackoverflow.com/q/27341489
downvote count: 0
has comment: http://stackoverflow.com/comment/43140927
answers question: http://stackoverflow.com/q/27341489
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43140992
has comment: http://stackoverflow.com/comment/43140892
has comment: http://stackoverflow.com/comment/43140963
has comment: http://stackoverflow.com/comment/43140861
type: Answer
has body: The Hash digest need to be done just once (see the doc): System.out.println("digest : " + hash.digest()); //1 byte[] ciphertext = cipher.doFinal(hash.digest()); //2 Calling hash.digest() once creates the digest and then resets the hash object. Which is why you get different output. Below is the change which I made: byte[] inputHash = hash.digest(); System.out.println("digest : " + bytesToHex(inputHash)); byte[] ciphertext = cipher.doFinal(inputHash); Here is the output which I get: digest : 4b03b72ccc3b238e3df3c0a9dcb8d03fd6417848 plaintext : 4b03b72ccc3b238e3df3c0a9dcb8d03fd6417848 You can use any byte array to hex converted. Below is a snippet which you can use: public static String bytesToHex(byte[] hash) { StringBuffer hexString = new StringBuffer(); for (int i = 0; i &lt; hash.length; i++) { String hex = Integer.toHexString(0xff &amp; hash[i]); if(hex.length() == 1) hexString.append('0'); hexString.append(hex); } return hexString.toString(); }
has comment: http://stackoverflow.com/comment/43140943
score: 2

http://stackoverflow.com/q/27347695
has comment: http://stackoverflow.com/comment/43154590
has body: When I start app, I face error, but when I change default language to "fa" (Persian) it works fine. I think problem is inside Values folder. should I change it to Vales-en? the String inside "Value" is same as String in "Value-fa" I Check it 1000times. But I still know I received NullPointerException for NavDrawerListAdapter.getView.setText !!!???? SharedPreferences language = getSharedPreferences(PRFS, 0); String langdef = language.getString("selectlan", "en"); Locale myLocale = new Locale(langdef); Resources res = getResources(); DisplayMetrics dm = res.getDisplayMetrics(); Configuration conf = res.getConfiguration(); conf.locale = myLocale; res.updateConfiguration(conf, dm); Navigation drawer adaptor: public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { LayoutInflater mInflater = (LayoutInflater) context.getSystemService(Activity.LAYOUT_INFLATER_SERVICE); convertView = mInflater.inflate(R.layout.drawer_list_item, null); } ImageView imgIcon = (ImageView) convertView.findViewById(R.id.icon); TextView txtTitle = (TextView) convertView.findViewById(R.id.title); TextView txtCount = (TextView) convertView.findViewById(R.id.counter); imgIcon.setImageResource(navDrawerItems.get(position).getIcon()); txtTitle.setText(navDrawerItems.get(position).getTitle()); // displaying count // check whether it set visible or not if(navDrawerItems.get(position).getCounterVisibility()){ txtCount.setText(navDrawerItems.get(position).getCount()); }else{ // hide the counter view txtCount.setVisibility(View.GONE); } initiate value for navigation drawer: public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mDrawerListView = (ListView) inflater.inflate(R.layout.fragment_navigation_drawer, container, false); mDrawerListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { selectItem(position…
has comment: http://stackoverflow.com/comment/43152021
score: 0
tagged with: nullpointerexception
has title: Change android Language to "en" received error "NullPointerException"
has comment: http://stackoverflow.com/comment/43153624
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43154556
tagged with: android
has comment: http://stackoverflow.com/comment/43342717
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43235899
has comment: http://stackoverflow.com/comment/43237532
has comment: http://stackoverflow.com/comment/43154196
type: Question
has comment: http://stackoverflow.com/comment/43153244

http://stackoverflow.com/q/27371022
type: AnsweredQuestion
has body: I realize the issue of generic type conflicts has been successfully confronted many times over on this site, and the advice given has helped me in the past, but in this case, I cannot seem to determine the source of the conflict. The first declaration in my Graph class is giving me an error: error: type argument Vertex&lt;T#1&gt; is not within bounds of type-variable T#2 private AVLTree&lt;Vertex&lt;T&gt;&gt; vertices; ^ where T#1,T#2 are type-variables: T#1 extends Comparable&lt;T#1&gt; declared in class Graph T#2 extends Comparable&lt;T#2&gt; declared in class AVLTree Here is the Graph class declaration and the problematic field: public class Graph&lt;T extends Comparable&lt;T&gt;&gt; implements GraphInterface&lt;T&gt; { private AVLTree&lt;Vertex&lt;T&gt;&gt; vertices; ... // implemented methods, etc. ... } AVLTree class declaration: public class AVLTree&lt;T extends Comparable&lt;T&gt;&gt; { ... } And the Vertex class declaration: public class Vertex&lt;T extends Comparable&lt;T&gt;&gt; implements Comparable&lt;Vertex&gt; { ... } I don't see what's wrong here. Any ideas?
tagged with: java
has answer: http://stackoverflow.com/a/27371040
type: Question
accepted answer: http://stackoverflow.com/a/27371040
answer count: 1
downvote count: 0
tagged with: generics
favorite count: 0
linked to: http://stackoverflow.com/q/9968687
has title: Type argument T#1 is not within bounds of type-variable T#2
upvote count: 2
duplicate of: http://stackoverflow.com/q/9968687
score: 2

http://stackoverflow.com/comment/43329008
has text: yes that is my intention. How to change 'String WindowsFilePath="drivename\folderName1\00000innerFolderName\03thefileName.fileExtension";' to 'String windowsFilePath ="drivename\\folderName1\\00000innerFolderName\\03thefileName.fileExtension";'
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27441675
type: Comment

http://stackoverflow.com/comment/43189821
has text: Per @njzk2 `private` wouldn't make sense. `protected` wouldn't either, since only subclasses can override protected methods. Concrete classes wouldn't extend an interface - they'd implement it. If you could make a default interface method `protected` it would be essentially the same as making it final.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27368432

http://stackoverflow.com/comment/43297792
type: AnswerComment
type: Comment
has text: I have deployed my application in a weblogic server. There are other java applications deployed on that server too. How do I then make sure that log4j2.xml is specific to just my application!
score: 0
comment on: http://stackoverflow.com/a/27423449

http://stackoverflow.com/comment/43167906
type: AnswerComment
comment on: http://stackoverflow.com/a/27357266
score: 0
type: Comment
has text: String ll1 = newString(lat1.toString() +"."+lat2.toString()+","+long1.toString()+"."+long2.toString()); byte[] b = ll1.getBytes("UTF-8"); String ll = new String(b, "UTF-8");

http://stackoverflow.com/a/27483635
has comment: http://stackoverflow.com/comment/43471417
has comment: http://stackoverflow.com/comment/43439363
downvote count: 0
has comment: http://stackoverflow.com/comment/43472712
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27423445
score: 1
has body: This isn't the full answer to this question, I believe the link in the question is still valid. This answer is meant as some process suggestions. One way to start is to create facades. Initially on paper decide where the boundaries of your modules lie. (which classes are part of a group of classes that make up a module) Then create a facade class (depending on the framework you use, implementing singleton or using spring for ioc) Then whenever you access a class from outside your module, have the outside class call the facade, and have the facade call the actual class. If you have an external class do several calls on module classes then either this class belongs inside that module, or you need to extract the macro behaviour (series of calls and interactions) into 1 method and move that method into the facade.

android-activity
tags question: http://stackoverflow.com/q/27381198
tags question: http://stackoverflow.com/q/27436793
tags question: http://stackoverflow.com/q/27388223
tags question: http://stackoverflow.com/q/27399318
tags question: http://stackoverflow.com/q/27389690
tags question: http://stackoverflow.com/q/27360131
tags question: http://stackoverflow.com/q/27450043
tags question: http://stackoverflow.com/q/27369772
tags question: http://stackoverflow.com/q/27333341
tags question: http://stackoverflow.com/q/27372775
tags question: http://stackoverflow.com/q/27350378
tags question: http://stackoverflow.com/q/27334406
tags question: http://stackoverflow.com/q/27334324
tag name: android-activity
tags question: http://stackoverflow.com/q/27460077
tags question: http://stackoverflow.com/q/27375231
tags question: http://stackoverflow.com/q/27424081
tags question: http://stackoverflow.com/q/27399690
tags question: http://stackoverflow.com/q/27417111
tags question: http://stackoverflow.com/q/27424571
tags question: http://stackoverflow.com/q/27347381
tags question: http://stackoverflow.com/q/27387542
tags question: http://stackoverflow.com/q/27470378
type: Tag
tags question: http://stackoverflow.com/q/27370216

http://stackoverflow.com/comment/43283562
has text: I agree with this :)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27418988

http://stackoverflow.com/q/27405893
downvote count: 0
accepted answer: http://stackoverflow.com/a/27409838
favorite count: 0
tagged with: antlr4
possible better answer: http://stackoverflow.com/a/27406260
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27406260
upvote count: 3
tagged with: java
has body: I'm a newbie in AntLR. I'm using AntLR4 version. I wrote the following attribute grammar that recognizes a list of integers and print the sum of the list at the end. list.g4 grammar list; @header { import java.util.List; import java.util.ArrayList; } list : BEGL (elems[new ArrayList&lt;Integer&gt;()])? ENDL { int sum = 0; if($elems.text != null) for(Integer i : $elems.listOut) sum += i; System.out.println("List Sum: " + sum); } ; elems [List&lt;Integer&gt; listIn] returns [List&lt;Integer&gt; listOut] : a=elem (SEP b=elem { listIn.add($b.value); } )* { listIn.add($a.value); $listOut = $listIn; } ; elem returns [int value] : NUM { $value = $NUM.int; } ; BEGL : '['; ENDL : ']'; SEP : ','; NUM : [0-9]+; WS : (' '|'\t'|'\n')+ -&gt; skip; A valid input would be: [1, 2, 3] For testing my grammar, I'm using TestRig Tool. Now, I would like to use Visitors to clearily separate the code from the grammar. I know that I need to use antlr with the -visitor option to generate the Visitor class for my application. I would like to know how to access the atrributes of a given production in the Visitor methods class and how to "glue" the lexer, parser and visitor code pieces together.
type: Question
score: 3
has answer: http://stackoverflow.com/a/27409838
has title: Using Visitors in AntLR4 in a Simple Integer List Grammar
tagged with: antlr
answer count: 2
tagged with: grammar

http://stackoverflow.com/a/27345585
type: Answer
upvote count: 1
has body: There is no hard and fast rule to have -1 as guess value in your case. You could even initialize it to value greater than 101 or any number other than between 0 - 101. Alternatively, you could use do while loop like below if you dont want to initialize it: int guess; do { System.out.print("\nEnter your guess: "); guess = input.nextInt(); if (guess == number) System.out.println("you are correct, the number is " + number); else if (guess &gt; number) System.out.println("your guess is too high"); else System.out.println("your guess is too low"); } while (guess != number);
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27345550

http://stackoverflow.com/a/27431481
type: Answer
has comment: http://stackoverflow.com/comment/43325337
has body: use compareToIgnoreCase method of the String class
has comment: http://stackoverflow.com/comment/43329558
has comment: http://stackoverflow.com/comment/43305067
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27431162
upvote count: 2
has comment: http://stackoverflow.com/comment/43305522

http://stackoverflow.com/comment/43361740
type: AnswerComment
has text: see this might help: http://www.nataraz.in/how-to-get-only-numbers-from-alphanumeric-string/#
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27462646

http://stackoverflow.com/q/27470810
tagged with: nodes
has title: get root of a binary search tree in java
possible better answer: http://stackoverflow.com/a/27470899
has answer: http://stackoverflow.com/a/27470899
has body: I have created a binary search tree in java that allow user to add nodes to the tree This is my implementation of the binary tree in java which accept root node on creation and then automatically figure out that it should add the child into left side or right side of the tree. public class BinarySearchTree { Node root = null; public BinarySearchTree(Node root){ this.root =root; } public void add(int data){ Node newNode = new Node(data); if(this.root ==null){ newNode =this.root; } if(data&gt;this.root.data){ addRight(root,newNode); } if(data&lt;this.root.data){ addLeft(root,newNode); } } public Node getRoot(){ return this.root; } private void addLeft(Node root, Node newNode) { if(root.leftChild == null){ root.leftChild = newNode; } else { this.root = this.root.leftChild; add(newNode.data); } } private void addRight(Node root,Node newNode) { if (root.rightChild == null){ root.rightChild = newNode; } else { this.root = this.root.rightChild; add(newNode.data); } } } But when I try to retrieve the root node with getRoot() method. it return me the child of the root rather than the actual root node that I had passed in. this is a example of using it TreeHight treeHight = new TreeHight(); Node root = new Node(100); BinarySearchTree unbalance = new BinarySearchTree(root); unbalance.add(200); unbalance.add(50); unbalance.add(250); unbalance.add(350); when I try to get root node it give me 250 as the first node rather than 100. How can I retrieve the root node of this tree ?
type: AnsweredQuestion
score: 3
downvote count: 0
favorite count: 0
tagged with: binary-tree
has answer: http://stackoverflow.com/a/27470833
tagged with: binary-search-tree
type: Question
upvote count: 3
tagged with: java
answer count: 2
accepted answer: http://stackoverflow.com/a/27470833

http://stackoverflow.com/comment/43202798
type: Comment
comment on: http://stackoverflow.com/a/27375755
has text: Looking at your requirements `{wherever}/20140101/HERE WILL FIND THE THREE DBF FILES`, there is just enough to use a default `RecursiveLeafOnlyDirectoryScanner` and leave others options (`directory="file:input" filename-pattern="FILENAME*"`) as is. See its source code: https://github.com/spring-projects/spring-integration/blob/master/spring-integration-file/src/main/java/org/springframework/integration/file/RecursiveLeafOnlyDirectoryScanner.java
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43314263
score: 0
type: AnswerComment
has text: For the average? You need to add a for loop. You can either do 6 different ones, for each player, or make the second change as well and then you can make a for loop find the average for each player. Rephrased, you need a for loop to add up each score, and either a for loop to calculate the average for each player or 6 for loops to add up the average for each player.
type: Comment
comment on: http://stackoverflow.com/a/27436799

http://stackoverflow.com/comment/43380525
type: Comment
type: QuestionComment
has text: I think this way cause high cost and complexity, my problem is why this algorithm product distinct output on same inputs
comment on: http://stackoverflow.com/q/27472455
score: 0

http://stackoverflow.com/a/27319599
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/43098624
has body: After querying the table (which you have done), you need to extract the data from the ResultSet. E.g.: ResultSet rs= stmt.executeQuery(details); while (rs.next()) { System.out.println ("Student ID: " + rs.getString(1); System.out.println ("Student name: " + rs.getString(2); }
answers question: http://stackoverflow.com/q/27319497
score: 0
accepted answer of: http://stackoverflow.com/q/27319497

http://stackoverflow.com/comment/43480417
has text: This is valid, but I don't know how to make 401 handler? So if the access token expired, I can refresh my token. Sorry, my question is confusing
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27392999

http://stackoverflow.com/q/27436122
has comment: http://stackoverflow.com/comment/43313024
type: Question
has body: in this program i need to add 4 books to a library.The code is for my book class but i need to make a method with 4 arguments in another file in my library class that will add the books into a library array.There is a third file for the main where i will print this all out but i just cant figure this out. Example of book: author-clowney, title-individualism,price-5.50,isbn-978-52-234-43-012 private String author; private String title; private double price; private int isbn; public book(String a, String t, double p, int i){ author=a; title=t; price=checkPrice(p); isbn=checkIsbn(i); }
downvote count: 3
answer count: 1
favorite count: 0
type: UnansweredQuestion
score: -3
has title: using method to add book to a library array
upvote count: 0
tagged with: java
tagged with: methods
has answer: http://stackoverflow.com/a/27436390

http://stackoverflow.com/comment/43516185
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27520559
has text: Latest update of Android SDK Tools it's working now. Thank you @GPRathour
type: AnswerComment

tomcat
tags question: http://stackoverflow.com/q/27424728
tags question: http://stackoverflow.com/q/27315809
tags question: http://stackoverflow.com/q/27424337
tags question: http://stackoverflow.com/q/27347282
tags question: http://stackoverflow.com/q/27356508
tags question: http://stackoverflow.com/q/27400671
tags question: http://stackoverflow.com/q/27434192
tags question: http://stackoverflow.com/q/27318693
tags question: http://stackoverflow.com/q/27358227
tags question: http://stackoverflow.com/q/27344534
tags question: http://stackoverflow.com/q/27429268
tags question: http://stackoverflow.com/q/27449389
tags question: http://stackoverflow.com/q/27420006
tags question: http://stackoverflow.com/q/27436547
tags question: http://stackoverflow.com/q/27342377
tags question: http://stackoverflow.com/q/27331522
tags question: http://stackoverflow.com/q/27419175
tags question: http://stackoverflow.com/q/27330332
tags question: http://stackoverflow.com/q/27471520
tags question: http://stackoverflow.com/q/27437348
tags question: http://stackoverflow.com/q/27473400
tags question: http://stackoverflow.com/q/27316011
tags question: http://stackoverflow.com/q/27449547
tags question: http://stackoverflow.com/q/27450537
tags question: http://stackoverflow.com/q/27430577
tags question: http://stackoverflow.com/q/27398030
tags question: http://stackoverflow.com/q/27344048
tags question: http://stackoverflow.com/q/27387260
tags question: http://stackoverflow.com/q/27340829
tags question: http://stackoverflow.com/q/27397894
tags question: http://stackoverflow.com/q/27318439
tag name: tomcat
tags question: http://stackoverflow.com/q/27390055
tags question: http://stackoverflow.com/q/27356288
tags question: http://stackoverflow.com/q/27407985
tags question: http://stackoverflow.com/q/27377946
tags question: http://stackoverflow.com/q/27362588
tags question: http://stackoverflow.com/q/27316761
tags question: http://stackoverflow.com/q/27388864
tags question: http://stackoverflow.com/q/27366046
tags question: http://stackoverflow.com/q/27385363
tags question: http://stackoverflow.com/q/27428396
tags question: http://stackoverflow.com/q/27423541
tags question: http://stackoverflow.com/q/27377844
tags question: http://stackoverflow.com/q/27383003
tags question: http://stackoverflow.com/q/27423157
tags question: http://stackoverflow.com/q/27393785
tags question: http://stackoverflow.com/q/27377808
tags question: http://stackoverflow.com/q/27466194
tags question: http://stackoverflow.com/q/27326819
tags question: http://stackoverflow.com/q/27399564
tags question: http://stackoverflow.com/q/27416699
tags question: http://stackoverflow.com/q/27419686
type: Tag
tags question: http://stackoverflow.com/q/27445233
tags question: http://stackoverflow.com/q/27333253
tags question: http://stackoverflow.com/q/27359930
tags question: http://stackoverflow.com/q/27457398
tags question: http://stackoverflow.com/q/27428610
tags question: http://stackoverflow.com/q/27393570
tags question: http://stackoverflow.com/q/27357092
tags question: http://stackoverflow.com/q/27452141
tags question: http://stackoverflow.com/q/27452344
tags question: http://stackoverflow.com/q/27421783
tags question: http://stackoverflow.com/q/27332532
tags question: http://stackoverflow.com/q/27317870
tags question: http://stackoverflow.com/q/27455571
tags question: http://stackoverflow.com/q/27356440
tags question: http://stackoverflow.com/q/27319524
tags question: http://stackoverflow.com/q/27333960

http://stackoverflow.com/q/27347042
tagged with: java
type: Question
score: 0
has answer: http://stackoverflow.com/a/27347224
accepted answer: http://stackoverflow.com/a/27347224
has comment: http://stackoverflow.com/comment/43148943
answer count: 1
has title: When to use thread efficiently
has comment: http://stackoverflow.com/comment/43148898
has body: This question comes out of my practical inexperience with this issue. I'm not going to lie, it's a newbie yet essential question that I've always been somewhat reluctant to asking. Before pushing this as subjective, I kindly ask to read the whole post. I've read quite a bit into threads particularly in Java however have never actually used them myself. I know it's imperative to use them to maximise the efficiency of your application, however I've never quite known when or to a certain extent how. So I decided to create a Math Quiz application, including the GUI, highscore system etc. - within the main menu the I have my menu bar with a checkbox menu items toggling whether or not the user wishes to use the application with a particular theme or not. Obviously I want this option to continuously be checked during the lifetime of it's frame. Putting all these factors together made me wonder whether or not I should create a thread within the frame class to continuously check without affecting anything outside it. So here's my question(s). Is this an ideal scenario to opt to use threads? If yes, what issues may arise using them? If no, may I ask why not and where I could possibly use them within my desired application. I'd also like to specify that yes, I've read quite a large number of articles and small books regarding threads. However being self-taught in the subject the only way I properly learn is by doing. Hope you understand.
tagged with: multithreading
has comment: http://stackoverflow.com/comment/43148919
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43148964

http://stackoverflow.com/a/27356945
accepted answer of: http://stackoverflow.com/q/27355540
has body: The readLine method of BufferedReader does not include the line endings in the text it returns. So you need to add a new line when you add the text to StyledText: editor.append(str); editor.append('\n');
upvote count: 1
answers question: http://stackoverflow.com/q/27355540
score: 1
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/q/27386124
tagged with: java
tagged with: hibernate
has title: How to search by an attribute of another attribute with Hibernate?
has answer: http://stackoverflow.com/a/27386356
accepted answer: http://stackoverflow.com/a/27386356
type: Question
score: 0
answer count: 1
has body: I have PlaceDTO and CategoryDTO, which connect in PlaceCategoryDTO(many to many). public class PlaceCategoryDTO implements Serializable{ private Long id; private Long categoryID; private Long placeID; private CategoryDTO category; private PlaceDTO place; //getters and setters } I have PlaceCategoryDAO and i want to search by two attributes. One is the categoryID and the other is an attribute of PlaceDTO(region). For searching by categoryID and placeID i have this method in PlaceCategoryDAO: public class PlaceCategoryDAO extends GenericHibernateDAO&lt;PlaceCategoryDTO,Long&gt;{ public List&lt;PlaceCategoryDTO&gt; findByParameters(Long placeID, Long categoryID) { List&lt;Criterion&gt; criteria = new ArrayList&lt;Criterion&gt;(); if (placeID != null) { criteria.add(Restrictions.eq("placeID",placeID)); } if (categoryID != null) { criteria.add(Restrictions.eq("categoryID",categoryID)); } return findByCriteria(criteria); } } I am wondering if i can search by place.region instead of placeID.
has comment: http://stackoverflow.com/comment/43221067
type: AnsweredQuestion

http://stackoverflow.com/a/27471347
has comment: http://stackoverflow.com/comment/43425485
has comment: http://stackoverflow.com/comment/43425867
has comment: http://stackoverflow.com/comment/43425770
has comment: http://stackoverflow.com/comment/43383934
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43393577
has comment: http://stackoverflow.com/comment/43450229
has comment: http://stackoverflow.com/comment/43448880
has comment: http://stackoverflow.com/comment/43446461
score: 9
has comment: http://stackoverflow.com/comment/43384253
has comment: http://stackoverflow.com/comment/43434305
has comment: http://stackoverflow.com/comment/43401202
upvote count: 9
answers question: http://stackoverflow.com/q/27471141
has comment: http://stackoverflow.com/comment/43416382
has body: How to send the heartbeat This class can sent the proper intents public class GcmKeepAlive { protected CountDownTimer timer; protected Context mContext; protected Intent gTalkHeartBeatIntent; protected Intent mcsHeartBeatIntent; public GcmKeepAlive(Context context) { mContext = context; gTalkHeartBeatIntent = new Intent( "com.google.android.intent.action.GTALK_HEARTBEAT"); mcsHeartBeatIntent = new Intent( "com.google.android.intent.action.MCS_HEARTBEAT"); } public void broadcastIntents() { System.out.println("sending heart beat to keep gcm alive"); mContext.sendBroadcast(gTalkHeartBeatIntent); mContext.sendBroadcast(mcsHeartBeatIntent); } } if you just want to send the heartbeat you can do the following in an Activity GcmKeepAlive gcmKeepAlive = new GcmKeepAlive(this); gcmKeepAlive.broadcastIntents(); I don't think you need to set any additional permissions for this but here are the gcm related permissions I have in my manifest &lt;uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /&gt; &lt;permission android:name=your_package_name.permission.C2D_MESSAGE" android:protectionLevel="signature" /&gt; &lt;uses-permission android:name="your_package_name.permission.C2D_MESSAGE" /&gt; One way to send the heartbeats on a regular basis If you want to send them on a regular basis, here is how I am doing that: public class GcmKeepAliveBroadcastReceiver extends BroadcastReceiver { private GcmKeepAlive gcmKeepAlive; @Override public void onReceive(Context context, Intent intent) { System.out.println("inside gcm keep alive receiver"); gcmKeepAlive = new GcmKeepAlive(context); gcmKeepAlive.broadcastIntents(); } } I also have a service that has an Dagger injected alarmmanger and pendingintent @Inject AlarmManager alarmManager; @Inject PendingIntent gcmKeepAlivePendingIntent; alarmManager.setInexactRepeating(AlarmManager.ELAPSED_REALTIME_WAKEUP, 1000, 4*60*1000, gcmKeepAlivePendingIntent); Here is the section of the Dagger module that provides the alarm manage…
type: Answer
accepted answer of: http://stackoverflow.com/q/27471141
has comment: http://stackoverflow.com/comment/43384653
downvote count: 0

http://stackoverflow.com/comment/43138794
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27341466
has text: `Sometimes the letters picked are good, and good words can be made` ok what are the good words?meaning full words ? if you want to genarate random meaning full words use word list and randomly pick a word

http://stackoverflow.com/comment/43201307
has text: @ItachiUchiha i try it, but it does not work, my code looks like that one in the question text yet. please check it. thanks.
comment on: http://stackoverflow.com/q/27375002
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27471846
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/43378572
score: 0
type: UnansweredQuestion
has title: Java Non-Binary Tree Pre-Order Traversal
type: Question
tagged with: tree
has body: I am having some trouble traversing a non-binary tree and outputting the pre-order enumeration. The current code I have is: public String GetPreOrder(ADS2TreeNode root, String res) { res += data; if (numberOfChildren != 0) { for (int i = 0; i &lt; numberOfChildren; i++) { res += "," + children[i]; } } return res; } public String GetPreOrder() { String res = ""; return root.GetPreOrder(root, res); } Based on the test data of "(B(E(K),F))" it outputs B,E(K),F However it should output B, E, K, F I believe it is because it simply prints the array which stores the children of E rather than accessing them individually? However I am unsure how to do this. Could anyone shine any light as to why this is happening and how to solve this? # I now have an issue with the following code: public String GetPreOrder(ADS2TreeNode root, String res) { if (root.numberOfChildren == 0) { res += root.data; root = root.parent; } else { for (int i = 0; i &lt; root.numberOfChildren; i++) { res += root.data + ','; root = root.getChild(i); res = GetPreOrder(root, res); } } return res; } Whilst debugging it, it loops though each subtree as it should, however it doesn't fully reach the end of the tree - i've spent ages trying to figure it out via debugging but I can't seem to understand why. Can anyone see the mistake with my code or something I am missing?
has answer: http://stackoverflow.com/a/27472023

http://stackoverflow.com/q/27367525
tagged with: android
has answer: http://stackoverflow.com/a/27412865
tagged with: java
type: Question
score: 5
tagged with: dependency-injection
upvote count: 5
has title: Injected objects became null after upgrading to Roboguice 3
has answer: http://stackoverflow.com/a/29778990
tagged with: roboguice
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/27406668
favorite count: 0
has body: I've just upgraded our project to use Roboguice 3 and all of a sudden all the injected objects became null, that includes POJO, Providers, Views, Resources etc. And I'm struggling to figure out why. First of all there's the gradle build file, tried both Proguard on and off and it didn't make a difference. I believe we are currently using Roboguice 3.0.1, but I tried 3.0 and still had the problem. compile ('org.roboguice:roboguice:3.+') { exclude module: 'asm' } provided 'org.roboguice:roboblender:3.+ And we do have some custom bindings in a Module file, so here's how I'm specifying it according to the wiki: &lt;meta-data android:name="roboguice.modules" android:value="com.some.CustomModule"/&gt; Just for the record I've also tried to specify it in the Application class like this and it didn't work: RoboGuice.getOrCreateBaseApplicationInjector( this, RoboGuice.DEFAULT_STAGE, RoboGuice.newDefaultRoboModule(this), new CustomModule(this)); That's about it for the setup, we didn't change anything and if I use Roboguice 2, everything works. A couple other things that I've also tried: Also tried without Roboblender and annotation db RoboGuice.setUseAnnotationDatabases(false); it didn't make a difference. Ln.d("Test" + Strings.toString(0)); this logs prints out just fine so I think the actual library is packaged right. Instead of injecting a Provider of a POJO, I tried to use manual injection like this RoboGuice.getInjector(this).getInstance(SharedPreferencesHelper.class); and it throws the error about Could not find a suitable constructor in some.path.SharedPreferencesHelper. Classes must have either one (and only one) constructor annotated with @Inject or a zero-argument constructor that is not private. The weird thing is that in SharedPreferencesHelper class we do have a public constructor with @Inject annotated, I guess somehow it's not taken into consideration? Maybe this whole problem is due to annotation not being considered? I've been banging my head against it for …
type: UnansweredQuestion

http://stackoverflow.com/comment/43371918
comment on: http://stackoverflow.com/a/27468266
has text: @RileyWillow use Mohanads `playSound` method and look in your `onReceive` method, where you call `playSound();` you need to call `playSound(context);`
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27471339
answers question: http://stackoverflow.com/q/27470890
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27470890
type: Answer
score: 3
upvote count: 3
has body: An initial guess can be obtained from the documentation of the fail task regarding the status attribute: Exit using the specified status code; assuming the generated Exception is not caught, the JVM will exit with this status. That's exactly what's happening when using a macrodef: the BuildException that is thrown by the fail task to exit the build is being caught by the macrodef. Eventually some sort of a wrapper exception is thrown by the macrodef which swallows the exit code. You can also see this from the exception stack trace when running Ant in debug mode: Using the macrodef: some failure at org.apache.tools.ant.taskdefs.Exit.execute(Exit.java:164) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) 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.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) 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.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106) at org.apache.tools.ant.Task.perform(Task.java:348) at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398) at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav…

http://stackoverflow.com/q/27438883
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27439303
tagged with: android
has title: String exception
has comment: http://stackoverflow.com/comment/43317893
has comment: http://stackoverflow.com/comment/43317711
has answer: http://stackoverflow.com/a/27438995
tagged with: java
has comment: http://stackoverflow.com/comment/43317746
has comment: http://stackoverflow.com/comment/43317796
has comment: http://stackoverflow.com/comment/43317691
type: Question
has comment: http://stackoverflow.com/comment/43317761
has comment: http://stackoverflow.com/comment/43317638
score: 0
has comment: http://stackoverflow.com/comment/43318085
answer count: 3
has comment: http://stackoverflow.com/comment/43318164
tagged with: string
has comment: http://stackoverflow.com/comment/43318631
has answer: http://stackoverflow.com/a/27439530
has body: I am getting a string index out of bound exception while decoding string pattern a-695b-36c158d-666e-1326f144. I want to extract values between a &amp; b, b &amp; c, c &amp; d. This code prints values sometimes properly but fails sometimes. I dont understand why this exception occurs sometimes. Below is my code: public void run() { Log.i(TAG, "BEGIN mConnectedThread"); byte[] buffer = new byte[128]; int bytes; // Keep listening to the InputStream while connected while (true) { try { // Read from the InputStream bytes = mmInStream.read(buffer); int buflen=buffer.length; String str = new String(buffer, "UTF-8"); // prints character Log.d("Data Transmitted", str); int spaceIndex = str.indexOf(" "); if (spaceIndex != -1) { str = str.substring(0, spaceIndex); } Log.d("Data Edited", str); boolean v1=str.contains("a"); boolean v2=str.contains("b"); boolean v3=str.contains("c"); boolean v4=str.contains("d"); if(v1==true &amp;&amp; v2==true &amp;&amp; v3==true &amp;&amp; v4==true){ mEmulatorView.write(buffer, bytes); String op1=str.substring(str.indexOf("a")+1, str.indexOf("b")); Log.d("output", op1); String op2=str.substring(str.indexOf("b")+1, str.indexOf("c")); Log.d("output", op2); String op3=str.substring(str.indexOf("c")+1, str.indexOf("d")); Log.d("output", op3); } else{ mEmulatorView.write(buffer, bytes); } // Send the obtained bytes to the UI Activity //mHandler.obtainMessage(BlueTerm.MESSAGE_READ, bytes, -1, buffer).sendToTarget(); } catch (IOException e) { Log.e(TAG, "disconnected", e); connectionLost(); break; } } } I always get data in this form: 12-12 12:43:54.681: D/Data Transmitted(23778): a-695b-36c158d-666e-1326f144 12-12 12:43:54.681: D/Data Transmitted(23778): a-684b-75c35d-659e-838f119 12-12 12:43:54.681: D/Data Transmitted(23778): a-674b-353c238d-658e-556f148 Exception: &gt; E/AndroidRuntime(23778): FATAL EXCEPTION: Thread-2313 &gt; E/AndroidRuntime(23778): Process: es.pymasde.blueterm, PID: 23778 &gt; E/AndroidRuntime(23778): &gt; java.lang.StringIndex…
has comment: http://stackoverflow.com/comment/43317818
has comment: http://stackoverflow.com/comment/43318199

http://stackoverflow.com/a/28538314
answers question: http://stackoverflow.com/q/27334528
score: 7
has body: Please @see https://java.net/jira/browse/GLASSFISH-21141 The procedure I followed was asadmin stop-domain delete felix cache $rm -rf domains/domain1/osgi-cache/felix/ copy jackson--2.4.2.jars as modules/jackson-.jar asadmin start-domain
has comment: http://stackoverflow.com/comment/91778406
downvote count: 0
upvote count: 7
type: Answer

http://stackoverflow.com/comment/43376481
comment on: http://stackoverflow.com/q/27469761
score: 0
type: Comment
type: QuestionComment
has text: @Brandon `Thread.currentThread().join()` is a sure deadlock.

http://stackoverflow.com/comment/43201233
score: 0
comment on: http://stackoverflow.com/q/27375203
has text: possible duplicate of [HttpsURLConnection: Connection Timed out error](http://stackoverflow.com/questions/16895762/httpsurlconnection-connection-timed-out-error)
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27458074
type: Answer
downvote count: 0
has body: boolean containsAll(Collection&lt;?&gt; args) is the method you can use for your solution as if(currentCombincation.containsAll(validCombination)) { return true; }
answers question: http://stackoverflow.com/q/27458027
score: 1
upvote count: 1

http://stackoverflow.com/comment/43232852
comment on: http://stackoverflow.com/a/27392062
score: 0
type: AnswerComment
type: Comment
has text: @Andrew Thompson... So I think I should make a Component like JMenu for user. how can I add JMenu or class extends Menu to Jtable Cell

http://stackoverflow.com/comment/43167049
has text: You find a comprehensive introduction how to use the API here Fundamentals of the JavaMail API which provides many examples as code snippets Maybe you can find some stuff here: http://www.oracle.com/technetwork/java/index.html
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27357214
type: Comment

http://stackoverflow.com/comment/43298503
has text: Still cannot say, sorry. The principle is that you have to make sure that the controller is loaded from Spring, *then* injected by FXML - using `setController()`. The `.fxml` file must *not* define its controller.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27399806

http://stackoverflow.com/q/27344009
linked to: http://stackoverflow.com/q/4379548
has comment: http://stackoverflow.com/comment/43355514
favorite count: 0
tagged with: unix-timestamp
type: UnansweredQuestion
tagged with: datetime
has comment: http://stackoverflow.com/comment/43154377
score: 2
answer count: 0
downvote count: 0
tagged with: java
type: Question
tagged with: c#
linked to: http://stackoverflow.com/q/15949938
tagged with: date
has title: Converting .NET time to Java time is two days off
upvote count: 2
has body: Yes, I know this question has been posed many times, but I am still unable to get a consistent result between .NET and Java. There are a number of posts and google search results that refer to the constants: long UNIX_EPOCH_IN_100NS_INTERVALS = 621355968000000000l; long DOTNET_EPOCH_IN_MSEC_INTERVALS = -62135596800000l; The first purports to be the number of 100ns intervals or 'tics' between UTC 0001-01-01 00:00:00 (z yyyy-MM-dd HH:mm:ss) and UTC 1970-01-02 00:00:00, and the second is the difference between the .NET epoch and the Java epoch in milliseconds. A post here reports a similar issue in the .NET world. In the code below, I calculate the offset between the epochs and then compare to the published numbers: SimpleDateFormat sdf = new SimpleDateFormat("z yyyy-MM-dd HH:mm:ss"); sdf.setTimeZone(TimeZone.getTimeZone("UTC")); Date date; try { date = sdf.parse("UTC 1970-01-01 00:00:00"); } catch (ParseException e) { e.printStackTrace(); throw new RuntimeException("Stupid java dates !"); } System.out.println("Unix Epoch Date: " + sdf.format(date)); Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); cal.setTime(date); System.out.println("Unix Epoch Milliseconds: " + cal.getTimeInMillis()); try { date = sdf.parse("UTC 0001-01-01 00:00:00"); } catch (ParseException e) { e.printStackTrace(); throw new RuntimeException("Stupid java dates !"); } System.out.println("Calculated DotNet Epoch Date: " + sdf.format(date)); cal.setTime(date); System.out.println("Calculated DotNet Epoch Milliseconds: " + cal.getTimeInMillis()); date = new Date(-62135596800000l); System.out.println("Published DotNet Epoch Date: " + sdf.format(date)); cal.setTime(date); System.out.println("Published DotNet Epoch Milliseconds: " + cal.getTimeInMillis()); which generates the output: Unix Epoch Date: UTC 1970-01-01 00:00:00 Unix Epoch Milliseconds: 0 DotNet Epoch Date: UTC 0001-01-01 00:00:00 DotNet Epoch Milliseconds: -62135769600000 Published DotNet Epoch Date: UTC 0001-01-03 00:00:00 …

http://stackoverflow.com/a/27463309
score: 1
has comment: http://stackoverflow.com/comment/43363149
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43363107
has body: When spring instantiating the singleton it will use 'getInstance' method but this method expecting two parameter: userName and password. But these parameters are not in Spring configuration. You need to add them: &lt;bean id="MySingeltonDB" class="SingeltonDBVersion2.SingeltonDB" factory-method="getInstance"&gt; &lt;constructor-arg value="userName" /&gt; &lt;constructor-arg value="password" /&gt; &lt;/bean&gt; Then you can get MySingletonDB bean from application context: ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml"); SingletonDB singletonDB = (SingletonDB)context.getBean("MySingeltonDB"); singletonDB.update(paramters);
type: Answer
accepted answer of: http://stackoverflow.com/q/27463241
has comment: http://stackoverflow.com/comment/43363008
answers question: http://stackoverflow.com/q/27463241
downvote count: 0

http://stackoverflow.com/a/27373117
answers question: http://stackoverflow.com/q/27372842
score: 0
type: Answer
has body: You don't need regex in this case. You can make it simple bu using String.split() method. Just split based on dot and find the characters in each sentence to get the desired sentence. Sample code: String paragraph = "First time in a long time the cricket team is in Kandy and there is no rain and the skies are blue. Strange days. Hope it stays that way"; String searchWord = "lo"; String sentence = null; for (String str : paragraph.split("\\.\\s*")) { // split based on dot followed by zero or more whitespaces if (str.indexOf(searchWord) != -1) { // or use if(str.contains(searchWord)) sentence = str; break; } } System.out.println(sentence);

http://stackoverflow.com/q/27431230
score: 0
answer count: 1
tagged with: zk
accepted answer: http://stackoverflow.com/a/27443083
type: AnsweredQuestion
has title: Zk decimalbox tooltiptext dynamically
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27443083
tagged with: ria
has body: I have a simple &lt;decimalbox tooltiptext='@{createToolTip()}'/&gt; The tooltip for the decimalbox i want to be dynamically generated every time is requested generated and is returned from a method createToolTip() in this case..... the onCreate method dont work for me because the value of the tooltiptext may change after the component is create.. what can i do the Code above is not working... I'm missing something? Best regards from Venezuela

http://stackoverflow.com/q/27385636
linked to: http://stackoverflow.com/q/14187963
has comment: http://stackoverflow.com/comment/43220850
linked to: http://stackoverflow.com/q/19945422
tagged with: javafx
linked to: http://stackoverflow.com/q/16708931
has body: There is a class FXMLDocumentController. There is a class ThreadForFile which has been inheriting from class Thread (which I read data from a file) After I pressed the button (in the class FXMLDocumentController) I create a flow of class ThreadForFile. I need to in the class ThreadForFile, when reading, the string displayed in the TextArea. But I can not figure out if I pass a parameter TextArea, and change it in the constructor, then there is a change in this component.But if I assign the class field this TextArea, it displays an error : Exception in thread "JavaFX Application Thread" java.lang.NullPointerException ThreadForFile extends Thread private String path; private long ms; private int id; private String name; private boolean stop = false; private HTMLEditor web; private DB db = new DB(); private Button doc; public void setMS(long ms){ System.out.print(ms); this.ms =ms; } public ThreadForFile(String name,String path,long ms,int id,Button doc) { this.path = new String(); this.path = path; this.ms = ms; this.id = id; this.name = name; this.doc = new Button(); this.doc = doc; } public void Stop(boolean stop){ this.stop = stop; } public void run( ) { try { doc.setText("Zsczsc"); System.out.print("asdasd"); File file = new File(path); File file1 = new File("C:\\out.txt"); BufferedReader br = new BufferedReader (new InputStreamReader(new FileInputStream(file), "UTF-8")); String line = null; while( (line = br.readLine()) != null){ if(!Thread.interrupted()) //Проверка прерывания { if(!stop){ PrintWriter out = new PrintWriter(file1.getAbsoluteFile()); try { sytem.out.print(line+"\n"); } finally { out.close(); } Thread.sleep(db.getParam().getMS()*1000); System.out.print("ms" + db.getParam().getMS()); } }else{ return; } } } catch (Exception ex) { System.out.print(ex.toString()); Logger.getLogger(ThreadForFile.class.getName()).log(Level.SEVERE, null, ex); } } public void read()throws FileNotFoundException, IOException { } FXMLDocumentController &lt;!-- language: JavaFX …
type: Question
has answer: http://stackoverflow.com/a/27396764
tagged with: java
has comment: http://stackoverflow.com/comment/43223058
score: 0
has title: Changing TextArea in another class
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43220155

hibernate
tags question: http://stackoverflow.com/q/27313949
tags question: http://stackoverflow.com/q/27465568
tags question: http://stackoverflow.com/q/27402837
tags question: http://stackoverflow.com/q/27315227
tags question: http://stackoverflow.com/q/27315865
tags question: http://stackoverflow.com/q/27465454
tags question: http://stackoverflow.com/q/27467330
tags question: http://stackoverflow.com/q/27377175
tags question: http://stackoverflow.com/q/27341067
tags question: http://stackoverflow.com/q/27340536
tags question: http://stackoverflow.com/q/27371680
tags question: http://stackoverflow.com/q/27354583
tags question: http://stackoverflow.com/q/27420902
tags question: http://stackoverflow.com/q/27372216
tags question: http://stackoverflow.com/q/27360966
tags question: http://stackoverflow.com/q/27335487
tags question: http://stackoverflow.com/q/27437559
tags question: http://stackoverflow.com/q/27452749
tags question: http://stackoverflow.com/q/27408647
tags question: http://stackoverflow.com/q/27456242
tags question: http://stackoverflow.com/q/27444934
tags question: http://stackoverflow.com/q/27326819
tags question: http://stackoverflow.com/q/27467635
tags question: http://stackoverflow.com/q/27366553
tags question: http://stackoverflow.com/q/27385347
tags question: http://stackoverflow.com/q/27466078
tags question: http://stackoverflow.com/q/27322199
tags question: http://stackoverflow.com/q/27352952
tags question: http://stackoverflow.com/q/27346582
tags question: http://stackoverflow.com/q/27442975
tags question: http://stackoverflow.com/q/27407650
tags question: http://stackoverflow.com/q/27393599
tags question: http://stackoverflow.com/q/27376189
tags question: http://stackoverflow.com/q/27399533
tags question: http://stackoverflow.com/q/27420797
tags question: http://stackoverflow.com/q/27344122
tags question: http://stackoverflow.com/q/27354948
tags question: http://stackoverflow.com/q/27345133
tags question: http://stackoverflow.com/q/27421548
tags question: http://stackoverflow.com/q/27335595
tags question: http://stackoverflow.com/q/27334613
tags question: http://stackoverflow.com/q/27446559
tags question: http://stackoverflow.com/q/27392915
tags question: http://stackoverflow.com/q/27411543
tags question: http://stackoverflow.com/q/27377259
tags question: http://stackoverflow.com/q/27379810
tags question: http://stackoverflow.com/q/27425961
tags question: http://stackoverflow.com/q/27416279
tags question: http://stackoverflow.com/q/27359917
tag name: hibernate
tags question: http://stackoverflow.com/q/27402839
tags question: http://stackoverflow.com/q/27415066
tags question: http://stackoverflow.com/q/27363330
tags question: http://stackoverflow.com/q/27387955
tags question: http://stackoverflow.com/q/27403513
tags question: http://stackoverflow.com/q/27443748
tags question: http://stackoverflow.com/q/27397333
tags question: http://stackoverflow.com/q/27338670
tags question: http://stackoverflow.com/q/27451278
tags question: http://stackoverflow.com/q/27315055
tags question: http://stackoverflow.com/q/27472985
tags question: http://stackoverflow.com/q/27356227
tags question: http://stackoverflow.com/q/27395140
tags question: http://stackoverflow.com/q/27427188
tags question: http://stackoverflow.com/q/27358031
tags question: http://stackoverflow.com/q/27364531
tags question: http://stackoverflow.com/q/27313964
tags question: http://stackoverflow.com/q/27461568
tags question: http://stackoverflow.com/q/27469104
tags question: http://stackoverflow.com/q/27442866
tags question: http://stackoverflow.com/q/27368877
tags question: http://stackoverflow.com/q/27420161
tags question: http://stackoverflow.com/q/27396000
tags question: http://stackoverflow.com/q/27377993
tags question: http://stackoverflow.com/q/27329843
tags question: http://stackoverflow.com/q/27358037
tags question: http://stackoverflow.com/q/27470387
tags question: http://stackoverflow.com/q/27386124
tags question: http://stackoverflow.com/q/27384322
tags question: http://stackoverflow.com/q/27335339

http://stackoverflow.com/comment/43108962
comment on: http://stackoverflow.com/a/27324222
score: 0
type: Comment
has text: Thanks, I wasn't using the file from the selection, thats why it crashed, sometimes the simpliest things are the hardest ones to see.
type: AnswerComment

http://stackoverflow.com/q/27390088
type: Question
type: AnsweredQuestion
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27390373
accepted answer: http://stackoverflow.com/a/27390373
has title: File Not Found Exception - data file in resource folder throwing exception when executing from jar
upvote count: 1
answer count: 1
tagged with: executable-jar
tagged with: jar
has body: I have a Swing app that I'm trying to package up in a runnable JAR file. Part of its DAO functionality is reading and writing in CSV format to a .dat file inside src/main/resources/dictData.dat My issue is that each time I try to run the jar, I get java.io.FileNotFoundException: file:/Users/jason/projects/test-dict/target/ dictionary-jar-with-dependencies.jar!/dictData.dat (No such file or directory) from the command line. This is from a jar built via mvn package and the maven-assembly-plugin specifications org.apache.maven.plugins maven-assembly-plugin 2.4.1 jar-with-dependencies com.test.dictionary.init.AppInit make-assembly package single I have a FileIO class implementation that handles the reading and writing to the file. public class FileIO implements IO{ private static final String DICTIONARYFILE = "dictData.dat"; private File dataFile; private Writer dataWriter; private Reader dataReader; @Override public Map<String, Word> loadDataFile(){ ClassLoader classLoader = getClass().getClassLoader(); Map<String, Word> dictMap = new HashMap<>(); try { //Open file connection and read stream dataFile = new File(classLoader.getResource(DICTIONARYFILE).getFile()); dataReader = new FileReader(dataFile); //CSV parsing code here } catch (NullPointerException | IOException | NumberFormatException e){ e.printStackTrace(); } } } I only get this error when executing java -jar dictionary-jar-with-dependencies.jar inside /Users/jason/projects/test-dict/target/. If I run via the IDE, I get no errors. Thing is, I can see dictData.dat at the end of the jar via vim dictionary-jar-with-dependencies.jar: ... ... com/test/dictionary/utils/FileIO.class com/test/dictionary/utils/HttpUtils.class com/test/dictionary/utils/IO.class dictData.dat META-INF/maven/com.test/ META-INF/maven/com.test/dictionary/ META-INF/maven/com.test/dictionary/pom.xml META-INF/maven/com.test/dictionary/pom.properties So, short of moving the data file into a test-dict/com/text/dictionary/data location, how can I r…
favorite count: 0
downvote count: 0
tagged with: maven

http://stackoverflow.com/a/27436570
has body: Two applications running on the same tomcat Yes. Deploy two web application archive (war) files. They share the same db. They need to use the same security system (filter on app1 save a token on the session) or spring security. This is just configuration. You could use the same xml file, properties file or database setup to configure your two (or more) applications. You might use two repositories (one for configuration, one for development). You might use Apache Zookeeper.
has comment: http://stackoverflow.com/comment/43313910
type: Answer
has comment: http://stackoverflow.com/comment/43329211
has comment: http://stackoverflow.com/comment/43328932
answers question: http://stackoverflow.com/q/27436547
has comment: http://stackoverflow.com/comment/43329100
has comment: http://stackoverflow.com/comment/43314220
score: 0

http://stackoverflow.com/comment/43118279
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27330081
has text: possible duplicate of [How do I pass data between activities in Android?](http://stackoverflow.com/questions/2091465/how-do-i-pass-data-between-activities-in-android)
score: 0

http://stackoverflow.com/a/27413129
has comment: http://stackoverflow.com/comment/43270681
upvote count: 3
has comment: http://stackoverflow.com/comment/43271074
has body: You cannot use a variable name as a type name, so methodB won't compile. You can however use a type parameter for the method. Try &lt;T&gt; void methodB(Class&lt;T&gt; clazz) { T a; HashMap&lt;String, T&gt; hash = new HashMap&lt;&gt;(); }
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43270780
has comment: http://stackoverflow.com/comment/43270696
type: Answer
accepted answer of: http://stackoverflow.com/q/27413112
answers question: http://stackoverflow.com/q/27413112
downvote count: 0
score: 3

http://stackoverflow.com/q/27351412
has body: I've a simple report with only one table and paper size set as A4. On the viewer the PDF format is correct but when generated by calling a Java class, the alignment is messed up. It has huge margin in right, tried setting margin to 0, align center... but no luck Here is the Java code (I'm using Birt 4.4.0) PDFRenderOption pdfOptions = new PDFRenderOption(); pdfOptions.setOutputFormat(RenderOption.OUTPUT_FORMAT_PDF); pdfOptions.setEmitterID(RenderOption.OUTPUT_EMITTERID_PDF); pdfOptions.setOption(IPDFRenderOption.PAGE_OVERFLOW, IPDFRenderOption.FIT_TO_PAGE_SIZE); pdfOptions.setOutputStream(response.getOutputStream());
score: 0
tagged with: http://stackoverflow.com/tag/pdf
answer count: 1
accepted answer: http://stackoverflow.com/a/27374234
type: AnsweredQuestion
tagged with: birt
tagged with: java
type: Question
has title: Birt generating different PDF format for the same report
has answer: http://stackoverflow.com/a/27374234

http://stackoverflow.com/q/27357702
tagged with: java
has title: Most efficient way to retrieve an unoccupied point in a binary matrix
has comment: http://stackoverflow.com/comment/43167808
has answer: http://stackoverflow.com/a/27357877
type: Question
answer count: 2
tagged with: algorithm
accepted answer: http://stackoverflow.com/a/27381142
tagged with: random
tagged with: matrix
has comment: http://stackoverflow.com/comment/43167888
has body: Say we have a binary matrix (0 or 1, whatever), where 0 means unoccupied and 1 means occupied. The matrix is filled randomly with such values. I know all the points that are occupied, but not those that aren't... that is, I can get an array of the points that are occupied, but not of those that aren't. What is the most efficient way of getting a random, non-occupied point from the matrix? I have tried getting getting a random point in the matrix like this: x = random number from 0 to maxX y = random number from 0 to maxY while (x, y) is occupied: x = random number from 0 to maxX y = random number from 0 to maxY return (x, y) This has the best-case running time of nothing and worst-case of forever. Another thing I've tried is point[] unoccupied for each y in matrix for each x int matrix if (x, y) is unoccupied push (x, y) to unoccupied shuffle unoccupied return unoccupied[0] This has a time complexity of at least O(x * y). Most of the time it's slower than the first approach, but it's a lot more stable. The task is trivial enough, but are there more efficient ways to accomplish this? This isn't any kind of homework or the sort. I'm implementing a snake-like game and am trying to place a new apple/cookie to some unoccupied place.
has answer: http://stackoverflow.com/a/27381142
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43167912
possible better answer: http://stackoverflow.com/a/27357877
score: 0

http://stackoverflow.com/comment/43206346
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27378393
has text: now i m getting this exceptionException in thread "main" java.lang.OutOfMemoryError: Java heap space

http://stackoverflow.com/comment/43111206
score: 0
comment on: http://stackoverflow.com/q/27325883
type: Comment
type: QuestionComment
has text: I added this jar to class path,but it doesn't work

http://stackoverflow.com/a/27366325
has comment: http://stackoverflow.com/comment/43189805
score: 3
accepted answer of: http://stackoverflow.com/q/27366285
upvote count: 3
answers question: http://stackoverflow.com/q/27366285
type: AcceptedAnswer
downvote count: 0
has body: Perhaps just skip that line entirely from the StringBuffer while ((line = bufferedReader.readLine()) != null) { if(line.contains("REEL SCAN,BASIS WT") { continue; } stringBuffer.append(line.trim()); stringBuffer.append("\n"); }
type: Answer

http://stackoverflow.com/comment/43250747
has text: Can you define an extra `sayHello()` method on your interface? And then, each of your classes implement it like: class A { sayHello() { sayHelloFromA(); } sayHelloFromA() { // Logic goes here } } If you can't add method to the interface, you probably could extend it
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27403011

http://stackoverflow.com/comment/43224260
type: Comment
score: 0
has text: yes am sure .. and with same name
comment on: http://stackoverflow.com/q/27387896
type: QuestionComment

http://stackoverflow.com/q/27426602
tagged with: java
upvote count: 1
tagged with: windows-services
type: Question
tagged with: dll
tagged with: java-native-interface
downvote count: 0
has body: I have a program in java I run through a service I wrote who uses JNI to start a JVM and launch the program. The program dynamically loads other jni dlls when it needs to. The problem is that if i run the service as NetworkService, the jni dlls load fine, but if i run it as a LocalService (which has more privileges and should be able to access the network) I get a java.lang.UnsatisfiedLinkError: C:\Netstar\build_0704_24_02\lib\JobExecutable.dll: The specified procedure could not be found Some more details: I run the service from a windows share, but before it runs java it copies all the jars and dlls locally. I tried using dependancy walker but it led me nowhere. I also made sure there are no network paths in my Path environment variable. One of the java directives is -Djava.library.path=C:\Netstar\build_0704_24_02\lib Thanks for the help
favorite count: 0
type: UnansweredQuestion
tagged with: windows
has title: java.lang.UnsatisfiedLinkError from LocalService but not from NetworkService
answer count: 0
score: 1

http://stackoverflow.com/comment/43110677
score: 0
type: Comment
has text: Is this method working for you
comment on: http://stackoverflow.com/a/27325587
type: AnswerComment

http://stackoverflow.com/q/27365725
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43183550
tagged with: jframe
has comment: http://stackoverflow.com/comment/43183565
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27365898
has body: I would like to scroll through the contents of my JFrame up and down, preferably with a scroll bar. I don't want to wrap the contents inside a JPanel or JScrollPane, because this causes some visual glitches with my application. Any idea on how to do this?
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/43183605
tagged with: scroll
upvote count: 1
tagged with: swing
type: Question
has answer: http://stackoverflow.com/a/27365898
score: -1
has comment: http://stackoverflow.com/comment/43183642
has title: How to make a JFrame scrollable?
has comment: http://stackoverflow.com/comment/43186125

http://stackoverflow.com/q/27446945
upvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
has title: How to edit/delete objects from another method that were created programatically
downvote count: 1
type: Question
tagged with: java
score: -1
has body: I have a method that creates layouts vertically each with 3 buttons aligned horizontally with onClick creating one at a time with each click to a max of 5 layouts. How do I remove those layouts with a button that was created. public void addTroop(Editable name){ LinearLayout mainPage = (LinearLayout) findViewById(R.id.manageTroopsMain); if (count &lt;= 5) { //CREATE NEW LINEAR LAYOUT LinearLayout addTroopLayout = new LinearLayout(this); //CREATE LAYOUT PARAMS FOR LAYOUT LinearLayout.LayoutParams newLayout = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); newLayout.bottomMargin = 10; //STYLE NEW LINEAR LAYOUT addTroopLayout.setTag("addTroopLayout" + count); addTroopLayout.setLayoutParams(newLayout); addTroopLayout.setOrientation(LinearLayout.HORIZONTAL); //CREATE NEW BUTTONS Button newTroop = new Button(this); Button remove = new Button(this); Button change = new Button(this); //CREATE LAYOUT PARAMS FOR BUTTONS LinearLayout.LayoutParams newTroopParam = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 20f); LinearLayout.LayoutParams rmvBtnParam = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, .5f); LinearLayout.LayoutParams chngNameParam = new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, .5f); //STYLE NEW BUTTONS newTroop.setText(name); newTroop.setGravity(Gravity.LEFT|Gravity.CENTER_VERTICAL); newTroop.setLayoutParams(newTroopParam); remove.setTag("rmvBtn" + count); remove.setText("-"); remove.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.CENTER_VERTICAL); remove.setLayoutParams(rmvBtnParam); change.setText("..."); change.setGravity(Gravity.CENTER_HORIZONTAL|Gravity.CENTER_VERTICAL); change.setLayoutParams(chngNameParam); //ADD VIEWS TO NEW LAYOUT addTroopLayout.addView(newTroop); addTroopLayout.addView(remove); addTroopLayout.addView(change); //ADD NEW LAYOUT TO mainPage LAYOUT mainPage.addView(addTroopLayout); //Increment Co…
has comment: http://stackoverflow.com/comment/43332831
has answer: http://stackoverflow.com/a/27447031

http://stackoverflow.com/q/27327459
has answer: http://stackoverflow.com/a/27327502
possible better answer: http://stackoverflow.com/a/27327487
has answer: http://stackoverflow.com/a/27327487
downvote count: 1
accepted answer: http://stackoverflow.com/a/27327862
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43113866
has body: I see some code like public void foo() { final int x = 3; final Object z = new Object(); ....... } I know that x can't be modified since it is final but is there any other reason/explaination for that? compare to without using final? Or the developer just added final to that variable because he just likes to. Thanks.
tagged with: java
score: -1
type: Question
answer count: 3
upvote count: 0
has title: difference of final variable in code block
favorite count: 0
has answer: http://stackoverflow.com/a/27327862

http://stackoverflow.com/comment/43152644
score: 0
has text: The compiler message is pretty clear, you should be able to debug it by yourself.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27348979

http://stackoverflow.com/comment/43194543
type: QuestionComment
score: 2
has text: This works fine for me. Maybe show us your server side.
comment on: http://stackoverflow.com/q/27371201
type: Comment

http://stackoverflow.com/q/27390401
type: Question
has title: How many local method anonymous classes are created?
has body: Consider this class: public class Activity { public ArrayList&lt;testInterface&gt; containerListener = new ArrayList&lt;testInterface&gt;(); public void metodoDiProva(int num) { final int finalNum = num; containerListener.add(new testInterface() { @Override public void metodoDiProva() { System.out.println(finalNum); } }); } } Now just look this method: public void metodoDiProva(int num) { final int finalNum = num; containerListener.add(new testInterface() { @Override public void metodoDiProva() { System.out.println(finalNum); } }); } Imagine the metodoDiProva(int num) is called 2 times, for example: activityObj.metodoDiProva(10); activityObj.metodoDiProva(20); so in the arrayList of the listener there are 2 objects: The first listener object can use the finalNum variable, the value of this variable is 10. The second listener object can use the finalNum variable, the value of this variable is 20. The question is: In the memory there are 2 different InnerClas or only just 1 ?
accepted answer: http://stackoverflow.com/a/27390443
answer count: 1
downvote count: 0
favorite count: 0
tagged with: anonymous-inner-class
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
has answer: http://stackoverflow.com/a/27390443

http://stackoverflow.com/q/27365295
answer count: 1
has answer: http://stackoverflow.com/a/27365435
linked to: http://stackoverflow.com/q/1732348
score: 0
tagged with: file-io
tagged with: http://stackoverflow.com/tag/html
tagged with: regex
has comment: http://stackoverflow.com/comment/43182697
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/25929112
type: Question
linked to: http://stackoverflow.com/q/9847333
has title: Extract all HTML tags, including closing tags, from file using Java without using external library like Jsoup
has body: I have this code that will take in a HTML file, get all the opening HTML tags, and then print them. I was wondering if there was a way to also include the closing tags within this code. So right now it prints: &lt;html&gt; &lt;head&gt; &lt;title&gt; &lt;body&gt; &lt;table&gt; &lt;p&gt; &lt;a&gt; &lt;p&gt; etc. etc. I'm looking for it to print with the closing tags as well. &lt;p&gt; &lt;a&gt; &lt;/a&gt; &lt;/p&gt; Here's the code I have thus far: try { BufferedReader in = new BufferedReader(new FileReader("test.html")); String line; StringBuilder stringBuilder = new StringBuilder(); while ((line = in.readLine()) != null) { stringBuilder.append(line); } String pageContent = stringBuilder.toString(); Pattern pattern = Pattern.compile("&lt;(?!!)(?!/)\\s*([a-zA-Z0-9]+)(.*?)&gt;"); Matcher matcher = pattern.matcher(pageContent); while (matcher.find()) { String tagName = matcher.group(1); System.out.println("&lt;" + tagName + "&gt;"); } in.close(); } Edit: Is there a way to do it without using an external library like Jsoup? Edit 2: I changed my Pattern.compile to this-> &lt;([a-zA-Z0-9]+|/[a-zA-Z0-9]+)(.*?)> and it worked. Thanks.
has comment: http://stackoverflow.com/comment/43185259

http://stackoverflow.com/q/27437609
tagged with: java
tagged with: select
has comment: http://stackoverflow.com/comment/43315820
type: Question
has body: I am trying to use the simplest Spring select tag ever - all it needs to do is have 2 choices one for black and one for white, with the proper tags in place everything that is below the tag renders to white space - very frustrating. In my jsp I have this with my import at the page header &lt;%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%&gt; &lt;form:select path="productColor"&gt; &lt;form:option value="default" label="--Select color"&gt;&lt;/form:option&gt; &lt;form:options items="${colorsMap}"&gt;&lt;/form:options&gt; &lt;/form:select&gt; My controller has the following code Map&lt; String, String &gt; colors = new HashMap(); colors.put("black", "BLACK"); colors.put("white", "WHITE"); model.addObject("colorsMap", colors); the path corresponds to my model object with property "productColor" What am I doing wrong? I have tried many variations, followed many tutorials and examples, I am doing everything to a T with no luck everytime I get a white space on my entire page below where the select tag is being used......please help.
tagged with: jstl
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43316156
has comment: http://stackoverflow.com/comment/43315909
has comment: http://stackoverflow.com/comment/43315552
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27438021
tagged with: spring
has title: Spring Select tag breaks my HTML page

http://stackoverflow.com/comment/43134620
type: AnswerComment
has text: omg... u r right my bad...... The first word in a line has to be capitalized ahahahaa..
type: Comment
comment on: http://stackoverflow.com/a/27338964
score: 0

http://stackoverflow.com/comment/43319789
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27439860
has text: @cfrick that is different ques.
type: QuestionComment

http://stackoverflow.com/q/27414766
has title: Intellij IDEA14 StackOverflow exception when I click Find Usage(or Alt+F7) on large memory PC
has comment: http://stackoverflow.com/comment/43274146
type: UnansweredQuestion
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/27414911
has comment: http://stackoverflow.com/comment/43273601
has body: I'm on Windows 7 PC with 32G memory and Intel i5 3.3GHz CPU and 512G SSD disk, however when I click Find Usage IDEA always give me stackoverflow exception, no matter how I reconfig the vm parameters. Below is IDEA startup log: 2014-12-11 10:53:22,633 [ 27] INFO - #com.intellij.idea.Main - IDE: IntelliJ IDEA (build #IU-139.659.2, 06 Dec 2014 00:00) 2014-12-11 10:53:22,633 [ 27] INFO - #com.intellij.idea.Main - OS: Windows 7 (6.1, amd64) 2014-12-11 10:53:22,633 [ 27] INFO - #com.intellij.idea.Main - JRE: 1.8.0_20-b26 (Oracle Corporation) 2014-12-11 10:53:22,633 [ 27] INFO - #com.intellij.idea.Main - JVM: 25.20-b23 (Java HotSpot(TM) 64-Bit Server VM) 2014-12-11 10:53:22,634 [ 28] INFO - #com.intellij.idea.Main - JVM Args: -Xms128m -Xmx750m -XX:MaxPermSize=1024m -XX:ReservedCodeCacheSize=512m -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -Djsse.enableSNIExtension=false -XX:+UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -Xbootclasspath/a:C:\Program Files (x86)\JetBrains\IntelliJ IDEA 14.0.2\lib\boot.jar -Didea.paths.selector=IntelliJIdea14 2014-12-11 10:53:22,688 [ 82] INFO - #com.intellij.idea.Main - JNA library loaded (64-bit) in 53 ms 2014-12-11 10:53:22,689 [ 83] INFO - penapi.util.io.win32.IdeaWin32 - Native filesystem for Windows is operational 2014-12-11 10:53:22,690 [ 84] INFO - #com.intellij.idea.Main - Using "FocusKiller" library to prevent focus stealing. And below is the exception(more than 1000 lines stack trace) when I press Alt+F7, please help, Thanks. java.lang.StackOverflowError at com.intellij.util.containers.ConcurrentHashMap.computeHashCode(ConcurrentHashMap.java:3821) at com.intellij.util.containers.ConcurrentHashMap.hash(ConcurrentHashMap.java:3837) at com.intellij.util.containers.ConcurrentHashMap.get(ConcurrentHashMap.java:939) at com.intellij.util.containers.ConcurrentRefValueHashMap.get(ConcurrentRefValueHashMap.java:79) at com.intellij.util.containers.ConcurrentWeakValueHashMap.get(ConcurrentWeakValueHashMap.java:32) at …
score: 0
tagged with: intellij-idea
answer count: 1

http://stackoverflow.com/comment/43193957
type: Comment
has text: You can show now the code in your project about function getSpecificProduct?
comment on: http://stackoverflow.com/a/27370879
type: AnswerComment
score: 0

http://stackoverflow.com/q/27360047
upvote count: 0
tagged with: arrays
has body: I'd like to turn user input into a string array, and then edit that array for key words to change them, however I don't know how to do this and immediately ran into problems of trying to solve how to code this without an array going out of bounds. The only code I have is this: import java.util.*; class FilterTest{ public static void main (String[] args){ Scanner scan = new Scanner (System.in); //String[] inputMessage = new String (); I don't know how to do the length here. input.nextString(); inputMessage=input.nextString; } }
has answer: http://stackoverflow.com/a/27360187
answer count: 3
has comment: http://stackoverflow.com/comment/43172174
tagged with: windows
has comment: http://stackoverflow.com/comment/43172184
possible better answer: http://stackoverflow.com/a/27360093
has comment: http://stackoverflow.com/comment/43172375
favorite count: 0
has answer: http://stackoverflow.com/a/27360093
has comment: http://stackoverflow.com/comment/43172313
has comment: http://stackoverflow.com/comment/43172136
downvote count: 2
accepted answer: http://stackoverflow.com/a/27360187
type: AnsweredQuestion
score: -2
tagged with: java
has title: How to turn user input into an array
has answer: http://stackoverflow.com/a/27360241
type: Question

http://stackoverflow.com/q/27413029
accepted answer: http://stackoverflow.com/a/27475673
has comment: http://stackoverflow.com/comment/43385360
has comment: http://stackoverflow.com/comment/43385263
score: 0
has title: NullPointerException in Serializable object
tagged with: jgrasp
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/218384
tagged with: java
has answer: http://stackoverflow.com/a/27475673
has comment: http://stackoverflow.com/comment/43385715
type: Question
has comment: http://stackoverflow.com/comment/43385786
has comment: http://stackoverflow.com/comment/43385874
has comment: http://stackoverflow.com/comment/43385478
answer count: 1
has comment: http://stackoverflow.com/comment/43385191
has comment: http://stackoverflow.com/comment/43385532
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/43385739
has body: This is a college course assignment that creates a ItemRecord class and implements Serializable with getter and setters, then overrides the toString method. Next I created a ItemRecordReport class with a Scanner object mapped to an input file "ItemRecord_text.txt". Created an ObjectOutputStream object mapped to a binary output file "ItemRecord_binary.txt". Created an ObjectInputStream object mapped to the binary file. Everything works. I modified this post by putting in an array in method main and changing the field values with a additional text document. My error is a NullPointerException: This is the stack trace Item Cost Quantity Description Number A100 $ 99.99 10 Canon PowerShot-135 A200 $149.99 50 Panasonic-Lumix T55 A300 $349.99 20 Nikon- D3200 DSRL A400 $280.99 30 Sony- DSC-W800 A500 $ 97.99 20 Samsung- WB35F Exception in thread "main" java.lang.NullPointerException at ItemRecordReport.endRecord(ItemRecordReport.java:165) at ItemRecordReport.main(ItemRecordReport.java:156) ----jGRASP wedge2: exit code for process is 1. ----jGRASP: operation complete. //create program so that objects of class can be serialized, implements interface Serialiable //create constructor with 4 parameters with accompanying get and set methods, Override toString method //create text file with 5 records, create Scanner object,ObjectOutputStream, and ObjectInputStream //create new ItemRecord object, change values of all fields in ItemRecord object using object's set methods //modify ItemRecord object using toString method import java.io.Serializable; public class ItemRecord implements Serializable { //declare 4 fields with private access private String itemNumber; private double cost; private int quantity; private String description; //constructor with no arguments call other constructor with default values public ItemRecord() { this("",0.0,0,""); }//end constructor with no arguments //constructor with 4 arguments public ItemRecord(String number, double price, int quant, String desc) { …
tagged with: serialization
tagged with: nullpointerexception
tagged with: symbols

http://stackoverflow.com/comment/43394810
score: 0
type: Comment
type: QuestionComment
has text: type the ip address of your database...as other have asked, how do you connect to your database otherwise? :)
comment on: http://stackoverflow.com/q/27472407

http://stackoverflow.com/q/27361211
type: Question
upvote count: 1
answer count: 1
has title: Generate static api-doc
favorite count: 0
has answer: http://stackoverflow.com/a/27362844
has body: I need to store swagger statically-generated api json files in our git repo, to easily track API changes. Similar to this http://petstore.swagger.wordnik.com/api/api-docs/user I've attached maven plugin https://github.com/kongchen/swagger-maven-plugin to the project, and it generates *.json files for API. But, the order of api and properties are different from time to time. So the *.json files become modified without any api changes (just different order). Then I've specified the "position" parameter to the every @Api, @ApiOperation @ApiModelProperty annotation, and it's mostly help. but there are some services, that return org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput and javax.ws.rs.core.Response classes, and the properties for that classes are still in random order. So then I've overridden json representation of these classes with /swagger-overriding-models.json And now it works fine. I just wandering, may be it's not the best way, and there are some other possibilities to have api json files generated in the predictable order, without mess with "position" and model overriding?
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: swagger-maven-plugin
tagged with: java
tagged with: swagger

http://stackoverflow.com/q/27355864
downvote count: 1
has comment: http://stackoverflow.com/comment/43164574
tagged with: java
has comment: http://stackoverflow.com/comment/43164652
has body: How to upload large .csv file into server using java.upto 10gb file i uploaded and when uploading large files taking so much of time.
type: Question
answer count: 1
score: 0
tagged with: rest
tagged with: file-upload
favorite count: 0
type: UnansweredQuestion
has title: How to upload large file in to server in java
upvote count: 1
has answer: http://stackoverflow.com/a/27355965

marker
tag name: marker
tags question: http://stackoverflow.com/q/27392407
type: Tag

http://stackoverflow.com/comment/43116921
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27329203
type: QuestionComment
has text: use another scheduled thread that runs post your thread start with thread reference in it and wakes up say after an hour and if it still runs interrupt it (provided your thread responds to interruption).

http://stackoverflow.com/comment/43152004
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27337171
has text: Got everything solved. Using the regular material theme instead of AppCompat and using the regular toolbar API. This allowed what I wanted as well as the the title to stay. Thanks!
type: Comment

http://stackoverflow.com/comment/43145314
score: 0
comment on: http://stackoverflow.com/q/27344863
has text: @almasshaikh, In the stacktrace, it is pointing the line `for(int i=0;i<substr.length;i++)` and the previous line to it `System.out.println("In the second time execution of JSP after getting data from the servlet");` has been executed. So my best guess is as `substr` is null during first submit of the jsp, it is giving `nullpointerexception`.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27314977
has answer: http://stackoverflow.com/a/27315025
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43089862
score: 0
has answer: http://stackoverflow.com/a/27315325
has comment: http://stackoverflow.com/comment/43089963
has title: List<Integer> objects in order of length
type: UnansweredQuestion
has body: Write code for a Comparator object that orders List&lt;Integer&gt; objects in order of their length. So I know how to write the comparator but i'm confused as to how I can add objects to a List&lt;Integer&gt; so that the list contains for example: [1,2,3],[1,2,3,4,5],[99,102,301,31,31]. Or am i misunderstanding? Thanks
has comment: http://stackoverflow.com/comment/43089918
tagged with: object
tagged with: list
tagged with: java

http://stackoverflow.com/q/27324206
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/27324416
upvote count: 1
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/27324416
downvote count: 0
has answer: http://stackoverflow.com/a/27324384
favorite count: 0
has comment: http://stackoverflow.com/comment/43107830
has body: the method 'insertAscending' only gives me the first number even after i enter new ones. can anyone help with what i'm doing wrong? Thanks. public class LinkedList13 { // Private inner class Node private class Node{ int data; Node link; public Node(){ data = Integer.MIN_VALUE; link = null; } public Node(int x, Node p){ data = x; link = p; } } // End of Node class public Node head; public LinkedList13(){ head = null; } public void insertAscending(int data){ Node node = new Node(); node.data = data; if (head == null) head = node; Node p = head; while (p.link != null) { if (p.link.data &gt; data) { node.link = p.link; p.link = node; break; } p= p.link; } } }
has answer: http://stackoverflow.com/a/27324452
accepted answer: http://stackoverflow.com/a/27324452
has title: Writing a method to sort a singly linkedlist in ascending order (java)
type: AnsweredQuestion
tagged with: linked-list

http://stackoverflow.com/q/27472407
type: Question
has comment: http://stackoverflow.com/comment/43379377
duplicate of: http://stackoverflow.com/q/1457716
has title: how to get MySQL database URL?
score: 0
tagged with: jdbc
has comment: http://stackoverflow.com/comment/43394810
has body: I have created a database in MySQL workbench and I want to get the URL of my database to use it in the JDBC code which is: Connection connection = DriverManager.getConnection(Database_URL, username, password); so please tell how can I get Database_URL for my database???
linked to: http://stackoverflow.com/q/1457716
has comment: http://stackoverflow.com/comment/43379373
answer count: 0
type: UnansweredQuestion
tagged with: java
tagged with: mysql

http://stackoverflow.com/comment/43296703
type: Comment
has text: This is the most elaborate answer. -> +1
type: AnswerComment
comment on: http://stackoverflow.com/a/27427206
score: 0

http://stackoverflow.com/a/27386664
answers question: http://stackoverflow.com/q/27386351
type: Answer
downvote count: 0
has body: I suspect the problem is you are creating a lot of garbage and maxing out the garbage collector. try recycling your buffer. byte buffer[] = new byte[4096]; while (mainthread.getstatus() == Download.Downloading &amp;&amp; downloaded &lt; size) { // read from server into buffer int read = stream.read(buffer, 0, Math.min(buffer.length,size-downloaded)); if (read == -1) break; file.write(buffer, 0, read); downloaded += read; } }
has comment: http://stackoverflow.com/comment/43221610
score: 1
upvote count: 1

http://stackoverflow.com/a/27471180
score: 3
upvote count: 3
has body: You have to provide an empty default constructor in your key class CompositeGroupKey. It is used for serialization. Just add: public CompositeGroupKey() { }
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27471146

http://stackoverflow.com/comment/43369941
has text: Adding the break does work but the continue leads to another infinite loop.
comment on: http://stackoverflow.com/a/27467049
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27456930
answers question: http://stackoverflow.com/q/27422560
has comment: http://stackoverflow.com/comment/43354267
has body: You also need to use the Bulk Update query when writing to the database. Google JDBC Bulk updates for details - so depending on how you are doing the JDBC query you will need to use the corresponding bulk update mechanism
has comment: http://stackoverflow.com/comment/43355969
score: 0
type: Answer

http://stackoverflow.com/comment/43244758
type: QuestionComment
comment on: http://stackoverflow.com/q/27398334
score: 0
has text: wait.. give me 5 mints..
type: Comment

http://stackoverflow.com/a/44297416
upvote count: 1
score: 1
has body: For people who share a common Dropbox folder, you can set it up as a Maven repository using this configuration in your project/pom.xml or maven/conf/settings.xml: localDropbox file://[path to Dropbox folder] And to use mvn deploy to send artifacts there: <distributionManagement> localDropbox file://[path to Dropbox folder] </distributionManagement> If the folder is publicly available, people who want access to that could have a http URL instead of filesystem URL in their declaration.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27386654
accepted answer of: http://stackoverflow.com/q/27386654
type: Answer

http://stackoverflow.com/q/27325221
has comment: http://stackoverflow.com/comment/43110557
type: Question
tagged with: testing
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/43127209
has answer: http://stackoverflow.com/a/27335655
has comment: http://stackoverflow.com/comment/43127874
has title: Main class run with exception in thread error with JUnit
tagged with: junit
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43128432
has comment: http://stackoverflow.com/comment/43110083
has comment: http://stackoverflow.com/comment/43128004
has comment: http://stackoverflow.com/comment/43126499
has answer: http://stackoverflow.com/a/27326152
has comment: http://stackoverflow.com/comment/43128059
has body: I'm using the crimson editor along with the command prompt console for compiling and running the programs. I've just installed and am new to JUnit. Currently, I'm following a basic tutorial from TutorialsPoint.com and have followed the steps setting the classpath. The link to the tutorial is available here: http://www.tutorialspoint.com/junit/junit_environment_setup.htm From this tutorial, there's an ending part whereby you will asked to create class files to test the JUnit. Eventually, after compiling, I tried to run the main class but I was presented with a long series of errors so I was hoping you guys can help me out here. import org.junit.Test; import static org.junit.Assert.assertEquals; public class TestJunit { @Test public void testAdd() { String str= "Junit is working fine"; assertEquals("Junit is working fine",str); } } Main class: import org.junit.runner.JUnitCore; import org.junit.runner.Result; import org.junit.runner.notification.Failure; public class TestRunner { public static void main(String[] args) { Result result = JUnitCore.runClasses(TestJunit.class); for (Failure failure : result.getFailures()) { System.out.println(failure.toString()); } System.out.println(result.wasSuccessful()); } } And the screenshot of the console displaying the error:
tagged with: java

http://stackoverflow.com/a/27453090
type: Answer
has body: Use the Random class and generate a float with it. It will be a number in the range between 0.0 and 1.0. So to have a chance of 1 in a hundred, check if it is smaller than 1/100 == 0.01. Random crit = new Random(); boolean isCriticalHit = crit.nextFloat() &lt; 0.01;
score: 0
answers question: http://stackoverflow.com/q/27452966

http://stackoverflow.com/comment/43401202
comment on: http://stackoverflow.com/a/27471347
type: AnswerComment
has text: So are you saying you already knew how to send the heart beat? Or did this answer that question and now you have a new question?
score: 0
type: Comment

http://stackoverflow.com/comment/43202293
type: QuestionComment
has text: My assumption was that the variables are initialized to default values after any constructor call.So do yo mean that even before constructor is called ,VM defaults the instance variables to some value??
score: 0
comment on: http://stackoverflow.com/q/27375410
type: Comment

http://stackoverflow.com/q/27351242
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
has body: I want to write an xsl document to generate motre than 1 output in .html according to the xml xml : <?xml version="1.0" encoding="UTF-8"?> Libro Chapter 1 Chapter 2 I want to get one html for each "chapter" in the xml, in this case, the result will have to be 2 html document xsl : <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saxon="http://saxon.sf.net/" extension-element-prefixes="saxon" version="1.1"> <xsl:output method="html" indent="yes"/> <xsl:template match="./book/"> <xsl:for-each select="./chapter"> <xsl:variable name="filename" select="concat(title,'.html')"/> <xsl:document href="{$filename}"> <xsl:value-of select="title" /> <xsl:value-of select="body" /> </xsl:document> </xsl:for-each> </xsl:template> </xsl:stylesheet> java code : DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(input); // Use a Transformer for output TransformerFactory tFactory = TransformerFactory.newInstance(); Transformer transformer = tFactory.newTransformer(new StreamSource(xslt)); DOMSource source = new DOMSource(document); StreamResult result = new StreamResult(System.out); transformer.transform(source, result); I've some questions 1.- I ran the program but I had this error: java.lang.RuntimeException: Elemento 'http://www.w3.org/1999/XSL/Transform:document' de XSL no soportado I dont know why, I've add the path in my xsl:stylesheet but doesn't seem to work correclty should I change for ? 2.- After I add to my java project the saxon library I have this error: Attribute @href is not allowed on element How do I solve this problem ?
has title: xsl multiple outputs using java
downvote count: 0
tagged with: http://stackoverflow.com/tag/html
answer count: 1
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/27351933
accepted answer: http://stackoverflow.com/a/27351933
upvote count: 1
tagged with: xslt

http://stackoverflow.com/q/27331557
has comment: http://stackoverflow.com/comment/43120895
downvote count: 0
possible better answer: http://stackoverflow.com/a/27331633
has answer: http://stackoverflow.com/a/27331683
has title: How can i search an arrray of object with a value in java
answer count: 3
has comment: http://stackoverflow.com/comment/43120866
has comment: http://stackoverflow.com/comment/43121587
favorite count: 0
accepted answer: http://stackoverflow.com/a/27331683
upvote count: 1
has body: i have two classess named, Patient Class and Client Class. i have created methods in Patient Class and Calling them in Client Class. i want to add a method to find a entered record by its id and display it. what changes needed in my applications. Programs are given below: Patient Class import javax.swing.*; public class Patient { private String patientname; private String fathername; private String date; private int dob; private static int id = 9000; private String disease; private String n; private double nic; private String doctorname; private String prescription; private String history; private String searchid; private int storesearchid; Patient() {} public void setPatientInformation() { id++; patientname = JOptionPane.showInputDialog("Enter Patient name: "); fathername = JOptionPane.showInputDialog("Enter Father name of patient: "); date = JOptionPane.showInputDialog("Enter date of birth : "); dob = Integer.parseInt(date); disease = JOptionPane.showInputDialog("Enter disease: "); n = JOptionPane.showInputDialog("Enter nic no: "); nic = Integer.parseInt(n); doctorname = JOptionPane.showInputDialog("Enter your doctor name: "); prescription = JOptionPane.showInputDialog("Enter description of disease: "); history = JOptionPane.showInputDialog("Enter history of disease? "); } public void showPatientInformation() { JOptionPane.showMessageDialog(null, "Patient Id" + id + "\nPatient Name: " + patientname + "\nPatient Father Name: " + fathername + "\nPatient Date of birth: " + dob + "\nDisease: " + disease + "\nNIC No:" + nic + "\nDoctor Name: " + doctorname + "\nPrescription: " + prescription + "\nHistory: " + history); } public void SearchByPatientId() { searchid = JOptionPane.showInputDialog("Enter Id of Patient."); storesearchid = Integer.parseInt(searchid); if (storesearchid == obj[id]) { JOptionPane.showMessageDialog(null, "Record Found"); } else { JOptionPane.showMessageDialog(null, "Record With This Id Not Found."); } } } Client Class import javax.swing.*; public…
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27332252
score: 1
tagged with: java
tagged with: methods
tagged with: arrayobject
has answer: http://stackoverflow.com/a/27331633
type: Question
has comment: http://stackoverflow.com/comment/43120919

http://stackoverflow.com/a/27857500
upvote count: 1
answers question: http://stackoverflow.com/q/27390576
score: 1
downvote count: 0
type: Answer
has body: Also appears that with API21 there is a rendering bug specifically with Date/Time pickers, and it appears this has been an ongoing issue for a few revisions. As you say above dropping back to 19 or less solves it. I didnt try 20. See: https://code.google.com/p/android/issues/detail?id=82712

http://stackoverflow.com/a/27396090
score: 1
upvote count: 1
has body: update UserDetails set userStatus=:userStatus where department=:department
answers question: http://stackoverflow.com/q/27396000
type: Answer
downvote count: 0

http://stackoverflow.com/comment/43122994
score: 0
type: QuestionComment
has text: Unfortunately that is not an option. We are dealing with a large AS400 database that has been in place for 20+ years. This is an issue that we have with several hundred tables. This is a very common naming method with legacy systems.
type: Comment
comment on: http://stackoverflow.com/q/27332518

http://stackoverflow.com/comment/43374059
type: QuestionComment
comment on: http://stackoverflow.com/q/27469423
has text: Thank you laune. Interesting. Whats the solution to this? How can I go about it
score: 0
type: Comment

http://stackoverflow.com/a/27369241
has body: Your transliteration reveals several problems: Swing GUI objects should be constructed and manipulated only on the event dispatch thread. Don't use setSize() when you really mean to override getPreferredSize(). Invoke pack() to let the container adopt its preferred size. Use javax.swing.Timer to pace the animation. Revised code, incorporating @Mad's fix and using drawOval(): import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.Timer; final public class Test { JFrame frame; DrawPanel drawPanel; private int timeStep = 0; private int ballYTravel = 100; private int BALL_NUM = 24; public static void main(String... args) { new Test().go(); } private void go() { EventQueue.invokeLater(new Runnable() { @Override public void run() { frame = new JFrame("Test"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); drawPanel = new DrawPanel(); frame.add(BorderLayout.CENTER, drawPanel); frame.setResizable(false); frame.pack(); frame.setLocationByPlatform(true); frame.setVisible(true); Timer t = new Timer(10, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { drawPanel.repaint(); } }); t.start(); } }); } private class DrawPanel extends JPanel { public double getY(int i, int t) { return 200 + ballYTravel / 2 * (Math.sin(t * (i / 200d + 0.08))); } @Override public void paintComponent(Graphics g) { super.paintComponent(g); for (int k = 0; k &lt; BALL_NUM; k++) { g.drawOval(100 + 20 * k, (int) getY(k, timeStep), 8, 8); } timeStep++; } @Override public Dimension getPreferredSize() { return new Dimension(700, 500); } } }
upvote count: 5
type: Answer
answers question: http://stackoverflow.com/q/27368235
downvote count: 0
score: 5

http://stackoverflow.com/a/27365554
type: Answer
has comment: http://stackoverflow.com/comment/43400252
has comment: http://stackoverflow.com/comment/43183622
upvote count: 1
score: 1
has body: How to switch betwen list without funny jlang.object Why did you change the code for the example? The original code uses a custom ListModel. Your code uses the DefaultListModel. By default a JList just invokes the toString() method on any element added to the ListModel. sourceListModel.addElement(new String[] { "One", "Two", "Three" }); Your code is adding an Array to the ListModel. The toString() method of an Arry will display data like "jlang.object". The original code added the individual elements of the Array to the ListModel. So the solution is to NOT add an Array to the ListModel. Instead you need to add each element separately: sourceListModel.addElement("One"); sourceListModel.addElement("Two"); sourceListModel.addElement("Three");
has comment: http://stackoverflow.com/comment/43183276
has comment: http://stackoverflow.com/comment/43214276
answers question: http://stackoverflow.com/q/27365377
downvote count: 0
has comment: http://stackoverflow.com/comment/43214246
has comment: http://stackoverflow.com/comment/43212510

http://stackoverflow.com/q/27386121
has comment: http://stackoverflow.com/comment/43220543
has comment: http://stackoverflow.com/comment/43220490
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43220634
tagged with: php
possible better answer: http://stackoverflow.com/a/27386216
type: Question
has answer: http://stackoverflow.com/a/27386530
has answer: http://stackoverflow.com/a/27386216
has body: I wanted to get the response from the server with the following code (This is the part where it connects) InputStream is = new URL(url + "?p=" + pnb).openStream(); while (is.available() &gt; 0) out[i++] = (char) is.read(); Why does it crash with java.io.IOException: Server returned HTTP response code: 403 for URL: http://172.18.19.16:32000/php/test.php?p=662 when it works when i type that very line into a browser?
tagged with: java
accepted answer: http://stackoverflow.com/a/27386530
linked to: http://stackoverflow.com/q/15845075
answer count: 2
linked to: http://stackoverflow.com/q/2529682
has title: java - get response from php script with arguments
has comment: http://stackoverflow.com/comment/43220677
score: 0
has comment: http://stackoverflow.com/comment/43220435
has comment: http://stackoverflow.com/comment/43220943

http://stackoverflow.com/q/27344936
has body: I am attempting to make an HTTP Post Request from a Java SE application to a Java EE application using Apache HttpClient and JSON-Simple 1.1. I believe that I am mostly done with the request but am having difficulty figuring out how to add the JSON to it and how to complete this request. What do I need to do to include the JSON and what else needs to be done to finish this post request? //HTTP POST REQUEST USING APACHE HTTPCLIENT 3.3 &amp; SIMPLE JSON 1.1 import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.MalformedURLException; import org.apache.http.HttpResponse; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.DefaultHttpClient; public static void postRequestUsingApacheHttpClient() { try { //#1 This instantiates httpclient to make the request. DefaultHttpClient httpClient = new DefaultHttpClient(); //#2 This adds the url to the post data. HttpPost postRequest = new HttpPost("http://localhost:8080/program"); //#3 Create the JSON object. JSONObject reportObject = new JSONObject(); reportObject.put("student_id", myClass[c].getStudentElement(s).getStudentNumber()); reportObject.put("student_name", myClass[c].getStudentElement(s).getName()); reportObject.put("school_name", getSchoolName()); reportObject.put("instructor_name", getInstructorName()); reportObject.put("course_name", myClass[c].getClassName()); reportObject.put("absent_days", String.valueOf(myClass[c].getStudentElement(s).getAbsences())); reportObject.put("tardy_days", String.valueOf(myClass[c].getStudentElement(s).getTardies())); reportObject.put("total_grade", String.valueOf(myClass[c].getStudentElement(s).getTotalGrade())); StringEntity se = new StringEntity(reportObject.toString()); if (response.getStatusLine().getStatusCode() != 201) { throw new RuntimeException("Failed : HTTP error code : " + response.getStatusLine().getStatusCode()); } BufferedReader br = new Buffere…
score: 0
has title: HttpClient and Simple JSON Http Post Request
answer count: 0
has comment: http://stackoverflow.com/comment/43145870
type: UnansweredQuestion
tagged with: request
tagged with: http
has comment: http://stackoverflow.com/comment/43147281
tagged with: java
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/20740349
type: Question
tagged with: httpclient

http://stackoverflow.com/q/27354321
tagged with: jpa
has comment: http://stackoverflow.com/comment/43161829
tagged with: openejb
has answer: http://stackoverflow.com/a/27355074
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/43161843
accepted answer: http://stackoverflow.com/a/27356565
type: Question
tagged with: jakarta-ee
type: AnsweredQuestion
has title: Object mapping JPA/openEJB for database
has answer: http://stackoverflow.com/a/27354520
linked to: http://stackoverflow.com/q/21762328
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/43161887
possible better answer: http://stackoverflow.com/a/27354520
has body: Hello everyone I am trying to get my class to persist to my database however I have run into a problem im not sure how to solve. I am attempting to map the three instances of Score with my user but I am not sure how ti get this to work. Any help is appreciated. Thank you :) User class Snipit. @Column(name="userName", unique=true) private String username; @Column(name="password") private String password; //I am not sure how to map the three fields below. private Score highestScore; private Score averageScore; private Score lowestScore;
has comment: http://stackoverflow.com/comment/43161914
has answer: http://stackoverflow.com/a/27356565

http://stackoverflow.com/a/27376255
type: Answer
answers question: http://stackoverflow.com/q/27375548
score: 2
has body: i had same problem that was solved this way: if you are using searchManager.getSearchablesInGlobalSearch(); than just delete this line it will work fine..
downvote count: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27375548
upvote count: 2

http://stackoverflow.com/comment/43161025
type: Comment
comment on: http://stackoverflow.com/a/27322141
score: 0
type: AnswerComment
has text: sorry,i am unable to understand your problem, do you mean is it the form in dialog box may cause problem?

http://stackoverflow.com/comment/43335150
type: AnswerComment
comment on: http://stackoverflow.com/a/27438641
has text: The values are 1 and 10. And i'm not familier with a debugger.
score: 0
type: Comment

http://stackoverflow.com/comment/44136453
type: Comment
comment on: http://stackoverflow.com/a/27850214
has text: Thanks for checking out my topic. From 22:05 (T - 45 seconds) till 22:07 (T + 62 seconds), this was all the traffic of my application - these 3 requests and a warmup. I can't understand why the third request waited between 10 and 15 seconds while I have one instance always on, and I had no traffic, and my code runs in <200ms as you can see. I have total of 17 jars, 5 are appengine-..., 5 are datanucleus-..., gcm-server.jar, geronimo-jpa_2.0_spec-1.0.jar, jdo-api-3.0.1.jar, json-simple-1.1.jar, jsr107cache-1.1.jar, jta-1.1.jar, asm-4.0.jar
score: 0
type: AnswerComment

http://stackoverflow.com/a/27383798
has comment: http://stackoverflow.com/comment/43220089
score: 0
has comment: http://stackoverflow.com/comment/43219467
has comment: http://stackoverflow.com/comment/43222857
type: Answer
has comment: http://stackoverflow.com/comment/43221725
answers question: http://stackoverflow.com/q/27369147
has comment: http://stackoverflow.com/comment/43223543
has comment: http://stackoverflow.com/comment/43222010
has comment: http://stackoverflow.com/comment/43219818
has body: Try adding out.flush(); after out.println("2");.
has comment: http://stackoverflow.com/comment/43225350

http://stackoverflow.com/comment/43105654
has text: a +=b means a = a + b;
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27322007
type: Comment

http://stackoverflow.com/a/27560077
type: Answer
has body: Your question is interesting because someone can simulate a simple neural network using this design. As far as the answer goes, I would like to view the problem as tasks ordering rather than a multithreading/concurrency problem because concurrency can be achieved simply by executing ordered tasks. Now lets try to use event driven programming to achieve that because it allows nice loosely coupled components. So, now our design in reactive in nature, so we will worry about signaling the dependent tasks once we are done, lets use observer pattern here . Your tasks are both observable and observer as well because they wait on notification from predecessor and notify successor, which gives us the following construct. // Task.java public abstract class Task extends Observable implements Runnable, Observer { private final Mutex lock = new Mutex(); private final String taskId; public String getTaskId() { return this.taskId; } private final Set&lt;String&gt; completedTasks; private final Set&lt;String&gt; shouldCompletedTasksBeforeStart; public Task(final String taskId) { this.taskId = taskId; this.completedTasks = new HashSet&lt;&gt;(); this.shouldCompletedTasksBeforeStart = new HashSet&lt;&gt;(); } @Override public void run() { while (true) { this.lock.getLock(); if (this.completedTasks.equals(this.shouldCompletedTasksBeforeStart)) { doWork(); setChanged(); notifyObservers(this.taskId); // reset this.completedTasks.clear(); } this.lock.freeLock(); try { // just some sleep, you change to how it fits you Thread.sleep(1000); } catch (final InterruptedException e) { // TODO Auto-generated catch block } } } @Override public void update(final Observable observable, final Object arg) { this.lock.getLock(); this.completedTasks.add((String) arg); this.lock.freeLock(); } public void addPredecessorTask(final Task task) { if (this.taskId.equals(task.taskId)) { return; } this.lock.getLock(); // Notice here, it is a little logic make your predecessor/successor work task.addObserver(this…
score: 4
upvote count: 4
downvote count: 0
answers question: http://stackoverflow.com/q/27359112

http://stackoverflow.com/q/27414344
has answer: http://stackoverflow.com/a/37754979
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/29748207
tagged with: java
type: Question
score: 5
accepted answer: http://stackoverflow.com/a/27464917
upvote count: 5
has comment: http://stackoverflow.com/comment/43297932
answer count: 3
downvote count: 0
has body: This is my first post so if I didn't follow some protocol I was supposed to, apologies. I am trying to populate a ListView with some information from my Firebase database. I think the problem I am having is that the query to the database is too slow (the thread is probably downloading pictures) and my activity loads its activity layout without waiting for the thread to finish executing. (If I step through the debugger and wait a bit, I will eventually see the information I am parsing: user names, user numbers, and user pictures) Everything I have queried suggests I should use AsyncTask to accomplish this. As opposed to using thread blocking or a semaphore b/c AsyncTask is thread safe. To my understanding, Firebase queries are already executing asynchronously; therefore, the doInBackground method for AsyncTask I have "tried" to implement seems redundant. Also, I am a bit confused of AsyncTask's overloaded signature and the call to: new someTask.execute("some stuff in a string"). Any suggestions on how I can accomplish this? Any feedback is very much appreciated! // Please ignore the minor indentation from pasting my code in protected void onCreate(Bundle savedInstanceState) { ... new getFirebaseInfoTask(); } private class getFirebaseInfoTask extends AsyncTask { @Override protected Object doInBackground(Object... args) { // Do stuff userInfoList = GetUserInfoFromFirebase.getUserInfo(); // Unsure if I need to return here. return userInfoList; } @Override protected void onProgressUpdate(Object... args) { // Update your UI here populateUserInfoList(); } } private void populateUserInfoList() { // Create list of items Collections.addAll(userInfoList); populateFriendsListView(); } private void populateFriendsListView() { // Build the adapter ArrayAdapter&lt;UserInfo&gt; adapter = new MyListAdapter(); // Configure the list view ListView listView = (ListView) findViewById(R.id.friends_listview); listView.setAdapter(adapter); registerClickCallBack(); } ... // More code public …
favorite count: 0
tagged with: android-asynctask
has title: How to populate Android ListView with information from Firebase query
has comment: http://stackoverflow.com/comment/57545432
tagged with: firebase-realtime-database
has answer: http://stackoverflow.com/a/29748207
tagged with: android
has answer: http://stackoverflow.com/a/27464917
has comment: http://stackoverflow.com/comment/43278196
tagged with: firebase

http://stackoverflow.com/q/27370411
has answer: http://stackoverflow.com/a/27370795
accepted answer: http://stackoverflow.com/a/27370795
type: AnsweredQuestion
tagged with: java
type: Question
has title: Java: Open URL in browser popup window in center of screen
answer count: 1
has body: I can't seem to find answer anywhere but How can I open URL in default-set browser, but not typical full screen browser but a small window in center of monitor? I have Java application which uses Flickr API, when user logins it needs to open small window to show Authorize App or not, full screen huge window looks stupid.
score: 0

http://stackoverflow.com/q/27438308
possible better answer: http://stackoverflow.com/a/27438372
has answer: http://stackoverflow.com/a/27438372
tagged with: java
tagged with: overriding
has answer: http://stackoverflow.com/a/27438463
tagged with: subclassing
answer count: 2
has title: How to force call superclass implementation Object.toString() rather than subclass overriding implementation on an object in Java
has body: Please note: I am not asking how to force all classes to override toString() in their source code. Please read the question carefully. All classes in java extend the Object class. If any class has a toString() override, a call to Object.toString() will actually execute the overriding method. For example: String test = "StackOverflow"; Object testobj1 = (Object) test; System.out.println(testobj1.toString()); // prints "StackOverflow" Object testobj2 = new Object(); System.out.println(testobj2.toString()); // prints "java.lang.Object@<Object.hashcode() in hex>" What I need is for a call to testobj1's toString() to actually execute the Object class's toString() method. Something like: System.out.println( testobj1 as Object .toString()); // prints "java.lang.String@<Object.hashcode() in hex>" I tried using: System.out.println(testobj1.getClass().getName() + '@' + Integer.toHexString(testobj1.hashCode())); But this also has the same problem as above. The hashCode() method is also overriden by String class, so it is executing String's hashCode(), not Object's hashCode(). Is it possible to call the overridden method, rather than the overriding method? Please note: The use of String class is merely an example. Do not base your answer on the assumption that the object is always a String object. Also assume: I have no access to the source code of classes, so I can't just remove toString() implementation from them or do things like creating an abstract class. This has to work for any object (including that of Java's own classes or any API like String, HashMap, HttpServlet, etc). This also means that I'm not looking for answers like these.
downvote count: 0
linked to: http://stackoverflow.com/q/13403017
favorite count: 0
accepted answer: http://stackoverflow.com/a/27438463
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: superclass
type: Question

http://stackoverflow.com/q/27429597
accepted answer: http://stackoverflow.com/a/27480683
has comment: http://stackoverflow.com/comment/43300664
favorite count: 0
has title: Nullpointer Exception with Pragma table_info
has comment: http://stackoverflow.com/comment/43394182
tagged with: android
has comment: http://stackoverflow.com/comment/43313523
score: -3
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43319599
downvote count: 3
has answer: http://stackoverflow.com/a/27480683
type: Question
has comment: http://stackoverflow.com/comment/43356378
answer count: 2
upvote count: 0
has body: in an Android project we want to read the column informations of the database. We found the examples with the PRAGMA table info. Now we run the App and it failed with an nullpointerexcpetion and we have no idea why this happens. Here is a part of our Code. public String[] getTableColumns(SQLiteDatabase db, String tableName) { Log.d("ArtDbHandler: ", "getTableColumns Start"); Cursor cursor = null; cursor = db.rawQuery("PRAGMA table_info(" + tableName + ")", null); Log.d("ArtDbHandler: ", "getTableColumns cnt:"+cursor.getCount()); String[] allColumns = new String[cursor.getCount()]; int i = 1; while (!cursor.isAfterLast()) { Log.d("ArtDbHandler: ", "getTableColumns i:"+i); String columnName = cursor.getString(TABLE_INFO_PRAGMA_COLUMNNAME_INDEX); Log.d("ArtDbHandler: ", "getTableColumns columnName:"+columnName); allColumns[i] = columnName; ++i; cursor.moveToNext(); } cursor.close(); Log.d("ArtDbHandler: ", "getTableColumns Ende"); return allColumns; } In LogCat we get the "getTableColumns Start" log an then the exception is thrown. We call the method with our sqlitedatabase object and the tablename, that is defined in our DBHandler Class. Any Ideas? Thanks 4 help. T. Logcat: Here is the logcat: 12-11 19:03:56.634: D/onCreate Main:(3325): onCreate 12-11 19:03:56.634: D/MediumDAO:(3325): MediumDAO Start 12-11 19:03:56.644: D/MediumDAO:(3325): MediumDAO Ende 12-11 19:03:56.644: D/ArtDbHandler:(3325): getTableColumns Start:medium 12-11 19:03:56.644: D/AndroidRuntime(3325): Shutting down VM 12-11 19:03:56.644: W/dalvikvm(3325): threadid=1: thread exiting with uncaught exception (group=0x40a71930) 12-11 19:03:56.664: E/AndroidRuntime(3325): FATAL EXCEPTION: main 12-11 19:03:56.664: E/AndroidRuntime(3325): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.artdb/com.example.artdb.ArtDbMainActivity}: java.lang.NullPointerException 12-11 19:03:56.664: E/AndroidRuntime(3325): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180…
has comment: http://stackoverflow.com/comment/43303531
has comment: http://stackoverflow.com/comment/43302080
possible better answer: http://stackoverflow.com/a/27429974
has answer: http://stackoverflow.com/a/27429974

http://stackoverflow.com/comment/43139288
comment on: http://stackoverflow.com/q/27341162
score: 0
type: QuestionComment
has text: I want to passing byte stream from C program to JAVA program, InputStream solve my problem. Thank you! @fge
type: Comment

http://stackoverflow.com/comment/43121837
type: QuestionComment
comment on: http://stackoverflow.com/q/27332066
has text: have a look [here](https://hibernate.atlassian.net/browse/HHH-9141)
score: 1
type: Comment

http://stackoverflow.com/comment/43153986
has text: I tried that, didn't work because gaps are between components
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27349705

http://stackoverflow.com/comment/53350143
type: Comment
has text: Don't know what you mean by "arbitrary moment". The Spring Boot user guide and samples have examples of using a `CommandLineRunner` (and the newer `ApplicationRunner`): http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-command-line-runner.
score: 7
type: AnswerComment
comment on: http://stackoverflow.com/a/27409513

http://stackoverflow.com/q/27331289
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/43120404
type: Question
linked to: http://stackoverflow.com/q/23353173
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/43120530
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/43120673
has comment: http://stackoverflow.com/comment/43120648
tagged with: arrays
has comment: http://stackoverflow.com/comment/43120456
has title: Nullpointerexception arraylistfunction
tagged with: nullpointerexception
tagged with: android
has body: I am trying to make this simple function: private void getID(){ for(int i=0;i&lt;crops.size();i++){ ID.add(i); } } where cropps.size() is the size of a bitmaparraylist which i've made. People told me that these function fail because you can get the argument null. But how can i get null if i don't fill in any arguments... I've also tried to make the input of the function an Arraylist of integers but this failed as wel. On my Oncreate method i use getID() after i made the crops so that isn't the error as well. So i'm kind of confused here and help would be much appreciated. Kees
has comment: http://stackoverflow.com/comment/43120557
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/43247020
type: Comment
comment on: http://stackoverflow.com/a/27378369
has text: Sorry, I didn't get the question properly
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43349161
type: QuestionComment
has text: Welcome to Stack Overflow! It would be best if you copied your code in as text using the built-in code formatting, rather than relying on an image.
comment on: http://stackoverflow.com/q/27455691
score: 0
type: Comment

http://stackoverflow.com/q/27354101
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43161424
has title: Java .vs. C# Memory Usage and Performance
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43161878
has answer: http://stackoverflow.com/a/27354525
has comment: http://stackoverflow.com/comment/43198254
upvote count: 1
has body: I am tasked with coding up an enterprise level eCommerce setup. I know PHP, C#, VB.NET, C++. I have reviewed a variety of benchmarks in respect to speed performance online and obviously the results are as expected, C++ hands down, C# and Java close enough its immaterial and PHP a strong last place. I have been learning Java, not too different from C/C++ after all. I have viewed some memory usage benchmarks related to both C# (ASP.NET) and Java (operating system stuff aside). However, everything I have located trends towards the more simple scaler variables and normal "any language" constructs. What I am interested in are memory and even speed performance benchmarks comparing complex objects. Cant seem find a thing that is not biased. I am not interested in the "I like this better or that better", thats simple preference. I am interested in more concrete data as throughput and memory usage equate to server load and sessions serviced. Thanks in advance.
type: Question
tagged with: c#
has comment: http://stackoverflow.com/comment/43161373
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43161608
tagged with: asp.net

http://stackoverflow.com/q/27404886
tagged with: java
type: Question
has title: Code after AWT object creation seemingly not executed
tagged with: java-native-interface
has body: Test.java import java.awt.Frame; public class Test { public static void main(String[] args) { try { System.out.println("test main"); Frame t = new Frame(); System.out.println("test main2"); } catch (Exception e) { System.out.println("Catch"); } finally { System.out.println("Finally"); } } } test.cc JNIEnv *_VMEnvironment; JavaVM *_VM; jclass _JavaClass; void init() { const int tCount = 1; JavaVMInitArgs tArgs; JavaVMOption tOptions[tCount]; tArgs.version = JNI_VERSION_1_6; tArgs.nOptions = tCount; std::string tPath = "-Djava.library.path=/usr/lib"; tOptions[0].optionString = const_cast&lt;char*&gt;(tPath.c_str()); tArgs.options = tOptions; tArgs.ignoreUnrecognized = JNI_FALSE; JNI_CreateJavaVM(&amp;_VM, (void**)&amp;_VMEnvironment, &amp;tArgs); } void start() { jmethodID tMainMethod; _JavaClass = _VMEnvironment-&gt;FindClass("Test"); tMainMethod = _VMEnvironment-&gt;GetStaticMethodID( _JavaClass, "main", "([Ljava/lang/String;)V"); _VMEnvironment-&gt;CallStaticVoidMethod(_JavaClass, tMainMethod, nullptr); std::cout &lt;&lt; "Done" &lt;&lt; std::endl; } int main() { init(); start(); return 0; } If I link against libverify, libjava, libjvm I get the following output: test main test main2 Finally Done However if I also link against libjawt, libmawt, libawt I get the following output: test main Finally Done I'm very puzzled why the second println (seemingly) isn't getting executed. I tried creating other object types instead of the Frame and didn't see the issue occur. Likewise I tried various awt object types and always saw the same result. For reference I'm running 64bit centos with java 1.7.0_51.
tagged with: awt
has comment: http://stackoverflow.com/comment/43256826
score: 0
has comment: http://stackoverflow.com/comment/43259396
type: UnansweredQuestion
tagged with: linker
tagged with: c++
answer count: 0

http://stackoverflow.com/comment/43377936
has text: "\n 33 to 47 for special characters" + "\n 65 to 90 for uppercase letters" + "\n 97 to 102 for lowercase letters");
comment on: http://stackoverflow.com/a/27471279
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27321475
tagged with: osgi
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27322240
tagged with: equinox
score: 0
possible better answer: http://stackoverflow.com/a/27324568
has answer: http://stackoverflow.com/a/27324568
type: Question
has body: I am trying to create a backup file of a bundle that is installed in the runtime, so that I can uninstall it and then possibly reinstall from the backup if I want. Does anybody know how to get a handle on the location of the bundle file that is already installed in the runtime? I would like to do this in a way that will work regardless of OSGi container (specifically, I want it to work in Equinox and Felix). Ideally this would be information gained from the Bundle object (or from information from an object acquired from the Bundle object). Edit: In a nutshell, I am getting every bundle installed (bundleContext.getBundles) and from that attempting to determine file paths of the bundles.
tagged with: java
answer count: 2
has answer: http://stackoverflow.com/a/27322240
has title: Get InputStream of bundle already installed in OSGi runtime?
tagged with: apache-felix

http://stackoverflow.com/comment/43306936
type: QuestionComment
has text: Took me a second but I think it's because ".*" is greedy. Look up reluctant modifiers for regex, it'll help you out.
comment on: http://stackoverflow.com/q/27432862
score: 0
type: Comment

http://stackoverflow.com/comment/43237401
has text: @Jens I'm sorry I am not Java savvy. What is the directory again? (I have to take a programming class for my major)
comment on: http://stackoverflow.com/q/27395334
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43233961
has text: Thanks Chris for your quick reply !
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27393405
type: AnswerComment

http://stackoverflow.com/comment/43132589
type: Comment
comment on: http://stackoverflow.com/a/27337670
has text: vanje...will the HTTP Post request allow me to communicate within the same computer? Also, on the Java EE side how many places will I put the code? Will I put the code in just one servlet. Or will I have to code the xml file or any other places?
score: 0
type: AnswerComment

http://stackoverflow.com/a/27408500
has body: java for string you need use equal try below code &lt;c:when test="#{documentBean.docType eq 'application/pdf'}"&gt; &lt;p:media value="/filePreview?id=#{searchBean.selectedID}" player="pdf" width="100%" height="300"/&gt; &lt;/c:when&gt; or &lt;c:when test="#{documentBean.docType.equal('application/pdf')}"&gt; &lt;p:media value="/filePreview?id=#{searchBean.selectedID}" player="pdf" width="100%" height="300"/&gt; &lt;/c:when&gt;
upvote count: 0
answers question: http://stackoverflow.com/q/27405555
type: Answer
has comment: http://stackoverflow.com/comment/43269304
downvote count: 1
score: -1

http://stackoverflow.com/q/27421862
answer count: 0
score: 1
tagged with: java
has title: SSL error between Java and LAMP
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43298175
tagged with: ssl
has comment: http://stackoverflow.com/comment/43319977
tagged with: security
tagged with: apache
downvote count: 0
has comment: http://stackoverflow.com/comment/43299162
favorite count: 0
has comment: http://stackoverflow.com/comment/43286274
has body: I am running a website on the LAMP stack and our payment gateway have changed their security in some way, so when processing card payments we now come across this: Template : https://www.example.com/ not found! javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target (I've replaced the real address with example.com) When you click the link that is "not found" the page loads completely fine, no errors, no security issues and our certificates are 100% in all online SSL cert tests and our security rating from SSLLabs is A-, so I can't see what the problem would be? Is there anything I can do to get around this, or will it be down to our payment gateway to resolve this Java issue? Many thanks
has comment: http://stackoverflow.com/comment/43319914
type: UnansweredQuestion
tagged with: php
has comment: http://stackoverflow.com/comment/43319468

http://stackoverflow.com/a/27419093
has comment: http://stackoverflow.com/comment/99939979
upvote count: 212
score: 210
downvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43871710
has comment: http://stackoverflow.com/comment/99997116
type: Answer
has comment: http://stackoverflow.com/comment/43284961
answers question: http://stackoverflow.com/q/27416834
has comment: http://stackoverflow.com/comment/45707164
has comment: http://stackoverflow.com/comment/43865182
has comment: http://stackoverflow.com/comment/65629756
has body: This issue usually occurs when no LayoutManager was provided for the RecyclerView. You can do it like so: final LinearLayoutManager layoutManager = new LinearLayoutManager(context); layoutManager.setOrientation(LinearLayoutManager.VERTICAL); recyclerView.setLayoutManager(layoutManager);
has comment: http://stackoverflow.com/comment/99940113
accepted answer of: http://stackoverflow.com/q/27416834

http://stackoverflow.com/a/27453740
type: Answer
accepted answer of: http://stackoverflow.com/q/27445101
has body: Finally!! My ajax code was not correct. My servlet was doing good with the html tags, but if i made an ajax call to get data from the servlet it wouldn't recognize the html tags in my servlet. This is the ajax code bellow for the people getting the same problem: function data(){ $(document).ready(function() { $('#moeder').click(function() { $.ajax({ url: 'MyServlet', type: 'GET', datatype: 'html', success : function(result) { jQuery("#ajaxGetUserServletResponse").html(result); //i added this line and it worked. } }); }); }); }
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27445101

http://stackoverflow.com/comment/43178081
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27362883
has text: Thanks for the response! Is exactly what I'm searching for: food for thoughts, because I'm thinking about the best approach to one new project
type: AnswerComment

http://stackoverflow.com/comment/43154829
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27350059
type: Comment
has text: Do some simple research.

http://stackoverflow.com/comment/43105855
score: 0
type: AnswerComment
type: Comment
has text: What's the use of putting 'distance=(value);' at the end of each IF statement
comment on: http://stackoverflow.com/a/27322007

http://stackoverflow.com/a/27387264
downvote count: 0
answers question: http://stackoverflow.com/q/27387224
has body: If vote[j] and total_votes are int, you will get 0. You need to cast one of them to double before the division : percentage[m] = ((double)vote[m] / total_votes)*100;
score: 4
type: Answer
upvote count: 4

http://stackoverflow.com/comment/43137428
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27340505
has text: `header.setFont(new Font("SansSerif", Font.BOLD, 14));` better to use `header.setFont(new Font(Font.SANS_SERIF, Font.BOLD, 14));` for compile time checking.

http://stackoverflow.com/q/27347379
tagged with: cookies
tagged with: java
has comment: http://stackoverflow.com/comment/43163524
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43150920
downvote count: 0
has comment: http://stackoverflow.com/comment/43160009
has answer: http://stackoverflow.com/a/27362694
type: Question
has comment: http://stackoverflow.com/comment/43160495
score: 1
has title: Can't get Set-Cookie property in Java
favorite count: 0
upvote count: 1
accepted answer: http://stackoverflow.com/a/27362694
tagged with: properties
answer count: 1
has body: I have a java method which should get Set-Cookie property for following login into webpage. But the conn.getHeaderFields().get("Set-Cookie") does not return anything. Any advice? private String GetPageContent(String url) throws Exception { URL obj = new URL(url); conn = (HttpsURLConnection) obj.openConnection(); // default is GET conn.setRequestMethod("GET"); conn.setUseCaches(false); // act like a browser conn.setRequestProperty("User-Agent", USER_AGENT); conn.setRequestProperty("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"); conn.setRequestProperty("Accept-Language", "s-CZ,cs;q=0.8,en;q=0.6"); if (cookies != null) { for (String cookie : this.cookies) { conn.addRequestProperty("Cookie", cookie.split(";", 1)[0]); } } int responseCode = conn.getResponseCode(); System.out.println("\nSending 'GET' request to URL : " + url); System.out.println("Response Code : " + responseCode); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(),"UTF-8")); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); // Get the response cookies System.out.println(conn.getHeaderFields().get("Set-Cookie")); //print for testing setCookies(conn.getHeaderFields().get("Set-Cookie")); return response.toString(); Whole program: http://pastebin.com/3nB682L7 Anyone?..:-)

http://stackoverflow.com/q/27332347
has title: I need help understanding this java code
favorite count: 0
tagged with: anonymous-class
has comment: http://stackoverflow.com/comment/43122290
tagged with: anonymous-inner-class
has comment: http://stackoverflow.com/comment/43122256
has comment: http://stackoverflow.com/comment/43122235
linked to: http://stackoverflow.com/q/22534356
accepted answer: http://stackoverflow.com/a/27332358
upvote count: 1
downvote count: 1
type: AnsweredQuestion
tagged with: oop
tagged with: java
has answer: http://stackoverflow.com/a/27332377
tagged with: class
type: Question
has body: I'm following this Swing tutorial and I ran across this snippet of code: EventQueue.invokeLater(new Runnable() { @Override public void run() { SimpleExample ex = new SimpleExample(); ex.setVisible(true); } }); What's happening inside the EventQueue.invokeLater params?
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27332358
possible better answer: http://stackoverflow.com/a/27332377

http://stackoverflow.com/comment/43483286
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27455310
has text: In this case the benefits of encapsulation are not really justified, because the elements are so frequently accessed and they're being used in a game engine, where performance is critical. The only benefit I can see is convenience if you are used to typing `get`. If you submit a pull request, I don't think they will accept a change that reduces visibility of `x` and `y`. Plus, it would break just about every class in every game made by anyone. :) In my opinion, there should not be getters and setters sitting along side a public variable, because it might be a source of confusion.
score: 0

http://stackoverflow.com/comment/43159167
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27347643
has text: Thanks! I followed your suggestion and have updated my question to reflect the results from this trial. Could you please take a quick look and suggest any next steps?
score: 0

http://stackoverflow.com/q/27405284
has title: how to make a method to be static?
has comment: http://stackoverflow.com/comment/43255765
favorite count: 0
has answer: http://stackoverflow.com/a/27405326
score: -3
has comment: http://stackoverflow.com/comment/43255373
tagged with: c++
type: AnsweredQuestion
has body: In java we can make a method of a class to be static by writing the keyword static before the type of the method : public static string some_method() { ... } In C++ how to make a method static ?
tagged with: java
downvote count: 3
has comment: http://stackoverflow.com/comment/43255427
type: Question
has comment: http://stackoverflow.com/comment/43255281
accepted answer: http://stackoverflow.com/a/27405326
linked to: http://stackoverflow.com/q/388242
has comment: http://stackoverflow.com/comment/43255286
upvote count: 0
answer count: 1

http://stackoverflow.com/a/37210760
type: Answer
has comment: http://stackoverflow.com/comment/121012405
upvote count: 1
answers question: http://stackoverflow.com/q/27337268
has body: Adding to the reply from jgloves, you might be interested to parse the Heideltime result string into a Java object representation. The following code transforms the Uima-XML representation into Timex3 objects. HeidelTimeStandalone time = new HeidelTimeStandalone(Language.GERMAN, DocumentType.SCIENTIFIC, OutputType.XMI, "config.props", POSTagger.STANFORDPOSTAGGER); String xmiRepresentation = time.process(document, documentCreationTime); //Apply Heideltime and get the XML-UIMA representation JCas cas = jcasFactory.createJCas(); for(FSIterator&lt;Annotation&gt; it= cas.getAnnotationIndex(Timex3.type).iterator(); it.hasNext(); ){ System.out.printkn(it.next); }
downvote count: 0
score: 1

http://stackoverflow.com/comment/43257341
comment on: http://stackoverflow.com/q/27406299
score: 1
has text: Would it be possible to stick the trie in an in-memory database instead of files/RAM?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27374502
has comment: http://stackoverflow.com/comment/43199302
accepted answer of: http://stackoverflow.com/q/27374297
type: Answer
answers question: http://stackoverflow.com/q/27374297
score: 2
has comment: http://stackoverflow.com/comment/43199423
downvote count: 0
has body: You are not passing the uuid which you got as a parameter to your method. You could do use the api like: Object sqlParameters[] = {uuid}; return jdbcTemplate.query(sql, sqlParameters, new ResultSetExtractor&lt;List&lt;String&gt;&gt;() { @Override public List&lt;String&gt; extractData(ResultSet rs) throws SQLException, DataAccessException { List&lt;String&gt; emailList=new ArrayList&lt;String&gt;(); while (rs.next()) { emailList.add(rs.getString("email")); } return emailList; }});
has comment: http://stackoverflow.com/comment/43199522
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/comment/43274042
has text: Let us know if the solution worked. In my case I was running 32 bit on a 64 bit machine and that was causing some memory issue.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27414911
type: AnswerComment

http://stackoverflow.com/a/27438780
accepted answer of: http://stackoverflow.com/q/27438473
has comment: http://stackoverflow.com/comment/43391510
answers question: http://stackoverflow.com/q/27438473
has comment: http://stackoverflow.com/comment/43390264
has body: This can be done using PathVariable. I will just give example how it can be done. You can incorporate in your example Suppose you want to write a url to fetch some order, you can say www.mydomain.com/order/123 where 123 is orderId. So now the url you will use in spring mvc controller would look like /order/{orderId} Now order id can be declared a path variable @RequestMapping(value = " /order/{orderId}", method=RequestMethod.GET) public String getOrder(@PathVariable String orderId){ //fetch order } if you use url www.mydomain.com/order/123, then orderId variable will be populated by value 123 by spring Also note that PathVariable differ from requestParam as pathVariable are part of URL. The same url using request param would look like www.mydomain.com/order?orderId=123
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43389651
score: 4
has comment: http://stackoverflow.com/comment/43390960
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/43391487
has comment: http://stackoverflow.com/comment/43391549

http://stackoverflow.com/comment/43100649
score: 0
type: AnswerComment
type: Comment
has text: Added the input file.
comment on: http://stackoverflow.com/a/27320078

http://stackoverflow.com/a/27443182
answers question: http://stackoverflow.com/q/27443028
has comment: http://stackoverflow.com/comment/43329371
has body: Is your Server started already? If not, you can modify your Timeout-Value for startup and shutdown in Eclipse Server View (Timeouts).
score: 0
type: Answer

http://stackoverflow.com/comment/43263142
type: Comment
type: AnswerComment
has text: And what happens if they input something other than `Y` or `N`?
score: 0
comment on: http://stackoverflow.com/a/27409194

http://stackoverflow.com/comment/43190314
comment on: http://stackoverflow.com/a/27369288
score: 0
type: AnswerComment
type: Comment
has text: I see. Any reason why I should change the method and Question[] variables? I'm not too sure what to add in terms of the parameters. Should I add "Strng[] AskQuestions"?

http://stackoverflow.com/q/27431162
tagged with: case-insensitive
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43303912
tagged with: duplicates
has comment: http://stackoverflow.com/comment/43305374
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43306139
favorite count: 0
has comment: http://stackoverflow.com/comment/43305599
tagged with: arraylist
has body: Ok so nothing has really struck me as a good code set to remove duplicates in an ArrayList without creating a whole new array except this code from CarlJohn. I have tried to respond but my rep points are to low.... still.... So the code is working great minus one exception, it is not ignoring the case so I still get duplicates. ArrayList&lt;String&gt; lst = new ArrayList&lt;String&gt;(); lst.add("ABC"); lst.add("ABC"); lst.add("ABCD"); lst.add("ABCD"); lst.add("ABCE"); System.out.println("Duplicates List " + lst); Object[] st = lst.toArray(); for (Object s : st) { if (lst.indexOf(s) != lst.lastIndexOf(s)) { lst.remove(lst.lastIndexOf(s)); } } System.out.println("Distinct List "+lst); Output is Duplicates List [ABC, ABC, abc, ABCD, ABCD, ABCE, aBCe] Distinct List [ABC, abc, ABCD, ABCE, aBCe] So how do I modify this to ignore the case of the words it is checking.
has answer: http://stackoverflow.com/a/27431481
has answer: http://stackoverflow.com/a/27431431
type: UnansweredQuestion
upvote count: 1
type: Question
has title: removing duplicates from an arraylist using this code but ignoring case

http://stackoverflow.com/q/27380377
tagged with: java
tagged with: hibernate
tagged with: http://stackoverflow.com/tag/json
has title: Can't serialize Lazy fetched objects using jackson and hibernate
has body: We have an existing DB and we started creating Entites for it using hibernate in Java. we are building a web application using play! framework so we are using Jackson to serialize and deserialize our objects to and from the client. In one function we query the DB for a list of Entities (Report for example) and the problem is that some attributes are being Lazy fetched even though we explicitly specified an Eager fetch, which causes a problem in serialization using jackson, because it doesnt know how to handle Lazy fetched objects. Exception: No serializer found for class org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: xxxxxxxx) Explaination: //Our current situation is: //We have a class report and a class user Class Reprot{ [join and fetch eager] User user; } Class User{ String firstName; String lastName; } //And we query a list of Reports: List&lt;Report&gt; list = typedQuery.getResultList(); //When we try to serialze it: JsonNode jn = Json.toJson(list); //it throws the above exception From what we found, the problem is the fact that hibernate uses a cache (first-level cache) so it wont have to fetch things from the DB again and again, and it is probably what it does because each User can have more than one Reports. So what it does is query the list, and when it sees that the current report's user has already been fetched from the DB it puts a proxy instead of an instance, and that proxy is being treated as a Lazy object which can't be serialized. We searched for a solution and we cant find it, hoping anyone here can help us.
type: Question
has comment: http://stackoverflow.com/comment/43209991
tagged with: jpa
linked to: http://stackoverflow.com/q/24994440
tagged with: jackson
has answer: http://stackoverflow.com/a/27389290
upvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/43209965
favorite count: 0
type: UnansweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/43210215
score: 1

http://stackoverflow.com/comment/43214261
has text: you are removing values from the original map now. Don't :)You can't iterate through the map and modify it at the same time. Also, I don't understand what you are trying to do with this `map.values().contains(i)`. The values in the map are lists, there can't be an integer ... Perhaps, you mean `if(map.contains(i))`, but that is always true, because `i` is the key in the `map`.
comment on: http://stackoverflow.com/a/27381761
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43305331
comment on: http://stackoverflow.com/q/27432061
score: 0
type: Comment
type: QuestionComment
has text: what on line 48 in Game.Java? Can you update that line in question?

http://stackoverflow.com/comment/43280839
type: Comment
comment on: http://stackoverflow.com/a/27414314
has text: Hi there, I am using the jdk 8u25. I am not sure if that means anything.
type: AnswerComment
score: 0

http://stackoverflow.com/q/27448767
has body: I have PreparedStatement like this: PreparedStatement st = conn .prepareStatement("Select * from " + "(select Count(*) from uch_otstyp b,prov_uch p " + "where b.\"ID_Poezd\"=?" + "and (b.\"NachKm\"*1000+b.\"NachM\")&gt;? " + "and (b.\"NachKm\"*1000+b.\"NachM\")&lt;=? " + "and b.\"ID_Poezd\"=p.\"ID_Poezd\" " + "and b.\"ID_Uch\"=p.\"ID_Uch\" " + "and p.\"MES\"=? " + "and p.\"GOD\"=? " + "and p.\"Nput\"=? " + "and b.\"Kod_Otstup\"=? " + "and b.\"DEPTH\"&lt;1)," + "" + "(select Count(*) from uch_otstyp b,prov_uch p " + "where b.\"ID_Poezd\"=?" + "and (b.\"NachKm\"*1000+b.\"NachM\")&gt;? " + "and (b.\"NachKm\"*1000+b.\"NachM\")&lt;=? " + "and b.\"ID_Poezd\"=p.\"ID_Poezd\" " + "and b.\"ID_Uch\"=p.\"ID_Uch\" " + "and p.\"MES\"=? " + "and p.\"GOD\"=? " + "and p.\"Nput\"=? " + "and b.\"Kod_Otstup\"=? " + "and b.\"DEPTH\"&gt;=1)" + "and b.\"DEPTH\"&lt;2)"); Parameter values of each subquery are identic. How can I set parameters only for one subquery and automaticaly fill parameters of another(not for each subquery)?
has title: Set parameter for identical subquery in PreparedStatement
tagged with: sql
tagged with: jdbc
has answer: http://stackoverflow.com/a/27449332
has comment: http://stackoverflow.com/comment/43336897
favorite count: 0
has comment: http://stackoverflow.com/comment/43336694
linked to: http://stackoverflow.com/q/16359316
type: AnsweredQuestion
score: 3
upvote count: 3
accepted answer: http://stackoverflow.com/a/27449332
tagged with: java
tagged with: prepared-statement
type: Question
has comment: http://stackoverflow.com/comment/43336772
answer count: 1
downvote count: 0

http://stackoverflow.com/comment/43317893
type: QuestionComment
comment on: http://stackoverflow.com/q/27438883
has text: a,b,c,d are always in order because I am receiving that data from sensor.Format is fixed.av1bv2cv3d where v1,v2,v3 are the values that I want to extract.
score: 0
type: Comment

http://stackoverflow.com/q/27456435
has answer: http://stackoverflow.com/a/27457294
has title: Undesirable syntax in Play framework templates
has body: I am using Play 2.3.7 Java, and I am trying to render templates. I can get it to work, but only by using really ugly syntax. What I have that works so far is right here: https://gist.github.com/aaron235/c21866dd7bff0ba3fc0c Clearly, having a bunch of curly-bracketed blocks of HTML isn't the best way to do this. My ideal 'home.scala.html' would look something like this: https://gist.github.com/aaron235/4f446dfa41feb7d02458 I'd like to have named parameters that parse into 'main.scala.html', but I can't find any resources that make sense, after thorough searching of SO, attempting to find information in "Play for Java" by Nicolas Leroux and Sietse de Kaper, and scouring the rest of the internet. Any help is appreciated.
type: AnsweredQuestion
tagged with: templates
tagged with: playframework-2.0
accepted answer: http://stackoverflow.com/a/27457294
type: Question
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27458229
tagged with: twirl
tagged with: playframework-2.3
tagged with: java
possible better answer: http://stackoverflow.com/a/27458229

build
tags question: http://stackoverflow.com/q/27408266
tags question: http://stackoverflow.com/q/27344160
tags question: http://stackoverflow.com/q/27459789
tags question: http://stackoverflow.com/q/27342061
tags question: http://stackoverflow.com/q/27452200
tag name: build
type: Tag
tags question: http://stackoverflow.com/q/27336701

http://stackoverflow.com/q/27385469
tagged with: java
tagged with: post
score: 0
has body: I am not familiar with SOAP requests so I have been reading up on it. The examples and tutorials I've looked at construct the request in an xml format in the SOAP envelope. example: private static SOAPMessage createSOAPRequest() throws Exception { MessageFactory messageFactory = MessageFactory.newInstance(); SOAPMessage soapMessage = messageFactory.createMessage(); SOAPPart soapPart = soapMessage.getSOAPPart(); String serverURI = "http://ws.cdyne.com/"; // SOAP Envelope SOAPEnvelope envelope = soapPart.getEnvelope(); envelope.addNamespaceDeclaration("example", serverURI); /* Constructed SOAP Request Message: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:example="http://ws.cdyne.com/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <example:VerifyEmail> <example:email>mutantninja@gmail.com</example:email> <example:LicenseKey>123</example:LicenseKey> </example:VerifyEmail> </SOAP-ENV:Body> </SOAP-ENV:Envelope> */ // SOAP Body SOAPBody soapBody = envelope.getBody(); SOAPElement soapBodyElem = soapBody.addChildElement("VerifyEmail", "example"); SOAPElement soapBodyElem1 = soapBodyElem.addChildElement("email", "example"); soapBodyElem1.addTextNode("mutantninja@gmail.com"); SOAPElement soapBodyElem2 = soapBodyElem.addChildElement("LicenseKey", "example"); soapBodyElem2.addTextNode("123"); MimeHeaders headers = soapMessage.getMimeHeaders(); headers.addHeader("SOAPAction", serverURI + "VerifyEmail"); soapMessage.saveChanges(); /* Print the request message */ System.out.print("Request SOAP Message = "); soapMessage.writeTo(System.out); System.out.println(); return soapMessage; } but the example request that was given to me by the organization with the server is a single line with the request in the URL: http://sdmdataaccess.nrcs.usda.gov/Spatial/SDMNAD83Geographic.wfs?Service=WFS&Version=1.0.0&Request=GetFeature&OutputFormat=GML3&TypeName=MapunitPoly&FILTER= Geometry <gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-95.1852448111,4…
answer count: 1
has title: Java SOAP request string in POST data
tagged with: soap
type: AnsweredQuestion
type: Question
has answer: http://stackoverflow.com/a/27385521
accepted answer: http://stackoverflow.com/a/27385521

http://stackoverflow.com/a/27360689
answers question: http://stackoverflow.com/q/27360633
score: 5
type: AcceptedAnswer
downvote count: 0
has body: If you have a String s = "1 2 3 4 5" then you can split it into separate bits like this: String[] bits = s.split(" "); Now you have to put them into an int[] by converting each one: int[] nums = new int[bits.length]; int i=0; for (String s: bits) nums[i++] = Integer.parseInt(s); This will loop through each of the small strings in the split array, convert it to an integer, and put it into the new array.
type: Answer
upvote count: 5
accepted answer of: http://stackoverflow.com/q/27360633

http://stackoverflow.com/comment/43385739
type: Comment
score: 0
has text: You are going to have to solve that, otherwise you will never get anywhere with any of your assignments.
comment on: http://stackoverflow.com/q/27413029
type: QuestionComment

http://stackoverflow.com/q/27414282
has answer: http://stackoverflow.com/a/75114388
has comment: http://stackoverflow.com/comment/43273033
has comment: http://stackoverflow.com/comment/43272895
has comment: http://stackoverflow.com/comment/43274443
favorite count: 0
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/43273731
has body: I got bitbucket.org/luciad/webp-imageio to work in Ubuntu, but I can't get it to work in Windows. Here is what I do in Ubuntu: Download webp-imageio and libwebp source code (other versions can be found in the google webp downloads repository). Using cmake to compile libwebp and webp-imageio, there is a CMakefile.txt file in webp-imageio. Maybe you need to modify it? Then you will get webp-imageio.jar and libwebp-imageio.so (it will be .dll in windows) Put libwebp-imageio.so in the java project Native library location and webp-imageio.jar in the java build path. Then, run the following code: File file1= new File("/home/rtm/Desktop/xixi.webp"); File file2= new File("/home/rtm/Desktop/haha.png"); System.loadLibrary("webp-imageio"); try { BufferedImage im = ImageIO.read(file1); ImageIO.write(im, "png", file2); } catch (IOException e) { e.printStackTrace(); } Then, I use cmake and mingw-w64, compile it in windows (webp-imageio.jar and libwebp-imageio.dll). That doesn't work, however, as ImageIO.read(file1); returns null. WHY? Here is my code for Windows: File file1 = new File("D://workspace//demo//Test//unnamed.webp"); File file2 = new File("D://workspace//demo//Test//xixi.png"); System.loadLibrary("webp-imageio"); try { //FileUtils.copyFile(file1, file2); BufferedImage im = ImageIO.read(file1); ImageIO.write(im, "png", file2); } catch (Exception e) { e.printStackTrace(); } Here is the exception stack: java.lang.IllegalArgumentException: image == null! at javax.imageio.ImageTypeSpecifier.createFromRenderedImage(Unknown Source) at javax.imageio.ImageIO.getWriter(Unknown Source) at javax.imageio.ImageIO.write(Unknown Source)
has answer: http://stackoverflow.com/a/27416562
tagged with: java
has comment: http://stackoverflow.com/comment/43272784
has comment: http://stackoverflow.com/comment/43272915
has comment: http://stackoverflow.com/comment/43272701
upvote count: 4
answer count: 2
tagged with: webp
has title: How to convert webp to png or jpg using java in windows?
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/43272742

http://stackoverflow.com/a/27474138
answers question: http://stackoverflow.com/q/27474115
has comment: http://stackoverflow.com/comment/43383253
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: You should specify the types of all the arguments : PhoneEntry addEntry( String addName, String addNumber ) This is assuming the type of addNumber is String. I would completely re-write your addEntry method, since it had many errors (in both syntax and logic) : PhoneEntry addEntry( String addName, String addNumber ) { boolean found = false; for ( int i = 0 ; i &lt; phoneBook.length ; i++ ) { if ( phoneBook[i].name == null ) { phoneBook[i] = new PhoneEntry( addName, addNumber ); found = true; break; } } if (!found) { System.out.println("Phone book is full! Delete an entry first!"); } return null; // I'm not sure what you wish to return here } You want to use the phoneBook member of your class (the one you initialize in the constructor), not a local variable. And you should search for an empty spot in the entire array before giving a message that the phone book is full.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27474115

http://stackoverflow.com/comment/43166000
comment on: http://stackoverflow.com/q/27356723
score: 0
type: QuestionComment
type: Comment
has text: What's the question again?

http://stackoverflow.com/comment/43168720
score: 0
comment on: http://stackoverflow.com/a/27357877
type: Comment
has text: You are right. Use true randomness if you have less than half the array occupied, use my solution if you have more than half occupied (in this case true randomness may last a lot of time and anyway an apple will be next to an occupied cell).
type: AnswerComment

http://stackoverflow.com/comment/43163757
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27320242
has text: The advantage of everything "inline" is avoiding mutable local variables, which are a common cause of hard-to-trace bugs when combined with large blocks of code. A mutable local unleashes the potential of changing it at any line of code, imposing an increased cognitive load on the programmer. On the other hand, small code blocks should be preferred anyway, in which case the difference diminishes.
type: AnswerComment

http://stackoverflow.com/comment/43118238
has text: Maybe a look at the [swing tutorial](https://docs.oracle.com/javase/tutorial/uiswing/layout/index.html) will help you.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27329988
type: QuestionComment

http://stackoverflow.com/comment/43361584
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27462543
has text: It would appear that you are missing many opporunities to write an algorithm that is one or two orders of magnitude faster. But you haven't described one essential thing: how do you check whether a sequence of letters makes up a word? Also, the example should produce many more words besides "phone" and "tick"!
score: 0

http://stackoverflow.com/a/27362768
type: Answer
answers question: http://stackoverflow.com/q/27362020
score: 1
accepted answer of: http://stackoverflow.com/q/27362020
upvote count: 1
has comment: http://stackoverflow.com/comment/43178131
has body: Do you really need it to be implemented this way? It's not what Iterables.transform() is designed for. First, Iterables.transform() does not accept arrays as its first parameter. You must wrap your states into any Iterable. The easiest and the best way is Arrays.asList(states). Second, the idea of the Iterables.transform() method is to create a transformed sequence using a mapping function, not just to iterate over. I wouldn't recommend the following, but you can make your Function to be parameterized as &lt;State, Void&gt; and return null to simulate plain for-each semantics. Third, you must iterate of the result of the Iterables.transform because this function is lazy and does nothing until you start the iteration with an eager for or something else eager. Fourth, as long as your newly created iterable is not copied to any collection (by semantics; i.e. copied to a List&lt;T&gt; instance), any re-iteration over that iterable will cause one more transformation each time you implicitly invoke iterator.next() for that iterable (i.e. from the for-each). Thus: final JSONObject jsonObject = ... // ... final Iterable&lt;Void&gt; voids = Iterables.transform(Arrays.asList(states), new Function&lt;State, Void&gt;() { @Override public Void apply(State currentState) { jsonObject.put(String.valueOf(currentState.getId()), currentState.getName()); return null; } }); for ( final Void v : voids ) { // do nothing } It's really a bad and ugly idea. You really need an aggregation function that creates/supplies your JSON object, a sequence of State elements to be iterated, and a bi-function that accepts the accumulated JSON object and a single state object and return the updated JSON object. Something like in its generic form (your can create your own functions and decorators): public static &lt;T, R&gt; R reduce(Supplier&lt;R&gt; init, Iterable&lt;T&gt; sequence, BiFunction&lt;R, T, R&gt; function) { R accumulator = init.get(); for ( final T item : sequence ) { accumulator = function…
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43131317
has text: Inner classes can call methods in the container class without qualifying them. Usually. The weirdness here is that `method(0)` isn't read as a call to the exactly matching method in the container class.
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27337363

http://stackoverflow.com/q/27443938
type: Question
tagged with: jtable
has comment: http://stackoverflow.com/comment/43326989
has answer: http://stackoverflow.com/a/27443957
answer count: 1
tagged with: jdbc
has body: I want to delete selcetd row in a JTable from both the table itself and the database. That is my code: Object number = jTable1.getValueAt(selectedRow-1, 0); String sql = "delete from orders where number ="+number; Statement st = conn.createStatement(); rs = null; rs = st.executeQuery(sql); When the excuteQuery() runs I get the following exception: (java.sql.SQLException) java.sql.SQLException: Can not issue data manipulation statements with executeQuery() What am I doing wrong?
has title: SQLException deleting row from JTable and database
tagged with: swing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27443957
score: 0
tagged with: java
tagged with: mysql

http://stackoverflow.com/q/27410019
has answer: http://stackoverflow.com/a/27410245
tagged with: java
has comment: http://stackoverflow.com/comment/43264769
has answer: http://stackoverflow.com/a/27410173
type: Question
has comment: http://stackoverflow.com/comment/43264656
tagged with: arrays
possible better answer: http://stackoverflow.com/a/27410173
has body: In Java, The teacher taught us how to remove an element from an array without using array utils and so on. So I tried the method he gave to us. It updates the index value exactly as I want. after it changes the index value, I want it to delete the last index, "sizeOfArray-1" but I couldn't do that! Any help? Here the code: import java.util.Scanner; public class Arrays { static int x[] = { 1, 2, 3, 4, 5, 6, 7 }; static Scanner input = new Scanner(System.in); public int search(int target) { for (int index = 0; index &lt; x.length; index++) { if (x[index] == target) return index; } return -1; } public void deleteIndex(int target) { int deleted = search(target); if (deleted == -1) System.out.println("Entry Not Found!"); else { x[target] = x[7-1]; } } public static void main(String[] args) { Arrays f = new Arrays(); int counteri = 0; int counterj = 0; for (int j = 0; j &lt; x.length; j++) { System.out.print(counterj + "=&gt;" + x[j] + " \n"); counterj++; } f.deleteIndex(input.nextInt()); for (int i = 0; i &lt; x.length; i++) { System.out.print(counteri + "=&gt;" + x[i] + " \n"); counteri++; } } }
accepted answer: http://stackoverflow.com/a/27410245
score: 0
has title: How to remove an element from an array
has comment: http://stackoverflow.com/comment/43264807
has comment: http://stackoverflow.com/comment/43264682
has answer: http://stackoverflow.com/a/56522333
has comment: http://stackoverflow.com/comment/43264694
has comment: http://stackoverflow.com/comment/43264617
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27411696

http://stackoverflow.com/a/27324452
answers question: http://stackoverflow.com/q/27324206
score: 1
upvote count: 1
has body: First of all, you should return after setting the head of the list (when the first element is added). Second of all, you should handle the case where the newly inserted node is the smallest in the list (and therefore should come first). Your loop never compares the added node to the head of the list. Finally, if the added element wasn't inserted in the while loop, it should be inserted after the while loop. public void insertAscending(int data) { Node node = new Node(); node.data = data; if (head == null) { head = node; return; } else if (node.data &lt; head.data) { node.link = head; head = node; return; } Node p = head; boolean added=false; while (p.link != null) { if (p.link.data &gt; data) { node.link = p.link; p.link = node; added = true; break; } p = p.link; } if (!added) p.link = node; }
has comment: http://stackoverflow.com/comment/43108646
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/116172448
type: Answer
accepted answer of: http://stackoverflow.com/q/27324206

http://stackoverflow.com/q/27374470
has comment: http://stackoverflow.com/comment/43272057
tagged with: jpa
has comment: http://stackoverflow.com/comment/43200924
score: 0
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43199328
tagged with: java
has title: JPA ManyToMany extra composite id
type: Question
has comment: http://stackoverflow.com/comment/43199571
has body: I try to create a ManytoMany relation anotation where the db already struture is fixed, Class A Like the following @Entity @Table(name = "A") public class A @Id @Column(name="A_ID") private Long a_id; ....//some other attributes @ManyToMany @JoinTable(name="A_B", joinColumns=@JoinColumn(name="A_ID"), inverseJoinColumns=@JoinColumn(name="B_ID") ) @OrderColumn(name="SORT_ORDER") @LazyCollection(value=LazyCollectionOption.FALSE) private List&lt;B&gt; bList = new ArrayList&lt;B&gt;(); public List&lt;B&gt; getBList () { return bList ; } public void setBList (List&lt;B&gt; bList ) { this.bList = bList ; } Class B as following: @Entity @Table(name = "B") public class B{ @Id @Column(name="B_ID") private Long b_id; ....//some other attributes } And the manyToMany Table Class A_B has already build A_ID B_ID SORT_ORDER a1 b1 0 a1 b1 1 a1 b2 2 a1 b1 3 a2 b2 0 a2 b3 1 a2 b1 2 a2 b2 3 a2 b3 4 // where a_id, b_id and sort_order are composite key How can I make the annotation to achieve the following objective In class A, get the list of B with sort order Save Class A, also persist Class A_B Thank you

http://stackoverflow.com/comment/43173318
has text: at which line you getting compilation error
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27360633
score: 0

http://stackoverflow.com/a/27442450
downvote count: 0
has comment: http://stackoverflow.com/comment/43327542
type: Answer
has comment: http://stackoverflow.com/comment/43328988
answers question: http://stackoverflow.com/q/27438815
has body: This highly rellies on your deploy process. Servlet mapping which you have specified is added after the path of the deployed application It doesnt specify exact path on application server. This situation occures if you deploy application on some specified name (ussually war name is used). But you can specify it on your own, I ussually deploy single app on the server to be sure its on / Your angular application is served as normal static asset by resource servlet dispatcher on the particular url. If you insist on deploying to the various names I would suggest using relative path. Angular SPA application runs on the particular url, so it will not change during its lifecycle. So if you have your application deployed at /Test and hello REST contoller is on /Test/hello, you can use just hello as url var response = $http({ method: "post", url: "hello", data: { action:"action", } }); If you still want to have absolute urls than you can modify some defined constant during deploy. For that I would recomend you to define constant for base url in some separate config. angular('YourModule') .constant('BASE_URL', '/Test');
score: 1
upvote count: 1

http://stackoverflow.com/q/27439055
tagged with: c++
accepted answer: http://stackoverflow.com/a/27439929
upvote count: 1
answer count: 1
tagged with: object
tagged with: java-native-interface
tagged with: java
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27439929
downvote count: 0
score: 1
has title: JNI - make an instance of another C++ class
type: Question
has body: I have an old application (C++) which I want to invoke with java via JNI. So I read some tutorials and the basics (call a method in C++ from Java) worked very well. But now my problem is I want to instance another C++ object in the method, which is used by JNI. Is this principally not possible or is there any way to do this? For explanation: This is my Java-Class helloworld.java which calls the native method 'callnative()' public class helloworld{ private native void callnative(); public static void main(String[] args){ new helloworld().callnative(); } static { System.loadLibrary("helloworld"); } } This is the native method java_helloworld_callnative(..) #include &lt;jni.h&gt; #include &lt;stdio.h&gt; #include "helloworld.h" #include "hellouniverse.h" JNIEXPORT void JNICALL Java_helloworld_callnative(JNIEnv *env, jobject obj) { printf("HelloWorld\n"); hellouniverse *h = new hellouniverse(); h-&gt;printHelloUniverse(); return; } This is the class hellouniverse #include "hellouniverse.h" #include &lt;stdio.h&gt; #include &lt;string&gt; using namespace std; hellouniverse::hellouniverse(){ } void hellouniverse::printHelloUniverse(){ printf("HelloUniverse!!\n"); } I compiled helloworld.cpp with: g++ -fPIC -shared -I$JAVA_PATH/include -I$JAVA_PATH/include/linux/ -o libhelloworld.so hellworld.cpp and hellouniverse.cpp with: g++ -c -o hellouniverse.o hellouniverse.cpp When I run java helloworld the output is: HelloWorld java:symbol lookup error: $./libhelloworld.so: undefined symbol: _ZN13hellouniverseC1Ev I hope you can help me with my Problem :-)
favorite count: 0

http://stackoverflow.com/comment/43633018
type: QuestionComment
has text: @GregJava, your question was "Please is there any native class that has functions for usb printer port updating and control?". You're asking for a class name it sounds like. A simple google search like i said would lead you to classes, examples, etc. This site in my mind, is more for after you have tried using the printing functions, and were stuck somewhere.
comment on: http://stackoverflow.com/q/27326361
score: 0
type: Comment

http://stackoverflow.com/q/27454803
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27455177
has body: I need to show an ad when a user visits a particular screen at or after 2 mins, then whenever they visit again after 6 minutes,10,14,16... I have the code below, it works fine if the user visits the screen at minutes 2,6,10,14 etc however it does not work if the user misses these minutes. for example if an ad was shown at minute 2 but the user didn't come back until minute 8, the ad for minute 6 is missed. How can I cater for this with what i have so that if the user comes back outside of these minutes, the ad for them will still be shown? long start = adStartTime; long now = new Date().getTime(); int minsElapsedSinceLastAd = (int) ((now - start) / 1000 / 60); showAd = previousRunMin !=minsElapsedSinceLastAd&amp;&amp; minsElapsedSinceLastAd % 4 == 2; if (showAd) { showAd(); ... previousRunMin = minsElapsedSinceLastAd; } previousRunMin is there so that if the user comes back on the same minute, the ad is not shown
has answer: http://stackoverflow.com/a/27455021
type: UnansweredQuestion
type: Question
has title: Do something at x minutes then again every n-th minute
score: 1
tagged with: math
tagged with: java
answer count: 2
has comment: http://stackoverflow.com/comment/43347845
has comment: http://stackoverflow.com/comment/43347619
upvote count: 1

http://stackoverflow.com/comment/43234702
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27371262
has text: @MiiinimalLogic Downvotes are to be provided with reason as comment which was not given. My reasoning for avoiding haar was given in the answer. If you have watched the game of cricket, you will see that, the OP ( student ) is going to spend/waste lots of time collecting samples of players from video and training and retraining and will end up with almost nothing - other than leaning haar training. Also this needs to be done in a video stream. Haar is too slow for that. Secondly, in a cricket video stream multiple cameras and their angles makes haar impossible.

http://stackoverflow.com/comment/43157208
has text: Well, it won't compile to start with...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27351631
score: 0

http://stackoverflow.com/q/27316329
has body: I am trying a Java inheritance code as follows. class A4 { int i, j; A4(int a, int b) { i = a; j = b; } // display i and j void show() { System.out.println("i and j: " + i + " " + j); } } class B4 extends A4 { int k; B4(int a, int b, int c) { super(a, b); k = c; } // overload show void show(String msg) { System.out.println(msg + k); } } class Overload { B4 subOb = new B4(1, 2, 3); subOb.show("This is k: "); // this calls show() in B4, also cannot resolve symbol 'show` subOb.show(); // this calls show() in A4, also cannot resolve symbol `show` } the problem is that subOb can not be resolved, as the IDE (IntelliJ) caught two errors shown in the code. I am wondering what is wrong with the code and how to resolve the issue.
type: Question
tagged with: intellij-idea
tagged with: inheritance
score: 0
answer count: 2
tagged with: multiple-inheritance
has answer: http://stackoverflow.com/a/27316790
has title: Java derived subclass object can't resolve symbol
has comment: http://stackoverflow.com/comment/43092992
has comment: http://stackoverflow.com/comment/43092594
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27316491
tagged with: java
accepted answer: http://stackoverflow.com/a/27316790
has answer: http://stackoverflow.com/a/27316491

http://stackoverflow.com/comment/43337244
type: AnswerComment
comment on: http://stackoverflow.com/a/27448618
has text: Yes, somehow it seems more pythonic, at least to me, to pass a dict of attribute-name, value pairs to a method named set. You could could have a signature like set(self, attr, value=None). If isinstance(attr, dict) call setattr on every key-value pair. If not, call setattr(self, attr value). The only drawback is that setattr will create an attribute if it doesn't exist.
type: Comment
score: 1

http://stackoverflow.com/q/27454084
upvote count: 2
downvote count: 2
tagged with: file
tagged with: dijkstra
type: Question
tagged with: java
has comment: http://stackoverflow.com/comment/43346434
score: 0
has title: Dijkstra's Algorithm in Java
tagged with: matrix
answer count: 1
favorite count: 0
type: UnansweredQuestion
has body: I've been trying to use Dijkstra's Algorithm to find the shortest path in a set of vertices in Java. I've found code for when people have preset values, but I haven't managed to find anything involving files that have matrices read in. Here's the code I currently have: import java.util.*; class Vertex implements Comparable&lt;Vertex&gt; { public final String name; public Edge[] adjacencies; public double minDistance = Double.POSITIVE_INFINITY; public Vertex previous; public Vertex(String argName) { name = argName; } public String toString() { return name; } public int compareTo(Vertex other) { return Double.compare(minDistance, other.minDistance); } } class Edge { public final Vertex target; public final double weight; public Edge(Vertex argTarget, double argWeight) { target = argTarget; weight = argWeight; } } public class Dijkstra { public static void computePaths(Vertex source) { source.minDistance = 0.; PriorityQueue&lt;Vertex&gt; vertexQueue = new PriorityQueue&lt;Vertex&gt;(); vertexQueue.add(source); while (!vertexQueue.isEmpty()) { Vertex u = vertexQueue.poll(); // Visit each edge exiting u for (Edge e : u.adjacencies) { Vertex v = e.target; double weight = e.weight; double distanceThroughU = u.minDistance + weight; if (distanceThroughU &lt; v.minDistance) { vertexQueue.remove(v); v.minDistance = distanceThroughU ; v.previous = u; vertexQueue.add(v); } } } } public static List&lt;Vertex&gt; getShortestPathTo(Vertex target) { List&lt;Vertex&gt; path = new ArrayList&lt;Vertex&gt;(); for (Vertex vertex = target; vertex != null; vertex = vertex.previous) path.add(vertex); Collections.reverse(path); return path; } public static void main(String[] args) { // mark all the vertices Vertex A = new Vertex("A"); Vertex B = new Vertex("B"); Vertex D = new Vertex("D"); Vertex F = new Vertex("F"); Vertex K = new Vertex("K"); Vertex J = new Vertex("J"); Vertex M = new Vertex("M"); Vertex O = new Vertex("O"); Vertex P = new Vertex("P"); Vertex R = new Vertex("R"); Vertex Z …
has answer: http://stackoverflow.com/a/27454193

http://stackoverflow.com/a/27343142
answers question: http://stackoverflow.com/q/27343089
downvote count: 0
type: Answer
upvote count: 1
score: 1
has body: The table name is an identifier. Identifiers do not use single quotes (in standard SQL). "CREATE TABLE '"+tableName+"' " Will result in CREATE TABLE 'foobar' which is invalid SQL. You need to remove the single quotes: "CREATE TABLE "+tableName+" " + ... As the table name is apparently a user input, you might actually want to use quoted identifiers (although this is in general a bad idea). Identifiers are quoted using double quotes in the SQL standard: "CREATE TABLE \""+tableName+"\" " + ...

http://stackoverflow.com/a/27423546
answers question: http://stackoverflow.com/q/27422064
downvote count: 0
type: Answer
score: 3
upvote count: 3
has body: This is might be due to encryption enabled on your database file or directory containing it. Use: NSFileManager's setAttributes:ofItemAtPath:error: with NSFileProtectionNone

android-imageview
tags question: http://stackoverflow.com/q/27338901
type: Tag
tags question: http://stackoverflow.com/q/27459242
tags question: http://stackoverflow.com/q/27458447
tags question: http://stackoverflow.com/q/27457930
tag name: android-imageview

http://stackoverflow.com/q/27364857
downvote count: 0
tagged with: jar
score: 1
has answer: http://stackoverflow.com/a/27364909
favorite count: 0
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/27364909
upvote count: 1
answer count: 1
has title: exporting jar with eclipse not saving changes?
tagged with: java
has comment: http://stackoverflow.com/comment/43181550
tagged with: eclipse
has body: I'm editing the source project for a plugin called socialAuth. After making some changes I saved and tried to export the project to a jar. It completed without errors but a few warnings. However when taking a look at the class files I noticed my changes were not there! I checked the box for source files when exporting, so I'm not sure why the changes aren't going through. The project does not have a manifest but a pom file. I'm not quite sure what info I should provide, so let me know if you need it. Any ideas?
type: AnsweredQuestion

http://stackoverflow.com/comment/43274131
has text: @JLONG Yes, I try it. It does set the Wallpaper, but its not the image on the viewPager, its the image before or After.
comment on: http://stackoverflow.com/q/27414798
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27453308
has body: I pick up some ideas and provide an abstractable solution: class A { protected A() { // ... } protected void init() { // ... } public static &lt;T extends A&gt; T create(Class&lt;T&gt; type) { try { T obj = type.newInstance(); obj.init(); return obj; } catch (ReflectiveOperationException ex) { System.err.println("No default constructor available."); assert false; return null; } } }
answers question: http://stackoverflow.com/q/27453105
has comment: http://stackoverflow.com/comment/43345828
upvote count: 1
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/27356283
linked to: http://stackoverflow.com/q/4865165
answer count: 1
tagged with: proxy
score: 0
has body: I am working on a client which will request web service(hosted on internet) which requires NTLM authentication. Also the host machine on which my client is installed is behind proxy, first the request should authenticate proxy server and then request would go the web service and do NTLM authentication. I am able to do NTLM authentication via the help on NTLM authentication I have generated the stubs via wsimport by first saving wsdl file to local file because through URL I was not able to connect(because I dont know how to set proxy in command line call to wsimport). I have not used any frameworks like axis2 or cxf. I am using Java 1.7 When I deploy the client on non-proxy machine(direct internet), then it works but not when behind proxy. Please help.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27377148
tagged with: web-services
type: Question
has title: Webservice Client behind proxy and service needs NTLM authentication
tagged with: java
has comment: http://stackoverflow.com/comment/43276842

http://stackoverflow.com/q/27391668
has body: Here is my code: public class TipCalculator extends Activity implements RadioGroup.OnCheckedChangeListener { EditText ba= null; TextView ta= null; TextView td= null; RadioButton t10= null; RadioButton t15= null; RadioButton t20= null; RadioGroup rg= null; DecimalFormat df=new DecimalFormat("$####.00"); @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_tip_calculator); ba=(EditText)findViewById(R.id.bill_amount); ta=(TextView)findViewById(R.id.tip_amount); td=(EditText)findViewById(R.id.Total_Dollars); t10=(RadioButton)findViewById(R.id.ten); t15=(RadioButton)findViewById(R.id.fifteen); t20=(RadioButton)findViewById(R.id.twenty); rg=(RadioGroup)findViewById(R.id.tip_choices); rg.setOnCheckedChangeListener(this); } public void onCheckedChanged(RadioGroup rg, int i) { if(i==t10.getId()) ta.setText(df.format(Double.parseDouble(ba.getText().toString())*.10)); if(i==t15.getId()) ta.setText(df.format(Double.parseDouble(ba.getText().toString())*.15)); if(i==t20.getId()) ta.setText(df.format(Double.parseDouble(ba.getText().toString())*.20)); if(i==t10.getId()) td.setText(( ba.getText().toString()+(ta.getText().toString()))); if(i==t15.getId()) td.setText("$"); if(i==t20.getId()) td.setText ( df.format(Double.parseDouble(ta.getText().toString()) + Double.parseDouble(ba.getText().toString()))); } } The part of the code that I'm getting my errors from is in the very last part. I am trying to set variable "td" to equal the two variables "ta" and "ba" but I either get an error or it concatenates the values of the variables instead please help! thanks in advance!
type: Question
answer count: 1
favorite count: 0
downvote count: 1
has answer: http://stackoverflow.com/a/27391746
tagged with: integer
upvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43230977
has title: How to set text to integer that equals two different variables added together
tagged with: java
score: -1

http://stackoverflow.com/comment/43385734
type: Comment
comment on: http://stackoverflow.com/a/27371178
has text: i created folders `drawable-xxxhdpi` , `drawable-xxhdpi`, `drawable-xhdpi`, and the rest, and i used a software called `9Patch resizer` to change my `mdpi (default pictures to xxxhdpi)` , the red `BUTTONS` resized fine, but in the board activity the board (it's an image) resized fine but it still stretched when i run in on my `xxxhdpi` phone like in the picture... i am trying your code now , i dont know what did you mean by `ADJUST ME` at the first LinearLayout, but i will try removing that two attributes..
score: 0
type: AnswerComment

http://stackoverflow.com/q/27449357
type: UnansweredQuestion
tagged with: logging
score: 2
answer count: 0
upvote count: 2
tagged with: java
type: Question
has body: I'm using SLF4J 1.7.7 and the log4j 1.7.7 binding. In a particular instance, I am forced to provide the log4j configurations in the code (so no log4j.properties). I need to create ConsoleAppender and FileAppender instances and add to the RootLogger's appender list. I was hoping to use something like the below Map&lt;String, String&gt; env = System.getenv(); String logTarget = env.get("WP_LOGTARGET"); if(logTarget != null) { if(logTarget .equalsIgnoreCase("file")) { FileAppender fa = new FileAppender(); logger.rootLogger().addAppender(fa); } else if(logTarget .equalsIgnoreCase("console")) { ConsoleAppender console = new ConsoleAppender(); //create appender logger.rootLogger().addAppender(console); } else { // default to System.out.println } } else { // default to System.out.println } Unfortunately, the below won't work because these Logger instances are in the SLF4j Package. logger.rootLogger().addAppender(fa); logger.rootLogger().addAppender(console); If I skip the SLF4J Logger classes and go with log4j implementations, ofcourse, it works like a charm. Any ideas?
downvote count: 0
favorite count: 0
has title: Using log4j appenders to a org.slf4j.Logger

http://stackoverflow.com/comment/43233584
comment on: http://stackoverflow.com/a/27393061
score: 0
type: AnswerComment
has text: *"Should I just create a separate JPanel.."* Yes! Nest layouts inside one another for complex layout needs.
type: Comment

http://stackoverflow.com/a/27437541
has body: Say you have the following values: int max; int min; If you want to get a new random number between max and min, you need to understand how the Random class works. nextInt(int n) returns a number that is greater than or equal than zero, and less than(but not equal to) n. Therefore, if you want to get a number between max and min, inclusive of both, you would have to do the following: Random r = new Random(); int randomNumber=r.nextInt(max-min+1)+min;
type: Answer
answers question: http://stackoverflow.com/q/27437474
score: 0

http://stackoverflow.com/comment/43217215
type: Comment
has text: What would i do if my array can be no larger than 25?
comment on: http://stackoverflow.com/a/27381132
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43441483
score: 0
comment on: http://stackoverflow.com/q/27330664
has text: but how are you sending the data to the database? Somewhere before reaching the table there *is* a conversion to ASCII, that's what causes the problem. Either `getText` returns ASCII (doubt it), your database statement is ASCII or the database driver sends the statement as ASCII. Please post the code you use to insert the data. You can also try using SQL Profiler to see what is actually sent to the server, debug your application to see what are the values of strings at each step.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27341678
accepted answer of: http://stackoverflow.com/q/27341649
type: Answer
answers question: http://stackoverflow.com/q/27341649
has comment: http://stackoverflow.com/comment/43139065
has body: Go to file->export->runnable jar and select the class which contains the main method. Setting .JAR File Association Normally, the installation program for the Java 2 Runtime Environment will register a default file association so that .JAR files will execute with 'JAVAW -JAR' by double-clicking any .JAR file. If this does not happen, or it somehow gets changed, then manually setting the association for *.JAR files may be needed. Open the Windows Explorer, from the Tools select 'Folder Options...' Click the File Types tab, scroll down and select JAR File type. Press the Advanced button. In the Edit File Type dialog box, select open in Actions box and click Edit... Press the Browse button and navigate to the location the Java interpreter javaw.exe. In the Application used to perform action field, needs to display something similar to "C:\Program Files\Java\j2re1.4.2_04\bin\javaw.exe" -jar "%1" %* then press the OK buttons until all the dialogs are closed. Now you should be able to launch any *.JAR program by double-clicking it. This step by step guid was taken from: http://windowstipoftheday.blogspot.com/2005/10/setting-jar-file-association.html
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43139158
score: 0
has comment: http://stackoverflow.com/comment/43139058

http://stackoverflow.com/comment/43306277
score: 0
type: Comment
has text: OP, don't be afraid of the word "Thread" here. This is how you make a simple method wait one second. Just copy-paste.
type: AnswerComment
comment on: http://stackoverflow.com/a/27432483

http://stackoverflow.com/q/27473990
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27474036
has body: I'm trying to use elements of Google's Crawler Commons package to help with my own project in Eclipse but I'm having difficulties getting it to work due to missing dependencies. I'm new to Maven so I'm having some trouble understanding where I'm going wrong. Here are the steps I've gone through so far: So after downloading the files here, I added the crawler-commons-0.5.jar to my Eclipse project build path. When trying to use any of the classes, such as RobotUtils for example, the following error is raised: Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory at crawlercommons.robots.RobotUtils.(RobotUtils.java:36) at Main.Main.main(Main.java:8) Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory at java.net.URLClassLoader$1.run(URLClassLoader.java:372) 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) ... 2 more So I downloaded the pom.xml for this project from here and dropped it into the root folder of where the Google Crawler Commons .jar is. I use the command mvn on it and it downloads some stuff and returns successfully. However, all it does is give me an additional folder called target with a couple of .jar files that have the correct name, but don't actually contain any of the classes I need. So am I missing something here? How do I get mvn to grab the org.slf4j.LoggerFactory code I need here?
tagged with: maven
type: AnsweredQuestion
has title: Adding third party code to an eclipse project with depedencies using maven?
has answer: http://stackoverflow.com/a/27474036
score: 1
tagged with: java
upvote count: 1
tagged with: eclipse
type: Question
downvote count: 0

http://stackoverflow.com/comment/43122021
has text: just edited the post with the solution. Thanks Rudi!
comment on: http://stackoverflow.com/a/27331887
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43162355
score: 0
has text: So I use Nexus 7 device with Android 5.0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27354703

http://stackoverflow.com/q/27411543
tagged with: transactions
score: 0
tagged with: java
answer count: 1
tagged with: autocommit
tagged with: hibernate
has title: Why aren't my transactions getting commited?
has answer: http://stackoverflow.com/a/27411605
type: AnsweredQuestion
type: Question
has body: When I set defaultAutoCommit to false my transactions don't get saved to the database. Does anybody know why my data isn't getting saved to the database? I am using @transactional on my methods it appears that the transactions are being committed because the status is 3 Transaction status https://docs.jboss.org/jbossas/javadoc/4.0.2/javax/transaction/Status.java.html This is the transaction log 2014-12-10 14:39:07,132 TRACE [http-apr-8080-exec-2] CacheSynchronization - transaction before completion callback 2014-12-10 14:39:07,132 TRACE [http-apr-8080-exec-2] CacheSynchronization - transaction after completion callback, status: 3 <aop:aspectj-autoproxy/> <context:annotation-config/> <context:component-scan base-package="package.dao" scoped-proxy="interfaces"/> <tx:annotation-driven transaction-manager="transactionManager"/> <context:property-placeholder location="classpath:prop-dao.properties"/> <entry key="hibernate.transaction.manager_lookup_class" value="com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup"/> <entry key="hibernate.connection.release_mode" value="on_close"/> EDIT: I tried committing manually at the end of my method but the data still wasn't saved
accepted answer: http://stackoverflow.com/a/27411605
tagged with: spring

http://stackoverflow.com/q/27467095
tagged with: jar
downvote count: 0
has title: How to use Stanford Core NLP in an eclipse plugin?
tagged with: eclipse-plugin
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
has body: I want to use Stanford Core NLP in an eclipse plugin project. There are a number of jar files which need to be included to use this NLP package. One way to use them is to include the jar files as an eclipse plugin. However, only those jar files can be used which have OSGi metadata in their MANIFEST-MF file. The next was to include jar files in the plugin itself. However, this method fails to detect the jar files. Any ideas on how to solve this problem?
score: 1
tagged with: java
tagged with: eclipse
type: Question
tagged with: stanford-nlp

http://stackoverflow.com/comment/43368277
type: Comment
has text: could you show me how? like I said im a beginner.But I will need to be able to retrieve/delete/edit character later--does an array just dump bunch of data in it? cause If it does I wont be able to retrieve a specific element?
type: QuestionComment
comment on: http://stackoverflow.com/q/27466147
score: 0

http://stackoverflow.com/comment/43389132
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27471816
has text: @Ulsting You can improve upon this by adding a static position evaluator, i.e. a method that says how good is a position without actually playing it out to completion. This is the trickiest part of any non-trivial AI, though.
score: 0

http://stackoverflow.com/a/27461651
upvote count: 4
accepted answer of: http://stackoverflow.com/q/27461552
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Use AlarmManager to schedule to get control at those points in time.
answers question: http://stackoverflow.com/q/27461552
score: 4

http://stackoverflow.com/comment/43160495
comment on: http://stackoverflow.com/q/27347379
has text: I don't know if it's possible with URLConnection. You might have to use an alternative HTTP client.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27454146
has body: It turns out Java does not accept a bare Date value as DateTime. Using LocalDate instead of LocalDateTime solves the issue: DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); LocalDate dt = LocalDate.parse("20140218", formatter);
has comment: http://stackoverflow.com/comment/116035106
score: 273
downvote count: 2
has comment: http://stackoverflow.com/comment/116035319
answers question: http://stackoverflow.com/q/27454025
upvote count: 275
has comment: http://stackoverflow.com/comment/124243828
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27454025
has comment: http://stackoverflow.com/comment/118546622
type: Answer
has comment: http://stackoverflow.com/comment/126367603
has comment: http://stackoverflow.com/comment/59941526

http://stackoverflow.com/comment/43318350
comment on: http://stackoverflow.com/a/27439242
type: AnswerComment
has text: I am having JPA1.0 it does not supports LockModeType.PESSIMISTIC_WRITE
score: 0
type: Comment

http://stackoverflow.com/comment/43265416
comment on: http://stackoverflow.com/q/27410318
type: Comment
has text: Welcome to Stack Overflow! As a new user, it is a good idea to read the "help / site tour" page. I hope you find the answer you are looking for!
type: QuestionComment
score: 0

http://stackoverflow.com/q/27329122
type: Question
tagged with: java-native-interface
score: 0
tagged with: netbeans
answer count: 0
type: UnansweredQuestion
has body: I have written the sample c++ code and created shared library for this c++ code. Now i am trying to call SO file insight jni of qtcreator. I got this: "/usr/lib/jvm/java-7-openjdk-amd64/bin/java: symbol lookup error: /usr/local/lib/libjni.so.1.0.0: undefined symbol: helloworld" Steps I followed: Created helloworld.so using netbeans. Created JNI code using qtcreator. helloworld function is placed insight jni code(Qtcreator). Now try to call jni code using eclise(java) I loaded helloworld.so(netbeans) and jni.so(qtcreator) insight usr/local/lib folder. I got response from jni code using eclipse(java),But helloworld.so(Helloworld function) did not call insight jni code.I got above error. How to solve above error? How to call c++ so insite jni code?
tagged with: qt-creator
tagged with: c++
has title: How to Solve undefined symbol error in JNI QTcreator.?
tagged with: java
has comment: http://stackoverflow.com/comment/43284222
has comment: http://stackoverflow.com/comment/43253714

http://stackoverflow.com/q/27353664
has answer: http://stackoverflow.com/a/27353932
accepted answer: http://stackoverflow.com/a/27353932
has answer: http://stackoverflow.com/a/27373484
favorite count: 0
has answer: http://stackoverflow.com/a/27353846
answer count: 5
has body: I am new to JSON..Am using HTTPUrlConnections and getting some response in JAVA program.The response data will be like, { "data": [ { "id": 1, "userId": 1, "name": "ABC", "modified": "2014-12-04", "created": "2014-12-04", "items": [ { "email": "abc@gmail.com", "links": [ { . . . . } ] } ] } ] } From this response am able to get the value of "name" field with the below java code. JSONArray items = newObj.getJSONArray("data"); for (int it=0 ; it &lt; items.length() ; it++){ JSONObject contactItem = items.getJSONObject(it); String userName = contactItem.getString("name"); System.out.println("Name----------"+userName); } But my requirement is,I need to get the value of "email" ..How should I code for that.. Any advice.. Thanks in advance.. Chitra
has comment: http://stackoverflow.com/comment/43161339
has title: Traverse JSON data in JAVA
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: 6
has answer: http://stackoverflow.com/a/27354041
type: Question
has answer: http://stackoverflow.com/a/27353895
possible better answer: http://stackoverflow.com/a/27353846
upvote count: 6

http://stackoverflow.com/comment/43360747
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27458401
type: Comment
has text: Thanks for the great Answer.That explains a lot "The JVM is not designed to limit virtual memory allocation".

http://stackoverflow.com/comment/43172022
comment on: http://stackoverflow.com/q/27359953
score: 0
has text: When you debug this, which object is `null`? Where do you think that object is getting a value?
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43312270
comment on: http://stackoverflow.com/a/27435660
type: AnswerComment
type: Comment
has text: I saw he was using using long division, so I figured that's what he wanted. You could use both as well: BigInteger for factorial, and BigDecimal for combinations. Extra credit for one that uses long, detects overflow, and upgrades when necessary
score: 1

windows
tags question: http://stackoverflow.com/q/27382032
tags question: http://stackoverflow.com/q/27360047
tags question: http://stackoverflow.com/q/27337641
tags question: http://stackoverflow.com/q/27401673
tags question: http://stackoverflow.com/q/27321862
tags question: http://stackoverflow.com/q/27403758
tags question: http://stackoverflow.com/q/27366947
tags question: http://stackoverflow.com/q/27418068
tags question: http://stackoverflow.com/q/27426602
tags question: http://stackoverflow.com/q/27466807
tags question: http://stackoverflow.com/q/27353784
tags question: http://stackoverflow.com/q/27429845
type: Tag
tags question: http://stackoverflow.com/q/27404471
tags question: http://stackoverflow.com/q/27455315
tags question: http://stackoverflow.com/q/27347144
tags question: http://stackoverflow.com/q/27369775
tags question: http://stackoverflow.com/q/27351265
tags question: http://stackoverflow.com/q/27435857
tag name: windows
tags question: http://stackoverflow.com/q/27403272
tags question: http://stackoverflow.com/q/27420886

http://stackoverflow.com/q/27358851
type: Question
tagged with: android-contentprovider
has body: I have app which should have 2 flavours: free and paid. Separately both versions works perfectly. But when I want to install 2 of them at once I'm getting error: [INSTALL_FAILED_CONFLICTING_PROVIDER]. I've tried to change android:authorities and buildConfigField values to be totally different but It's doesn't change anything - app won't install. Also I've deleted provider declaration in main Android Manifest - nothing. Please help me. My folders structure: src |- free | |- AndroidManifest.xml |- main | |- all files and res catalogues (java, res, values etc.) | |- AndroidManifest.xml |- premium |- AndroidManifest.cml My gradle file: apply plugin: 'com.android.application' android { compileSdkVersion 19 buildToolsVersion '20.0.0' final PROVIDER_FREE = "com.example.free.contentprovider" final PROVIDER_PRO = "com.example.pro.contentprovider" defaultConfig { minSdkVersion 14 targetSdkVersion 20 } buildTypes { release { minifyEnabled false // new version proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } productFlavors { free { applicationId "com.example.free" versionCode 141201004 versionName "1.004" buildConfigField "String", "PROVIDER_AUTHORITY", "\"" + PROVIDER_FREE + "\"" } premium { applicationId "com.example.pro" versionCode 141210001 versionName "0.001 Pro" buildConfigField "String", "PROVIDER_AUTHORITY", "\"" + PROVIDER_PRO + "\"" } } } My content provider: public class DatabaseContentProvider extends ContentProvider { public static final String AUTHORITY = BuildConfig.PROVIDER_AUTHORITY; ... } My free Android Manifest: &lt;provider android:name="com.example.tools.DatabaseContentProvider" android:authorities="com.example.free.contentprovider" android:exported="false" android:grantUriPermissions="true"&gt; &lt;grant-uri-permission android:pathPattern=".*" /&gt; &lt;/provider&gt; My premium Android Manifest: &lt;provider android:name="com.example.tools.DatabaseContentProvider" android:authorities="com.example.pro.contentprovider"…
linked to: http://stackoverflow.com/q/16777534
score: 12
favorite count: 0
has comment: http://stackoverflow.com/comment/52043747
type: UnansweredQuestion
tagged with: android
tagged with: android-productflavors
has comment: http://stackoverflow.com/comment/43910590
upvote count: 12
has title: Android Content Provider and Gradle productFlavours
answer count: 0
downvote count: 0
tagged with: java
tagged with: gradle

http://stackoverflow.com/comment/43147985
type: Comment
score: 2
comment on: http://stackoverflow.com/q/27346418
has text: Be more specific. What exactly are you having trouble understanding?
type: QuestionComment

http://stackoverflow.com/q/27385328
has body: For a Java program I'm writing, I have a particular need to sort strings lexicographically by Unicode code point. This is not the same as String.compareTo() when you start dealing with values outside the Basic Multilingual Plane. String.compareTo() compares strings lexicographically on 16-bit char values. To see that this is not equivalent, note that U+FD00 ARABIC LIGATURE HAH WITH YEH ISOLATED FORM is less than U+1D11E MUSICAL SYMBOL G CLEF, but the Java String object "\uFD00" for the Arabic character compares greater than the surrogate pair "\uD834\uDD1E" for the clef. I can manually loop along the code points using String.codePointAt() and Character.charCount() and do the comparison myself if necessary. Is there an API function or other more "canonical" way of doing this?
type: UnansweredQuestion
has title: What is the preferred way to compare two Java Strings lexicographically on *Unicode code points*?
score: 16
upvote count: 16
has comment: http://stackoverflow.com/comment/52430819
has comment: http://stackoverflow.com/comment/43219519
tagged with: java
has comment: http://stackoverflow.com/comment/43219238
has comment: http://stackoverflow.com/comment/51916601
type: Question
linked to: http://stackoverflow.com/q/1527856
answer count: 1
downvote count: 0
tagged with: string
tagged with: unicode
favorite count: 0
has comment: http://stackoverflow.com/comment/43219049
has comment: http://stackoverflow.com/comment/43219283
has answer: http://stackoverflow.com/a/32347014
has comment: http://stackoverflow.com/comment/43219449

http://stackoverflow.com/comment/43285068
has text: java -version does not necessarily point to the same JRE as the one configured in the `netbeans.conf` file. What is the `netbeans_jdkhome` property in that file?
score: 1
comment on: http://stackoverflow.com/q/27421157
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27325075
has body: I want to add the new button with an icon of a question mark to the left of buttons "maximize", "hide" and "close". how to make it (like in a pic)?
tagged with: titlebar
type: Question
score: 5
has title: Swing: Add help [?] button to window titlebar
upvote count: 6
has answer: http://stackoverflow.com/a/46560792
answer count: 2
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/43109397
has comment: http://stackoverflow.com/comment/43110860
tagged with: java
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/46562689
linked to: http://stackoverflow.com/q/2781987
favorite count: 0

http://stackoverflow.com/q/27404431
tagged with: java
has body: My code calculates the starting position of the intervall correctly but not the end position: int left; int bot = 0; int top = textLength; while(bot != top) { int mid = (bot+top)/2; if(pattern.compareTo(text.substring(suffixArray.get(mid))) &gt; 0) bot = mid + 1; else top = mid; } left = bot; int right; bot = left; top = textLength; while(bot != top) { int mid = (bot+top)/2; if(pattern.compareTo(text.substring(suffixArray.get(mid))) &lt; 0) top = mid; else bot = mid+1; } right = bot; I compared it to several pseudo codes on the internet and I don't really see why it's not working. What am I missing?
has comment: http://stackoverflow.com/comment/43259048
tagged with: suffix-array
type: Question
has answer: http://stackoverflow.com/a/27405161
tagged with: binary-search
score: 0
answer count: 1
has title: Binary search on suffix array
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43259139
has comment: http://stackoverflow.com/comment/43254323
has comment: http://stackoverflow.com/comment/43259342

http://stackoverflow.com/comment/43255706
type: Comment
has text: write `byteArray64DecodePdf` to a FileOutputStream to check the contents outside of your program.
score: 0
comment on: http://stackoverflow.com/q/27405071
type: QuestionComment

http://stackoverflow.com/comment/43156114
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27350590
type: AnswerComment
has text: @bewgs this makes sense - I'll try it out as soon as possible and choose this answer if all goes well. Thanks

thread-safety
tags question: http://stackoverflow.com/q/27335467
tags question: http://stackoverflow.com/q/27355932
tags question: http://stackoverflow.com/q/27442402
tags question: http://stackoverflow.com/q/27361353
tags question: http://stackoverflow.com/q/27438591
tag name: thread-safety
tags question: http://stackoverflow.com/q/27440599
tags question: http://stackoverflow.com/q/27463919
type: Tag

http://stackoverflow.com/comment/43376375
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27470396
has text: I moved it to that location. There is no change. No image, but showing the buttons. This way does seem like it would have more control. If I get it to work of course lol
type: AnswerComment

http://stackoverflow.com/a/27386334
answers question: http://stackoverflow.com/q/27371783
downvote count: 0
has body: The problem is that you are confusing Parent_Key with Key. This line: Entity someChild = new Entity(CHILD_KIND, someKey); Creates an Entity of the kind "CHILD_KIND" with parent entity of key "someKey". See this document for details [1]. When you do a simple datastore.get(key), you are using the Entity's own key, not the parent key. So what you need to do is use KeyFactory to get the Entity Key from its Parent Key, Kind, Name. The details can be found here [2] and here [3]. [1] - https://cloud.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/Entity [2] - https://cloud.google.com/appengine/docs/java/datastore/entities#Java_Retrieving_an_entity [3] - https://cloud.google.com/appengine/docs/java/javadoc/com/google/appengine/api/datastore/KeyFactory
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27371783
score: 1
upvote count: 1

http://stackoverflow.com/q/27325526
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43110269
answer count: 1
has answer: http://stackoverflow.com/a/27325637
has body: I have two JFrame, A and B. A is the main JFrame, B is secondary and is invoked via a button. Now I wish to call B, A is no longer clickable until the end of operations with B (B must remain above A until the end). How should I do?
score: 0
type: UnansweredQuestion
has title: Two JFrame (A, B)

http://stackoverflow.com/a/27380689
score: 0
type: Answer
has body: Like @Darshan Lila said, String test="NAI-PO-0009-1"; test=test.substring(0, test.length()-2); System.out.println(test); works for removing last two characters. If instead also need to remove the last special char and everything behind, you will have to use: String test="NAI-PO-0009-1"; test=test.substring(0, test.lastIndexOf("-") -1); /*explain: second parameter of SubString() method is for the length of the resulting string, on a zero-based index, it has to end the last char before the last dash*/ System.out.println(test); Hope it helps.
has comment: http://stackoverflow.com/comment/43211426
answers question: http://stackoverflow.com/q/27380468

http://stackoverflow.com/q/27387770
type: Question
has comment: http://stackoverflow.com/comment/43225840
has comment: http://stackoverflow.com/comment/43225928
has comment: http://stackoverflow.com/comment/43226090
tagged with: php
has answer: http://stackoverflow.com/a/27389045
has comment: http://stackoverflow.com/comment/43223655
tagged with: mysql
upvote count: 1
answer count: 1
has title: How to get response in string format after call URL in browser in php
has body: I have used below php code to insert the data into table...but i need response 1 after successfully insert and 0 for failed insert...or any msg like 'your msg has been successfully inserted'.. &lt;?php $myname=$_GET["name"]; $mycity=$_GET["city"]; $myname=urlencode($myname); $mycity=urlencode($mycity); $con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD) or die("Failed to connect to MySQL: " . mysql_error()); $db=mysql_select_db(DB_NAME,$con) or die("Failed to connect to MySQL: " . mysql_error()); $sql="insert into tbl_sazal(name,city) values ('$myname','$mycity') "; $result=mysql_query($sql); if($result){ echo "1"; } else{ echo "0"; } ?&gt; also for reference i m calling below url http://localhost/testurl/test1.php?name=akash&amp;city=ngong Thanks....
has comment: http://stackoverflow.com/comment/43223493
tagged with: java
accepted answer: http://stackoverflow.com/a/27389045
has comment: http://stackoverflow.com/comment/43225039
has comment: http://stackoverflow.com/comment/43226190
has comment: http://stackoverflow.com/comment/43223567
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43226099
has comment: http://stackoverflow.com/comment/43225714
has comment: http://stackoverflow.com/comment/43224519
downvote count: 0
score: 1
favorite count: 0

http://stackoverflow.com/comment/43269182
score: 0
comment on: http://stackoverflow.com/q/27411148
type: Comment
type: QuestionComment
has text: I checked entity field names and didnt find any errors. HTTP request has attribute Accept:application/json in header. I use IDEA REST plugin to send requests on REST services.

http://stackoverflow.com/a/27436629
has comment: http://stackoverflow.com/comment/43314376
has comment: http://stackoverflow.com/comment/43314414
type: Answer
accepted answer of: http://stackoverflow.com/q/27436592
has comment: http://stackoverflow.com/comment/43314102
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/43314229
has comment: http://stackoverflow.com/comment/43314412
has comment: http://stackoverflow.com/comment/43314342
type: AcceptedAnswer
downvote count: 0
has body: You'd need to make your class generic. public abstract class Module&lt;P extends Port&gt; { protected Map&lt;String, P&gt; ports; public Map&lt;String, P&gt; getPorts() { return ports; } } class Design extends Module&lt;TopPort&gt; { } I'm not sure if this isn't overkill here, though.
answers question: http://stackoverflow.com/q/27436592

http://stackoverflow.com/q/27393962
answer count: 2
has body: I've been trying to fix "connection reset" problem in a simple java server-client program for a while. My scenario is like this client program will take filename as input, then send it to server program. Server will check if that file exists in the directory. If exist then server will print "ok", otherwise "file not found" I'm getting this execption java.net.SocketException: Connection reset Server program package tcpserver; import java.net.*; import java.io.*; public class TCPServer { ServerSocket serversocket; Socket socket; BufferedReader buffread, buffout; String filename; String strDir = "D:\"; private void findFile(String name) { File fileObj = new File(strDir); File[] fileList = fileObj.listFiles(); if (fileList != null) { for (File indexFile : fileList) { if (name.equalsIgnoreCase(indexFile.getName())) { System.out.println("200 ok "); } else { System.out.println("File Not found"); } } } } public TCPServer() { try { //creating server object serversocket = new ServerSocket(6666); socket = serversocket.accept(); //get input stream through the socket object from buffer buffread = new BufferedReader(new InputStreamReader(socket.getInputStream())); filename = buffread.readLine(); findFile(filename); } catch (IOException ex) { //System.err.println(ex); ex.printStackTrace(); } } public static void main(String[] args) { TCPServer serverObject = new TCPServer(); } } Client program package tcpclient; import java.net.*; import java.io.*; public class TCPClient { BufferedReader bffread, bffinput; String fileInput; public TCPClient() { try { //Creating socket Socket socket = new Socket("localhost", 6666); System.out.println("Enter filename"); bffinput = new BufferedReader(new InputStreamReader(System.in)); OutputStream outputObject = socket.getOutputStream(); } catch (Exception ex) { System.out.println("Unhandled exception caught"); } } public static void main(String[] args) { TCPClient clientObject = new TCPClient(); } } Exception stack java.net.SocketException: Connecti…
has comment: http://stackoverflow.com/comment/43235169
has comment: http://stackoverflow.com/comment/43235297
possible better answer: http://stackoverflow.com/a/27394081
has comment: http://stackoverflow.com/comment/43236177
score: 0
has title: Java server connection reset
tagged with: sockets
accepted answer: http://stackoverflow.com/a/27394184
has comment: http://stackoverflow.com/comment/43235124
has comment: http://stackoverflow.com/comment/43235122
has comment: http://stackoverflow.com/comment/43235227
has answer: http://stackoverflow.com/a/27394081
has answer: http://stackoverflow.com/a/27394184
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/43141498
comment on: http://stackoverflow.com/a/27342755
type: Comment
has text: In Book table there are book names and in Borrower table there are book id s that are wanted. I want to reach ISBN s so to book names with using Book id in Borrower table. Now I can only show bookid in borrowers screen.
score: 1
type: AnswerComment

http://stackoverflow.com/q/27450438
has comment: http://stackoverflow.com/comment/43339759
tagged with: web-scraping
has comment: http://stackoverflow.com/comment/43339857
has comment: http://stackoverflow.com/comment/43339790
has answer: http://stackoverflow.com/a/27450681
tagged with: java
has title: Checking if defined and has a Value
has body: I have some javascript which uses jsoup to extract info from a webform. All works great if the textarea Element is found on the page. But if it cant find it throws an error " Variable ASRRMK is undefined." asrRmk = asrRmk.select("textarea[name=asr_remarks]").first(); if (asrRmk != null &amp;&amp; asrRmk != undefined) { asrRmk = asrRmk.html() data = { name="asr_remarks" , value=asrRmk , type="textarea" }; so what I am trying to do is check if asrRmk is actually defined and has a value, if it is defined, I want to append it to my array, otherwise I will leave it of.
has comment: http://stackoverflow.com/comment/43343741
type: Question
tagged with: jsoup
has comment: http://stackoverflow.com/comment/43343775
tagged with: javascript
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43341031
type: UnansweredQuestion

jackson
tags question: http://stackoverflow.com/q/27346823
tags question: http://stackoverflow.com/q/27384296
tags question: http://stackoverflow.com/q/27403903
tags question: http://stackoverflow.com/q/27333959
tags question: http://stackoverflow.com/q/27471426
tags question: http://stackoverflow.com/q/27384859
tags question: http://stackoverflow.com/q/27314742
tags question: http://stackoverflow.com/q/27330136
tags question: http://stackoverflow.com/q/27351698
tags question: http://stackoverflow.com/q/27409808
tags question: http://stackoverflow.com/q/27433931
tags question: http://stackoverflow.com/q/27460699
tags question: http://stackoverflow.com/q/27397419
tags question: http://stackoverflow.com/q/27341653
type: Tag
tags question: http://stackoverflow.com/q/27364271
tags question: http://stackoverflow.com/q/27334647
tags question: http://stackoverflow.com/q/27412889
tags question: http://stackoverflow.com/q/27412682
tags question: http://stackoverflow.com/q/27369842
tags question: http://stackoverflow.com/q/27446496
tags question: http://stackoverflow.com/q/27316485
tags question: http://stackoverflow.com/q/27449365
tags question: http://stackoverflow.com/q/27441208
tags question: http://stackoverflow.com/q/27334528
tags question: http://stackoverflow.com/q/27417670
tag name: jackson
tags question: http://stackoverflow.com/q/27398578
tags question: http://stackoverflow.com/q/27347053
tags question: http://stackoverflow.com/q/27470651
tags question: http://stackoverflow.com/q/27402825
tags question: http://stackoverflow.com/q/27446065
tags question: http://stackoverflow.com/q/27348283
tags question: http://stackoverflow.com/q/27386883
tags question: http://stackoverflow.com/q/27358028
tags question: http://stackoverflow.com/q/27416408
tags question: http://stackoverflow.com/q/27449230
tags question: http://stackoverflow.com/q/27426327
tags question: http://stackoverflow.com/q/27380377
tags question: http://stackoverflow.com/q/27372898

http://stackoverflow.com/comment/43183137
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27365387
has text: Ok, I executed: openssl s_client -connect localhost:8443 -showcerts And the response was: CONNECTED(00000003) 140506026415944:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:766: --- no peer certificate available --- No client certificate CA names sent --- SSL handshake has read 7 bytes and written 263 bytes --- New, (NONE), Cipher is (NONE) Secure Renegotiation IS NOT supported Compression: NONE Expansion: NONE ---
score: 0

http://stackoverflow.com/comment/43228811
type: QuestionComment
has text: No, just the editor.
type: Comment
comment on: http://stackoverflow.com/q/27388538
score: 0

http://stackoverflow.com/a/27473449
answers question: http://stackoverflow.com/q/27473400
type: Answer
has comment: http://stackoverflow.com/comment/43382294
has comment: http://stackoverflow.com/comment/43381994
has body: Use a ServletContext method. E.g. getResourceAsStream(). Try the following code inside doGet(): ServletContext context = getServletContext(); InputStream inStream = context.getResourceAsStream("/META-INF/xyz.txt");
upvote count: 2
has comment: http://stackoverflow.com/comment/43381694
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43382300

http://stackoverflow.com/a/27370307
answers question: http://stackoverflow.com/q/27369904
type: Answer
has comment: http://stackoverflow.com/comment/43276139
has body: Are you sure it's a float? If you are trying to give it a hard number like 3.25 instead of a variable, 3.25 is actually a double, not a float. To give it an actual float, use 3.25f.
score: 0

http://stackoverflow.com/comment/43168629
has text: Christian you right. i didnt notice it.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27355976

http://stackoverflow.com/q/27331424
tagged with: multidimensional-array
possible better answer: http://stackoverflow.com/a/27331459
has answer: http://stackoverflow.com/a/27331459
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27331453
has body: My simple nested for loop isn't executing. This piece of code is located in a method. The method itself is executing and the code around it is executing but the nested loop isn't executing. I tried copying and pasting the code in a different area in the same method but it didn't work. I tried to create a different class unrelated to this project and pasting it there with neccessary adjustments and it didn't work. All other neccessary variables and number information is viewable in the code and the results provided. System.out.println("This is just to show that variables do have actual numbers in them." + "\n basePointy = " + basePointy + "\n basePointx = " + basePointx + "\n boardMatrix.length = " + boardMatrix.length + "\n boardMatrix[0].length = " + boardMatrix[0].length + "\n a[0][0] = " + a[0][0] + "\n a[5][5] = " + a[5][5] + "\n"); System.out.println("This is before the nested for loop"); //This is the problem area. for(int yaxisCounter = basePointy + 185; yaxisCounter &lt; boardMatrix.length; yaxisCounter++) { System.out.println("This is in the first part of the nested for loop"); for(int xaxisCounter = basePointx + 221; xaxisCounter &lt; boardMatrix[0].length; xaxisCounter++) { boardMatrix[yaxisCounter-basePointy-185][xaxisCounter-basePointx-221] = a[yaxisCounter][xaxisCounter]; System.out.println("This is in the second part of the nested for loop"); } } System.out.println("This is after the nested for loop"); This is the result I got after running the code. This is just to show that variables do have actual numbers in them. basePointy = 160 basePointx = 46 boardMatrix.length = 16 boardMatrix[0].length = 300 a[0][0] = -8345659 a[5][5] = -8412480 This is before the nested for loop This is after the nested for loop Notice that it doesn't printout "This is in the first part of the nested for loop." and "This is in the second part of the nested for loop." but prints/executes everything before and after the nested for loop. Thank you in advance for people that rea…
type: Question
tagged with: nested-loops
tagged with: java
has title: My nested for loop isn't executing and I don't know why
score: 0
has comment: http://stackoverflow.com/comment/43120630
answer count: 3
has comment: http://stackoverflow.com/comment/43120758
has answer: http://stackoverflow.com/a/27331453
has answer: http://stackoverflow.com/a/27331454

http://stackoverflow.com/comment/43324778
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27441412
type: Comment
has text: @Mikhail There's going to be only one instance (signleton), and if ep is static, there's only going to be one instance of it too. So, what doesn't make sence? As for the exec, in the actual case it doesn't exist. The producer is a BroacastReceiver in android, i don't need an executor, it's not a runnable.

http://stackoverflow.com/q/27363047
has comment: http://stackoverflow.com/comment/43178558
upvote count: 3
score: 0
downvote count: 3
answer count: 3
has title: Parse JSON in UNIX date in Java/Android without any library
has comment: http://stackoverflow.com/comment/43590716
has answer: http://stackoverflow.com/a/27363189
favorite count: 0
has comment: http://stackoverflow.com/comment/43215186
tagged with: android
accepted answer: http://stackoverflow.com/a/27365936
has body: I have a JSON array received from my server. I obtain a date as a timestamp String &ndash; for example, [{"date": "1418056895", ... }] &ndash; and I need to parse it in our day format. How do I do this? I have tried but I always have the year as 1970. Note: My JSON format is in UNIX. JSONObject feedObj = (JSONObject) feedArray.get(i); FeedItem item = new FeedItem(); item.setTimeStamp(feedObj.getString("date")); public void setTimeStamp(String timeStamp) { this.timeStamp = timeStamp; } public String getTimeStamp() { return timeStamp; } In another class, I parse the timestamp to display it: List&lt;FeedItem&gt; feedItems = ...; FeedItem item = feedItems.get(position); CharSequence timeAgo = DateUtils.getRelativeTimeSpanString( Long.parseLong(item.getTimeStamp()), System.currentTimeMillis(), DateUtils.SECOND_IN_MILLIS); However the displayed date is always in 1970. Using values such as 1403375851930 it appears to work as expected (it displays a contemporary date).
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43584647
has comment: http://stackoverflow.com/comment/43178495
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/43178352
has answer: http://stackoverflow.com/a/27365936
possible better answer: http://stackoverflow.com/a/27363189
has comment: http://stackoverflow.com/comment/43179873
has answer: http://stackoverflow.com/a/27363436
type: Question
linked to: http://stackoverflow.com/q/17432735
has comment: http://stackoverflow.com/comment/43602915
has comment: http://stackoverflow.com/comment/43178323
has comment: http://stackoverflow.com/comment/43178428
has comment: http://stackoverflow.com/comment/43178366
has comment: http://stackoverflow.com/comment/43178331

http://stackoverflow.com/comment/43364620
comment on: http://stackoverflow.com/q/27463630
score: 0
has text: @UriD.Charles Don't add information with comments , edit your post ... comments are for users to ask for more info
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27336643
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/27336651
favorite count: 0
has comment: http://stackoverflow.com/comment/52915196
has comment: http://stackoverflow.com/comment/43129985
type: UnansweredQuestion
downvote count: 8
score: -8
has answer: http://stackoverflow.com/a/27336752
has comment: http://stackoverflow.com/comment/43129994
has title: In java Adding up numbers
tagged with: java
type: Question
has body: I want to add up numbers. (java.numbers)

hadoop
tags question: http://stackoverflow.com/q/27418837
tags question: http://stackoverflow.com/q/27349743
tags question: http://stackoverflow.com/q/27424549
tags question: http://stackoverflow.com/q/27324569
tags question: http://stackoverflow.com/q/27344786
tags question: http://stackoverflow.com/q/27407964
tag name: hadoop
tags question: http://stackoverflow.com/q/27345261
tags question: http://stackoverflow.com/q/27417091
tags question: http://stackoverflow.com/q/27353418
type: Tag
tags question: http://stackoverflow.com/q/27419671
tags question: http://stackoverflow.com/q/27411950
tags question: http://stackoverflow.com/q/27313846
tags question: http://stackoverflow.com/q/27396881
tags question: http://stackoverflow.com/q/27415951
tags question: http://stackoverflow.com/q/27327829
tags question: http://stackoverflow.com/q/27427247
tags question: http://stackoverflow.com/q/27470341
tags question: http://stackoverflow.com/q/27367566
tags question: http://stackoverflow.com/q/27375581
tags question: http://stackoverflow.com/q/27314412
tags question: http://stackoverflow.com/q/27402826
tags question: http://stackoverflow.com/q/27405556
tags question: http://stackoverflow.com/q/27437964
tags question: http://stackoverflow.com/q/27325536
tags question: http://stackoverflow.com/q/27432256
tags question: http://stackoverflow.com/q/27384233
tags question: http://stackoverflow.com/q/27467470
tags question: http://stackoverflow.com/q/27412437
tags question: http://stackoverflow.com/q/27321862
tags question: http://stackoverflow.com/q/27446924
tags question: http://stackoverflow.com/q/27449571
tags question: http://stackoverflow.com/q/27464542
tags question: http://stackoverflow.com/q/27395550
tags question: http://stackoverflow.com/q/27402442
tags question: http://stackoverflow.com/q/27416853
tags question: http://stackoverflow.com/q/27471146
tags question: http://stackoverflow.com/q/27409879
tags question: http://stackoverflow.com/q/27401440
tags question: http://stackoverflow.com/q/27341477
tags question: http://stackoverflow.com/q/27387667
tags question: http://stackoverflow.com/q/27376205
tags question: http://stackoverflow.com/q/27374810
tags question: http://stackoverflow.com/q/27382367
tags question: http://stackoverflow.com/q/27382410
tags question: http://stackoverflow.com/q/27340808

http://stackoverflow.com/a/27469076
downvote count: 0
type: Answer
score: 1
has body: Well, I guess Java wouldn't be the right choice for that since it's a platform independent framework. And 'unlocking' files is very platform dependent in my opinion But maybe you take a look at ForceDel. It's open source software and claims to do what you are looking for. ForceDel uses some exciting new APIs introduced with Microsoft Windows Vista to determine which processes have a specified file in use. With this information, ForceDel is able to close the file in the remote process address space and then delete the file. Starting with version 1.2, ForceDel can also delete files on Windows XP.
upvote count: 1
answers question: http://stackoverflow.com/q/27469001

http://stackoverflow.com/comment/43214764
score: 20
comment on: http://stackoverflow.com/q/27371075
type: Comment
type: QuestionComment
has text: This has a distinct similarity to the `-->` "operator" (as in [`while (x --> 0) { /*...*/ }`](http://stackoverflow.com/questions/1642028/what-is-the-name-of-the-operator))

http://stackoverflow.com/a/27358321
has comment: http://stackoverflow.com/comment/43170060
score: 1
has comment: http://stackoverflow.com/comment/43169927
answers question: http://stackoverflow.com/q/27357976
upvote count: 1
type: Answer
has body: Your file copied to my project also reports the same error, but the error goes away when those - characters before every comment are removed. Did you copy the content from some app that formats the xml? e.g. Internet Explorer does that EDIT :) Try this <?xml version="1.0" encoding="utf-8" ?> <hibernate-configuration> org.h2.Driver jdbc:h2://localhost:1527/hibernatedb h2 1 org.hibernate.cache.internal.CollectionCacheInvalidator true create org.hibernate.dialect.H2Dialect <mapping class="firsthibernateproj.UserDetails" /> </hibernate-configuration>
downvote count: 0

http://stackoverflow.com/a/27327088
has body: Welcome to the wonderful world of asynchronous events. In order to do what you want, the approach is not to "wait" (because everything would then freeze), but to "listen". When something takes long in Android, such as the Text To Speech, you have to listen for a event. If you look at the docs for the Text To Speech object, you'll find it accepts a listener for different things: http://developer.android.com/reference/android/speech/tts/TextToSpeech.html#setOnUtteranceProgressListener(android.speech.tts.UtteranceProgressListener) and http://developer.android.com/reference/android/speech/tts/UtteranceProgressListener.html So you'd do (assuming your Text to Speech object is tts): tts.setOnUtteranceProgressListener(new UtteranceProgressListener() { public void onDone(String utteranceId) { // The text has been read, do your next action } public void onError(String utteranceId, int errorCode) { // Error reading the text with code errorCode, can mean a lot of things } public void onStart(String utteranceId) { // Reading of a sentence has just started. You could for example print it on the screen } }); This is called "subscribing to an event", and is asynchronous because your program can do other things and you'll be notified when "something" (what you have subscribed to) happens. Then for example when you do tts.speak ("welcome", ....) And it finishes, the method onDone in your listener will be called. You can start the voice recognizer there.
upvote count: 2
type: Answer
accepted answer of: http://stackoverflow.com/q/27326565
answers question: http://stackoverflow.com/q/27326565
has comment: http://stackoverflow.com/comment/43118863
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43136771
has text: @harshalizee Perhaps consider using a `JDialog` or `JOptionPane` instead
type: AnswerComment
comment on: http://stackoverflow.com/a/27339790
type: Comment
score: 2

http://stackoverflow.com/comment/43266393
comment on: http://stackoverflow.com/q/27410951
has text: Post the stacktrace for the error, and be more specific about what you don't understand
type: Comment
type: QuestionComment
score: 2

http://stackoverflow.com/comment/43242486
has text: @SRobertJames No problem, nice to get a question where the topic is exactly what I learned to do last week! :-)
type: Comment
comment on: http://stackoverflow.com/a/27392119
score: 0
type: AnswerComment

http://stackoverflow.com/a/27357596
has comment: http://stackoverflow.com/comment/43167769
has comment: http://stackoverflow.com/comment/43167452
has comment: http://stackoverflow.com/comment/43168156
answers question: http://stackoverflow.com/q/27357493
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43169083
has body: In Java it's quite popular to use some ORM solution like Hibernate, and it's been abstracted away to be independent of implementation (like Hibernate) with JPA. After you have created database you can also use accompanying tools to generate database schema from your domain classes or vice versa. Edit: You can create database with Oracle GUI tools like SQL Developer, and then in database you can e.g. run schema generation script (I took this from TechOnTheNet: CREATE SCHEMA AUTHORIZATION put_your_user_here CREATE TABLE products ( product_id number(10) not null, product_name varchar2(50) not null, category varchar2(50), CONSTRAINT products_pk PRIMARY KEY (product_id) ); Then e.g. try to connect to your db in Java with JDBC or set up and configure some ORM solution (learning curve may be more difficult) and go from there.
has comment: http://stackoverflow.com/comment/43167986
has comment: http://stackoverflow.com/comment/43167488
has comment: http://stackoverflow.com/comment/43168633
downvote count: 0

http://stackoverflow.com/comment/43232544
type: Comment
has text: I think this answers my question.
comment on: http://stackoverflow.com/a/27351603
type: AnswerComment
score: 0

http://stackoverflow.com/q/27358709
score: 0
answer count: 1
type: UnansweredQuestion
has title: "Using unpublished class" Eclipse warning
has body: I'm getting the following warning message from Eclipse (yellow triangle near the code): Multiple markers at this line - Using unpublished class package.SomeInterface - Using unpublished class package.SomeClass Couldn't find references to the error message using search engines. Any ideas? Edited: The class is public. The code is compiling and executing without any issues.
has comment: http://stackoverflow.com/comment/43170113
tagged with: java
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/27358929

http://stackoverflow.com/comment/43105238
type: AnswerComment
type: Comment
has text: Well played. But not a valid statement /in context/. But I guess we are playing Stupid Java Tricks here.
comment on: http://stackoverflow.com/a/27322785
score: 0

http://stackoverflow.com/comment/43232683
score: 0
type: AnswerComment
has text: @SotiriosDelimanolis Fair point. It's not of interest however when the program doesn't do anything outside the program (such as file IO, database connections etc.)
comment on: http://stackoverflow.com/a/27392625
type: Comment

http://stackoverflow.com/a/27334552
type: Answer
accepted answer of: http://stackoverflow.com/q/27323100
score: 0
answers question: http://stackoverflow.com/q/27323100
type: AcceptedAnswer
has body: list.setOnItemDragNDropListener(new DragNDropListener(){ public void onItemDrop(DragNDropListView parent, View view, int startPosition, int endPosition, long id) { super.onItemDrop(parent, view, startPosition, endPosition, id); Log.i("long clicked","pos"+" "+endPosition+" id "+id); } });

http://stackoverflow.com/comment/43305148
has text: While relatively simple, this may be too complicated a solution for someone learning simple looping.
comment on: http://stackoverflow.com/a/27431980
type: Comment
type: AnswerComment
score: 2

http://stackoverflow.com/q/27436200
has answer: http://stackoverflow.com/a/27437824
downvote count: 0
has comment: http://stackoverflow.com/comment/43313418
tagged with: spring-batch
has answer: http://stackoverflow.com/a/27436853
has body: I have a Spring batch job to get few rows of data from database to do something. I wish to do something in first row in RowMapper. public myVO mapRow(ResultSet rs, int rowNum) throws SQLException { System.out.println("rowNum is " + rowNum); if (rowNum == 1) { // do something } // some other code here } This is working fine for me at first. However, after I add in scope="step" in my batch xml file at reader part, the rowNum will always 0 instead start of 0 and increase. Any way to fix this while I wan to maintain the scope="step".
has comment: http://stackoverflow.com/comment/43313231
favorite count: 0
accepted answer: http://stackoverflow.com/a/27436853
upvote count: 1
tagged with: mapper
tagged with: late-binding
has comment: http://stackoverflow.com/comment/43314011
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: rownum
has title: spring batch rowNum does not increase
possible better answer: http://stackoverflow.com/a/27437824
type: Question
answer count: 2

http://stackoverflow.com/comment/43110020
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27323968
has text: @DavidRolfe hmm. could you update your answer with the error message? Possibly a stack trace if you have one
type: AnswerComment

http://stackoverflow.com/q/27442555
type: UnansweredQuestion
has body: I want to decode a BSON file to a Clojure map. This is my code: (ns decode (:require [clojure.java.io :as cji]) (:import [org.bson BasicBSONObject BasicBSONEncoder BasicBSONDecoder])) (defonce encoder (BasicBSONEncoder.)) (defonce decoder (BasicBSONDecoder.)) (defn read-file [file-path] (with-open [reader (cji/input-stream file-path)] (let [length (.length (clojure.java.io/file file-path)) buffer (byte-array length)] (.read reader buffer 0 length) buffer))) (defn bson2map [^Byte b] (-&gt;&gt; (.readObject decoder b) (.toMap) (into {}))) (defn read-bson [path] (clojure.walk/keywordize-keys (bson2map (read-file path)))) But when I decode a BSON file like this (r/read-bson "test.bson"), it just decodes the first record and I want to decode all of them. The test.bson is too big. How do I decode it in fragments? Then I found a class called LazyBSONDecoder, wrote some java code and it works, it can decode all of the records. import org.bson.LazyBSONDecoder; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; public class Main { public static void main(String[] args) throws IOException { InputStream in = new FileInputStream("./_Installation.bson"); LazyBSONDecoder decoder = new LazyBSONDecoder(); Object obj; int count = 0; try { do { obj = decoder.readObject(in); System.out.println(obj); count++; } while (obj != null); } catch (Exception e) { // ignore } System.out.println(count); } } So I changed the Clojure code replacing the BasicBSONDecoder for the LazyBSONDecoder but it always just decodes the first record. (defonce decoder (LazyBSONDecoder.)) (defn bson2map [^Byte b] (do (print (.readObject decoder b)) (print (.readObject decoder b)) (print (.readObject decoder b))))
has comment: http://stackoverflow.com/comment/43373635
score: 3
has title: how to decode bson by java or clojure
has comment: http://stackoverflow.com/comment/43368661
upvote count: 3
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43362422
has answer: http://stackoverflow.com/a/27469320
downvote count: 0
tagged with: bson
has comment: http://stackoverflow.com/comment/43362414
has comment: http://stackoverflow.com/comment/43356721
answer count: 1
tagged with: clojure
favorite count: 0

http://stackoverflow.com/q/27314326
accepted answer: http://stackoverflow.com/a/27314751
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43089609
has comment: http://stackoverflow.com/comment/43088791
upvote count: 0
has title: Reading integers from file
has comment: http://stackoverflow.com/comment/43088834
has answer: http://stackoverflow.com/a/27314751
favorite count: 0
has comment: http://stackoverflow.com/comment/43089176
has comment: http://stackoverflow.com/comment/43088790
has comment: http://stackoverflow.com/comment/43088899
has comment: http://stackoverflow.com/comment/43113317
score: -3
has comment: http://stackoverflow.com/comment/43090748
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27314684
has answer: http://stackoverflow.com/a/27314684
tagged with: java
has body: There is a problem, which says that try to read integers from the file which has some integers and text,and they are separated from each other by space, like the file xxx.txt: I like a apple which is 45 pounds,and 6 yuan 45 lk 56 ds ,like this,now read all the integers from the file,and add them, the example above should be resulted as 45+6+45+56=152, it is written in java code,please give me the code in java .
downvote count: 3

http://stackoverflow.com/a/27419510
has comment: http://stackoverflow.com/comment/43282774
has comment: http://stackoverflow.com/comment/43282932
has body: A set of multiple commands called as a batch file. Say you are been assigned to compile a set of classes, create jar file and execute. This can be done with a simple batch file like this: activity1.bat REM set java home path set JAVA_HOME=C:\Program Files\java\jdk1.7.0 REM set path set PATH=C:\Program Files\java\jdk1.7.0\bin REM set class path SET CLASSPATH=.. REM compile class files javac -cp %CLASSPATH% %CUR_DIR%*.java REM create a jar file jar cfm new.jar Manifest.txt *.* REM execute java -cp %CLASSPATH%;new.jar MainClass.java PAUSE Note: REM meant for comments.
has comment: http://stackoverflow.com/comment/43282892
score: 0
answers question: http://stackoverflow.com/q/27419308
type: Answer
has comment: http://stackoverflow.com/comment/43283690
has comment: http://stackoverflow.com/comment/43283030
has comment: http://stackoverflow.com/comment/43282659

http://stackoverflow.com/comment/43306606
has text: It seems that you have a typo. `String[] array1 = new String{"there", "there2", "there3", "there4"};` will not create array. Either remove `new String[]` leaving only `String[] array1 = {your, elemements};` or add type of array explicitly by adding `[]` like `new String[]{"there", "there2", "there3", "there4"};`.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27432520
type: QuestionComment

http://stackoverflow.com/q/27391390
has body: I wrote &amp; ran this code but tried it again the next only to get an error. The PHP script still runs perfectly in the browser. I understand the server isn't parsing anything back but i can't understand why. I have looked through all (i think) of the questions with the same LogCat error here and loads of other online sources but in vain. I don't understand what could've changed when i shutdown my Mac that affected the code. Thank you Here's the java code public class downloadData extends AsyncTask&lt;Void, Void, Boolean&gt; { @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(MainActivity.this); pDialog.setMessage("Loading list..."); pDialog.setIndeterminate(false); pDialog.setCancelable(true); pDialog.show(); } @Override protected Boolean doInBackground(Void... voids) { updateJSONData(); return null; } @Override protected void onPostExecute(Boolean result) { super.onPostExecute(result); pDialog.dismiss(); Log.i("onPostExecute", "downloadData complete."); DBAdapter handler = new DBAdapter(getBaseContext()); } } public void updateJSONData() { JSONArray listJsonArray; JSONParser jParser = new JSONParser(); JSONObject json = jParser.getJSONFromUrl(READ_ENTRIES_URL); if (json != null) { Log.i("updateJSONData", "MySQL download complete."); DBAdapter handler = new DBAdapter(getBaseContext()); handler.wipeMainTable(); try { listJsonArray = json.getJSONArray(TAG_ENTRIES); Log.i("updateJSONData", listJsonArray.length() + " entries downloaded"); handler.open(); for (int i = 0; i &lt; listJsonArray.length(); i++) { JSONObject listJsonArrayObject = listJsonArray.getJSONObject(i); int entry_id = listJsonArrayObject.getInt(TAG_ID); String title = listJsonArrayObject.getString(TAG_TITLE); String link = listJsonArrayObject.getString(TAG_LINK); String published = listJsonArrayObject.getString(TAG_PUBLISHED); handler.insertEntry(entry_id, title, link, published); Log.i("updateJSONData", "saved entry " + entry_id + " to SQLite database."); }…
has comment: http://stackoverflow.com/comment/43230975
tagged with: nullpointerexception
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43230592
tagged with: android
tagged with: php
has title: Another "Error converting result java.lang.NullPointerException: lock == null" situation
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43231072
type: Question
score: 0

http://stackoverflow.com/comment/43205769
type: AnswerComment
has text: When the user selects a line in a table, and if the ID wouldnt been present there the script would run into an error.
type: Comment
comment on: http://stackoverflow.com/a/27378022
score: 0

http://stackoverflow.com/q/27373201
has answer: http://stackoverflow.com/a/27374746
type: Question
has comment: http://stackoverflow.com/comment/43198748
tagged with: infinite-loop
has comment: http://stackoverflow.com/comment/43197645
tagged with: logic
tagged with: while-loop
score: 2
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43198007
has body: So, I am working on a large project for programming 1. I cannot figure out how to stop the infinite while loop with any of the other ways provided on the web site. Here is all the methods that involve making the move of the player: public boolean movement(Move m, int moved){ int rowM, colM, row, col; Player p = m.getPlayer(); if (moved == 0 || moved == 1 || moved == 7) rowM = -1; if (moved == 2 || moved == 6) rowM = 0; if (moved == 3 || moved == 4 || moved == 5) rowM = 1; else rowM = 0; if (moved == 5 || moved == 6 || moved == 7) colM = -1; if (moved == 0 || moved == 4) colM = 0; if (moved == 1 || moved == 2 || moved == 3) colM = 1; else colM = 0; row = rowM + m.getRow(); col = colM + m.getColumn(); if (!onBoard(row, col) || !getPiece(row, col).opposite(p.getPiece())) return false; while ((onBoard(row,col))&amp;&amp;(getPiece(row,col).opposite(p.getPiece()))){ row += rowM; col += colM; } if (onBoard(row, col) &amp;&amp; getPiece(row, col).opposite(p.getPiece())) return true; return false; } private void change(Move m, int moved){ int rowM, colM, row, col; Player p = m.getPlayer(); if (moved == 0 || moved == 1 || moved == 7) rowM = -1; if (moved == 2 || moved == 6) rowM = 0; if (moved == 3 || moved == 4 || moved == 5) rowM = 1; else rowM = 0; if (moved == 5 || moved == 6 || moved == 7) colM = -1; if (moved == 0 || moved == 4) colM = 0; if (moved == 1 || moved == 2 || moved == 3) colM = 1; else colM = 0; row = rowM + m.getRow(); col = colM + m.getColumn(); while (getPiece(row, col).opposite(p.getPiece())){ setPiece(p.getPiece(), row, col); row += rowM; col += colM; } } public void makeMove(Move move){ Player p = move.getPlayer(); for (int c = 0; c &lt; 8; c++){ if (movement(move, c)) change(move, c); } setPiece(p.getPiece(), move.getRow(), move.getColumn()); } public int handleTurn(Display display){ Move m = display.getMove(this.current); if (!moveLegal(m)){ display. displayMessage("Illegal Move!"); return 1; } makeMove(m); Player p = getNextPlayer(); if (p == current…
favorite count: 0
has title: Infinate While Loop. Stalling the program
upvote count: 2
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/43287006
has text: @almasshaikh SerializationUtils is a class of org.apache.commons.lang3.SerializationUtils The error comes when I try to clone t: clone(java.io.Serializable & T) in SerializationUtills cannot be applied to (T)
type: QuestionComment
comment on: http://stackoverflow.com/q/27422215
score: 0
type: Comment

http://stackoverflow.com/a/27394279
has body: You need to reset index to 0 after each line.
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27394041
score: 1
downvote count: 0

http://stackoverflow.com/comment/43162530
comment on: http://stackoverflow.com/a/27354444
type: AnswerComment
has text: Well I was thinking like for example:---- int split_index = line.lastIndexOf(":"); left = line.substring(0,split_index); right = line.subString(split_index,line.length());---- This won't work the way that I'm thinking of. Like I want Number, Gender, City, and Car to all be the left and 2, 1, 4, 7 to all the the right. If I split on a space, then only Number will be left and the rest of the line would be the right
score: 0
type: Comment

http://stackoverflow.com/q/27353001
type: Question
has answer: http://stackoverflow.com/a/27353649
has answer: http://stackoverflow.com/a/27353511
tagged with: javascript
possible better answer: http://stackoverflow.com/a/27353511
has comment: http://stackoverflow.com/comment/43159852
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/43159641
tagged with: jsp
has body: I have a .jsp file with structure of a page (lets call it base.jsp), it also includes link to CSS file (base.css). Now I want to include this base.jsp in another jsp file, pass some parameter and according to this parameter load additional CSS file. It should be something like that (I know this code is incorrect, I just want to demonstrate what I want to achieve eventually): &lt;%@include file="base.jsp" x="720" %&gt; if(x == "720") load 720.css else if(x == "460") load 460.css else load 320.css How can it be done? Edit Perhaps it can be done with something like that? &lt;%@include file="base.jsp?x=720" %&gt; and then somehow read this x parameter in the base.jsp file and load additional css accordingly? Is there such possibility?
favorite count: 0
has comment: http://stackoverflow.com/comment/43159932
has comment: http://stackoverflow.com/comment/43159608
has answer: http://stackoverflow.com/a/27353421
accepted answer: http://stackoverflow.com/a/27353421
type: AnsweredQuestion
downvote count: 0
has title: Including a page with JSP and loading various CSS files
score: 1
tagged with: java

http://stackoverflow.com/a/27486153
has comment: http://stackoverflow.com/comment/43410268
type: Answer
has body: You missed the point after the class description.
has comment: http://stackoverflow.com/comment/43445822
score: 0
answers question: http://stackoverflow.com/q/27440798
has comment: http://stackoverflow.com/comment/43446146
has comment: http://stackoverflow.com/comment/43444369

http://stackoverflow.com/comment/43247604
type: Comment
comment on: http://stackoverflow.com/a/27401362
has text: this function is to api level +11 and i need to api level 10
type: AnswerComment
score: 0

http://stackoverflow.com/q/27390485
has body: I have two ArrayList, the one is a Bitmap typ and contains picture and the other is a String which contains the text for the bitmap. I just want to shuffle the Bitmap, but the String ArrayList should be in the same order. private ArrayList&lt;Bitmap&gt; tmpBitmap = new ArrayList&lt;Bitmap&gt;(); private ArrayList&lt;String&gt; tmpName = new ArrayList&lt;String&gt;(); I tried this, but it shuffles in different orders. Collections.shuffle(tmpWord); Collections.shuffle(tmpName);
score: 0
answer count: 3
has title: How to shuffle in same order?
has comment: http://stackoverflow.com/comment/43228917
has comment: http://stackoverflow.com/comment/43229357
type: UnansweredQuestion
tagged with: android
tagged with: shuffle
tagged with: java
has answer: http://stackoverflow.com/a/27390530
has answer: http://stackoverflow.com/a/27390621
type: Question
has answer: http://stackoverflow.com/a/30261793
has comment: http://stackoverflow.com/comment/43229832
tagged with: arrays
has comment: http://stackoverflow.com/comment/43228995
tagged with: arraylist

http://stackoverflow.com/q/27391456
type: UnansweredQuestion
tagged with: java
linked to: http://stackoverflow.com/q/7707321
type: Question
has body: I have written a method that searches for an entry in a binary search tree. It successfully searches for a value but i don't think it will find all duplicates. The reason i know it doesn't work is that i'm trying to write another method that returns an arraylist with all the duplicates of a search value. That method only returns the first value it finds. here are my two methods. for the arraylist method i think i should write a recursive method to get all the values but i'm not sure how to get that working. public T getEntry(T entry) { T result = null; boolean found = false; BinaryNodeInterface&lt;T&gt; currentNode = getRootNode(); while (!found &amp;&amp; (currentNode != null)) { T currentEntry = currentNode.getData(); if (entry.equals(currentEntry)) { result = currentEntry; found = true; } else if (entry.compareTo(currentEntry) &lt; 0) currentNode = currentNode.getLeftChild(); else currentNode = currentNode.getRightChild(); } return result; } public ArrayList&lt;T&gt; getAllEntries(T searchVal) { BinaryNodeInterface&lt;T&gt; currentNode = getRootNode(); ArrayList&lt;T&gt; array = new ArrayList&lt;T&gt;(); T value = getEntry(searchVal); if (value == null) return array; else array.add(getEntry(searchVal)); return array; }
has title: How to return all duplicates of a binary search tree java
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/43230859
has answer: http://stackoverflow.com/a/27391778
has answer: http://stackoverflow.com/a/27391669
tagged with: binary-search-tree

http://stackoverflow.com/comment/43339010
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27449351
has text: @scheisse_minelli good, thank you, I edited my answer with this information
type: Comment

http://stackoverflow.com/comment/44222087
comment on: http://stackoverflow.com/a/27434117
score: 0
type: Comment
has text: That makes sense - I was assuming that they would be running on the same host in both dev & production. I'm afraid I don't have much experience with deploying apps on multiple machines, although it shouldn't be *too* difficult to set up your containers so that they use DNS for name resolution in production.
type: AnswerComment

http://stackoverflow.com/comment/43554702
type: Comment
type: QuestionComment
has text: @Gagravarr you were right, maven resource plugin corrupts file, thank you very much for your help , I found the same question in other stackoverflow post and put it as an answer
score: 0
comment on: http://stackoverflow.com/q/27387365

http://stackoverflow.com/a/27417232
downvote count: 0
has comment: http://stackoverflow.com/comment/43277902
has body: does this set errorlevel or the result is just printed? You can use FIND command and conditional execution: java -jar "C:\4_USB_Relay\DenkoviRelayCommandLineTool_10.jar" DAE001DQ 4 1 status 2&gt;&amp;1 | find "0" &amp;&amp; ( java -jar "C:\4_USB_Relay\DenkoviRelayCommandLineTool_10.jar" DAE001DQ 4 1 1 ) || ( java -jar "C:\4_USB_Relay\DenkoviRelayCommandLineTool_10.jar" DAE001DQ 4 1 0 )
score: 1
accepted answer of: http://stackoverflow.com/q/27417100
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27417100
upvote count: 1
type: Answer

http://stackoverflow.com/comment/43262558
comment on: http://stackoverflow.com/q/27409051
has text: Also, `Calendar` months are 0-based so 0 = January, 1 = February, ..., 11 = December. And integer literals that start with 0 such as `01`, `02` are interpreted as octal, which is not what you want.
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/27400671
downvote count: 0
type: Question
tagged with: azure-web-app-service
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27401351
tagged with: servlets
upvote count: 1
answer count: 1
tagged with: tomcat
favorite count: 0
has title: UTF-8 in Java Servlet doesn't work when deployed to Azure Websites
type: UnansweredQuestion
tagged with: azure
has body: I'm facing a problem with character encoding. Consider this simple snippet: @Override protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setCharacterEncoding("UTF-8"); resp.setCharacterEncoding("UTF-8"); resp.getWriter().println(req.getParameter("test")); resp.getWriter().println(Charset.defaultCharset()); } When I make a http put request (using chrome's postman app) everything is fine on localhost tomcat: test parameter: żłąźć Result: żłąźć windows-1250 But when I deploy this servlet to azure websites tomcat, the following test goes wrong: Result: Å¼ÅÄÅºÄ windows-1252 How could I fix it?

http://stackoverflow.com/comment/43146791
comment on: http://stackoverflow.com/a/27344874
has text: what you mean by another window?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43095036
has text: seems not to be successfully completed install ... I have a mistake --- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? ?????
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27317345
type: Comment

http://stackoverflow.com/a/27405546
answers question: http://stackoverflow.com/q/27403866
has body: I didn't get how to fix AnnotationTransactionCreation. I made a hack. Create a proxy for PlatformTransactionManager public class TestTransactionManager implements PlatformTransactionManager { private static List&lt;TestTransactionManager&gt; transactionManagerList = new ArrayList&lt;&gt;(); private PlatformTransactionManager transactionManager; public void init() { transactionManagerList.add(this); for (TestTransactionManager m : transactionManagerList) { m.setTransactionManager(transactionManager); } } public void setTransactionManager(PlatformTransactionManager transactionManager) { this.transactionManager = transactionManager; } @Override public TransactionStatus getTransaction(TransactionDefinition transactionDefinition) throws TransactionException { return transactionManager.getTransaction(transactionDefinition); } @Override public void commit(TransactionStatus transactionStatus) throws TransactionException { transactionManager.commit(transactionStatus); } @Override public void rollback(TransactionStatus transactionStatus) throws TransactionException { transactionManager.rollback(transactionStatus); } } and put it into test application context &lt;bean id="testTransactionManager" class="ru.bpc.core.integration.stub.TestTransactionManager" init-method="init"&gt; &lt;property name="transactionManager" ref="transactionManager"/&gt; &lt;/bean&gt; &lt;tx:annotation-driven mode="aspectj" transaction-manager="testTransactionManager"/&gt;
score: 0
type: Answer

http://stackoverflow.com/comment/43264946
has text: I did not, but I don't think this is possible with the grails plugin. Can someone confirm that? Also, my understanding is that it should inherit these settings from Java.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27399252

http://stackoverflow.com/comment/43122445
comment on: http://stackoverflow.com/a/27332087
score: 0
type: AnswerComment
has text: i am trying since you post your answer but nothing can you please post all code that check all alphabetic and anything is invalid thanks in advance
type: Comment

http://stackoverflow.com/q/27345261
has body: I'm facing heap space OutOfMemory error during my Mapper side cleanup method, where i'm reading the data from inputStream and converting it into byte array using IOUtils.toByteArray(inptuStream); I know i can resolve it by increasing the max heap space(Xmx), but i should be having enough heap space(1Gb) already. I found the below info on debugging(approximate space value), runtime.maxMemory() - 1024Mb runtime.totalMemory - 700Mb runtime.freeMemory - 200Mb My block size is 128 Mb and i'm not adding any additional data to it on my RecordReader. My output size from the mapper wont be more than 128 Mb. And also i saw the available bytes in inputStream(.available()) which is provided an approximate value of 128 Mb. I'm also a bit confused about the memory allocation of JVM. Let's say I set my heap space value as Xms-128m;Xmx-1024m. My tasktracker has 16Gb RAM and already I've 8jobs(8JVM) running in that tasktracker. Lets assume that the tasktracker can allocate only 8.5 Gb RAM for JVM and it'll use the rest for it's internal purpose. So we have 8.5Gb RAM available and 8 tasks are running which is currently using only 6Gb RAM. Is it possible for a new task be assigned to the same task tracker since already 8 tasks are running which might require 8Gb in which case the new task wont be able to provide user requested heap size(1Gb) if required. PS: I know that not all heap needs to be in RAM(paging). My main question is, will the user be able to get the maximum requested heap size in all scenario?
tagged with: mapreduce
type: Question
tagged with: hadoop
has comment: http://stackoverflow.com/comment/43190673
score: 0
has title: Mapper side OutOfMeory
tagged with: heap-memory
type: UnansweredQuestion
tagged with: memory-management
answer count: 0
has comment: http://stackoverflow.com/comment/43375389
tagged with: java

http://stackoverflow.com/comment/43254052
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27402451
has text: "when you need to add another ssl cert. you must change your code" this is not correct, you can set the keystore via properties file or another mechanism. "the second is the best choice", neither is correct, depends on the complexity of your app and on the application type, standalone, webapp... etc, maybe you need the use of multiple credential stores to maintaining a separate SSL context per individual target interaction encapsulating each context in a new SSLContext object.
score: 0

http://stackoverflow.com/q/27375711
downvote count: 4
has comment: http://stackoverflow.com/comment/43204308
answer count: 2
possible better answer: http://stackoverflow.com/a/27376029
has body: question I want to implement a BinarySearch method myself on an Object of Klant how do i do this? Klant has some variables. public class Klant { public String klantID; private String voornaam; private String tussenvoegsel; private String achternaam; private int leeftijd; private static boolean MAN = true; private String plaats; private String email; /* * Getters and setters included */ } Klant toevoeging = new Klant("FirstName", "middleName", "\Lastname\"", 20, false, "Location", "email@email.com"); klanten.add(toevoeging);
tagged with: binary-search
has title: ArrayList BinarySearch
favorite count: 0
has answer: http://stackoverflow.com/a/27376029
upvote count: 7
type: AnsweredQuestion
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/27376143
accepted answer: http://stackoverflow.com/a/27376143
type: Question

http://stackoverflow.com/comment/43282078
type: QuestionComment
comment on: http://stackoverflow.com/q/27419438
score: 0
has text: Make two `repositories`. One for `client` and one for `location` functions.
type: Comment

http://stackoverflow.com/a/27434003
upvote count: 2
has body: There is an overload of assertEquals that takes objects. It (eventually) calls the equals method on both objects. So, the "compare" method you need to write is an override of Object's equals method. Once you have that written, then you can call assertEquals("Failure message", yourObject1, yourObject2). There is no need to extend JUnit for this case. As an aside, if you override equals, then you should override hashCode also, in a consistent way.
downvote count: 0
answers question: http://stackoverflow.com/q/27433916
type: Answer
score: 2

http://stackoverflow.com/comment/43357626
type: QuestionComment
has text: You want to read a XML file into a DOM ?
comment on: http://stackoverflow.com/q/27460332
score: 0
type: Comment

http://stackoverflow.com/comment/43200282
has text: ..and one solution would be to Autowire yourself and then call myThread.doJob() - http://stackoverflow.com/questions/17279228/how-to-autowire-bean-in-same-bean
type: Comment
comment on: http://stackoverflow.com/a/27374907
type: AnswerComment
score: 1

http://stackoverflow.com/comment/43187633
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27367613
has text: What show on your log-cat? I really tried this, and it will show D/com.parse.push﹕ successfully subscribed to the broadcast channel.

http://stackoverflow.com/comment/43310536
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27429052
type: Comment
has text: Read my editied answer above as there are a few things to try commiting the data. I changed my query to reflect using the complete update of a record through the execSQL method.

http://stackoverflow.com/comment/43215171
comment on: http://stackoverflow.com/q/27383134
score: 0
type: Comment
type: QuestionComment
has text: Yes, this has to be done using the SWT.PaintItem event

http://stackoverflow.com/a/64822970
score: 0
answers question: http://stackoverflow.com/q/27458902
type: Answer
has body: import java.io.*; import java.util.*; import java.util.concurrent.CyclicBarrier; class BusLine { private String destination; protected static int max_seat, checkpoint; private ArrayList<Bus> BUSA = new ArrayList<Bus>(); private ArrayList<Bus> BUSC = new ArrayList<Bus>(); private ArrayList<Group> GROUP_A = new ArrayList<Group>(); private ArrayList<Group> GROUP_C = new ArrayList<Group>(); public BusLine(int ms, int cp, String d) { max_seat = ms; checkpoint = cp; destination = d; } public String getDestination() { return destination; } public void printAirportCheckpoint() { System.out.println(); System.out.printf("%s >> %d airport-bound buses have been allocated.", Thread.currentThread().getName(), BUSA.size()); } public void printCityCheckpoint() { System.out.println(); System.out.printf("%s >> %d city-bound buses have been allocated.", Thread.currentThread().getName(), BUSC.size()); System.out.println(); System.out.println(); } public void BusBoundA() { int temp = 0; for (int i = 0; i < BUSA.size(); i++) { if (BUSA.get(i).getName().equals("A" + i)) { temp++; } } System.out.println(); System.out.printf("%s >> ==== Airport Bound ====", Thread.currentThread().getName()); System.out.println(); for (int i = 0; i < temp; i++) { System.out.printf("%s >> %s : ", Thread.currentThread().getName(), "A" + i); for (int j = 0; j < GROUP_A.size(); j++) { if (GROUP_A.get(j).getBusname().equals("A" + i)) { System.out.printf(" %-20s(%2d seats)", GROUP_A.get(j).getName(), GROUP_A.get(j).getSeat()); //System.out.printf(","); } } System.out.println(); } } public void BusBoundC() { int temp = 0; for (int i = 0; i < BUSC.size(); i++) { if (BUSC.get(i).getName().equals("C" + i)) { temp++; } } System.out.println(); System.out.printf("%s >> ==== City Bound ====", Thread.currentThread().getName()); System.out.println(); for (int i = 0; i < temp; i++) { System.out.printf("%s >> %s : ", Thread.currentThread().getName(), "C" + i); for (int j = 0; j < GROUP_C.size(); j++) { if (GROUP_C.get(j).getB…

http://stackoverflow.com/comment/43122982
type: AnswerComment
type: Comment
has text: Missed 2 pluses, nonetheless, I still gave a +1.
comment on: http://stackoverflow.com/a/27332746
score: 0

http://stackoverflow.com/a/27422613
score: 1
has body: The Spring documentation explicitly explains what to do. The idea to mix application/json and multipart/form-data is wrong, because application/json would be one part of the multipart (sic!) request. WebKitFormBoundary leads me to think that you try to send an AJAX request from your browser and I wonder if you really send JSON. AFAIK it's not possible to explicitly add a (real) JSON part like it's shown in the Spring documentation. Maybe you can show us the client code. Anyway you can't use @RequestBody, because that would include the files you want to upload. You would have to use @RequestPart. If you send form data - instead of JSON - alongside the files then you don't need any annotation at all.
downvote count: 0
has comment: http://stackoverflow.com/comment/43319303
has comment: http://stackoverflow.com/comment/43298263
type: Answer
answers question: http://stackoverflow.com/q/27413505
upvote count: 1

http://stackoverflow.com/a/27417763
downvote count: 0
answers question: http://stackoverflow.com/q/27417677
has comment: http://stackoverflow.com/comment/43280569
type: Answer
has comment: http://stackoverflow.com/comment/43282202
upvote count: 1
has comment: http://stackoverflow.com/comment/43281084
has comment: http://stackoverflow.com/comment/43281697
has comment: http://stackoverflow.com/comment/43286643
has body: Character encoding depends on the system. Depending on your box, it may print the 16 bits of the UTF-16 encoding (which is 9794), the high 8 bits (which would be 38) or, as in your case, the low 8 bits (which is 66). 9794 / 256 = 38 9794 % 256 = 66
has comment: http://stackoverflow.com/comment/43299855
score: 1
accepted answer of: http://stackoverflow.com/q/27417677
type: AcceptedAnswer

http://stackoverflow.com/q/27460744
answer count: 2
upvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27464587
tagged with: javafx-2
downvote count: 0
type: UnansweredQuestion
type: Question
has body: I try to switch between scenes in same stage. I'm beginner in JavaFX so I don't know how to do it easily without spaghetti code. When I start code below I get null pointer at rootLayout.setCenter(content) in showCarChoosePage method (second scene). I know rootLayout is null and I was trying create new scene with and load it to primaryStage but then I got null pointer too. showCarChoosePage method is calling from LoginController. Thanks for your help public class MC extends Application { public Scene scene; private GridPane grid; public AnchorPane content; public BorderPane rootLayout; public Stage primaryStage; @Override public void start(Stage primaryStage) { this.primaryStage = primaryStage; this.primaryStage.setTitle("VMHT v0.1"); try { FXMLLoader loader = new FXMLLoader(MC.class.getResource("view/RootLayout.fxml")); rootLayout = (BorderPane) loader.load(); Scene scene = new Scene(rootLayout); primaryStage.setScene(scene); primaryStage.show(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } showLoginPage(); //showCarChoosePage(); } public void showLoginPage(){ try { FXMLLoader loader = new FXMLLoader(MC.class.getResource("view/LoginView.fxml")); content = (AnchorPane) loader.load(); rootLayout.setCenter(content); LoginController controller = loader.getController(); controller.setMC(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void showCarChoosePage(){ try { FXMLLoader loader = new FXMLLoader(MC.class.getResource("view/CarChooseView.fxml")); AnchorPane content = (AnchorPane) loader.load(); rootLayout.setCenter(content); CarChooseController controller = loader.getController(); controller.setMC(this); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static void main(String[] args) { launch(args); } }
score: 1
tagged with: java
has title: How to swtich to new scene in the same stage JavaFX
has answer: http://stackoverflow.com/a/27473087

http://stackoverflow.com/comment/43102969
has text: else {Planner();} , what does this do?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27321761

http://stackoverflow.com/a/27494990
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27351680
answers question: http://stackoverflow.com/q/27351680
has body: Thanks Claus and Namphibian it was actually the issue with write access to the service account used to map the windows folder as suggested by by both of you. It's now working once we provided the access. Thanks Again.
score: 0

http://stackoverflow.com/q/27393441
answer count: 1
type: UnansweredQuestion
tagged with: matlab
tagged with: netbeans
tagged with: java
has body: I'm currently working with Netbeans and calling Matlab functions from Netbeans interface. Does anybody know how to determine when the Matlab process has done processing and prompt Netbeans that it is done processing? i've tried the following code: System.out.println(p.getInputStream().read()); because as what I have read it will return -1 if the process ends, but it returns -1 even before the process starts. I hope someone could help me. thanks a lot!
type: Question
has answer: http://stackoverflow.com/a/27393676
score: 0
has title: How to determine if the subprocess has end processing?

http://stackoverflow.com/q/27325460
favorite count: 0
has comment: http://stackoverflow.com/comment/43110183
has comment: http://stackoverflow.com/comment/43110180
has title: Need to subtract one from user input. How? Java
tagged with: java.util.scanner
type: UnansweredQuestion
downvote count: 2
type: Question
has comment: http://stackoverflow.com/comment/43110148
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/43110124
has body: basically I just need to know how to subtract one from a user input. I am trying to get an x and y coordinate from a user to place into a 2D array that can only be 20X20, so if the user puts in a 20, I need my program to read it as 19 so it is not out of bounds. x = keyboard.nextInt() Is what I have now.
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27325480

http://stackoverflow.com/q/27474415
tagged with: jfreechart
type: Question
has answer: http://stackoverflow.com/a/27483223
has comment: http://stackoverflow.com/comment/43383290
upvote count: 2
answer count: 1
has title: JFreeChart array as dataset
favorite count: 0
score: 2
type: AnsweredQuestion
has body: I am using JFreeChart to plot a line graph. I would like to load arrays as the data set... one array for the x-axis and another array for the y-axis. I am having a problem when trying to pass the array as the data to use in the dataset. The following is what I've tried; public DefaultCategoryDataset createDataset(int[] epochNo, int[] BFacts) { final DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (int i = 0; i&lt;epochNo.length(); i++) { dataset.addValue(epochNo[i], BFacts[i]); } return dataset; } Thanks in advance!
downvote count: 0
tagged with: java
accepted answer: http://stackoverflow.com/a/27483223

http://stackoverflow.com/comment/43317807
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27438921
has text: I cant play this specific link http://192.168.1.234/hls-live/livepkgr/_definst_/liveevent/livestream.m3u8"
score: 0

http://stackoverflow.com/comment/43208510
comment on: http://stackoverflow.com/a/27358509
type: AnswerComment
score: 1
type: Comment
has text: I think you have other issues. I see this error 'java.lang.NoSuchMethodError: com.google.common.hash.HashFunction.hashInt(I)' probably at the point where data is being processed. This is probably related to a guava version conflict.

http://stackoverflow.com/a/27345433
has comment: http://stackoverflow.com/comment/43262563
type: Answer
answers question: http://stackoverflow.com/q/27345076
has body: You'd have to profile your app to find out for sure, but I'm guessing that the "// Process data" part is the culprit. You're holding the connection open while process all of the rows. I'd suggest that you read a batch of rows at a time, close the statement, and then process the batch. Then do a select for the next batch, rinse and repeat. Selecting one row at a time would introduce a lot of overhead, so I wouldn't suggest doing that. Also, make sure that you're using a connection pool, so that you don't actually have to build a new Connection each time. The pool will keep it open for you, and recycle it if it goes dead / times out.
score: 0

http://stackoverflow.com/q/27387667
accepted answer: http://stackoverflow.com/a/27414395
tagged with: secondary-sort
type: Question
tagged with: mapper
tagged with: reducers
score: 0
tagged with: java
answer count: 1
has answer: http://stackoverflow.com/a/27414395
tagged with: hadoop
has title: failed to set a KeyComparator function
has body: I'm trying to sort the data by value The method i use is to combine the key and value to a composite key e.g (key,value) -> ({key,value},value) and define my KeyComaparator which is compare the value part in the key my data is a paragraph that i should count the words and i done two job, the first one do the wordCount, but combine the key to composite key in reducer. this is the result is,4 4 the,15 15 ECA,1 1 to,6 6 ..... and in the second job, I try to use the composite key to sort by the value this is my mapper2 public static class Map2 extends MapReduceBase implements Mapper&lt;LongWritable,Text,Text,IntWritable&gt;{ private Text word = new Text(); public void map(LongWritable key, Text value, OutputCollector&lt;Text,IntWritable&gt; output, Reporter reporter) throws IOException { String line = value.toString(); String w1[] = line.split("\t"); word.set(w1[0]); output.collect(word,new IntWritable(Integer.valueOf(w1[1]))); } } and here is my Keycomparator public static final class KeyComparator extends WritableComparator { public KeyComparator(){ super(Text.class,true); } @Override public int compare(WritableComparable tp1, WritableComparable tp2) { Text t1 = (Text)tp1; Text t2 = (Text)tp2; String a[] = t1.toString().split(","); String b[] = t2.toString().split(","); return a[1].compareTo(b[1]); } this is my reducer2 public static class Reduce2 extends MapReduceBase implements Reducer&lt;Text, IntWritable, Text, IntWritable&gt; { public void reduce(Text key, Iterator&lt;IntWritable&gt; values, OutputCollector&lt;Text, IntWritable&gt; output, Reporter reporter) throws IOException{ int sum=0; while( values.hasNext()){ sum+= values.next().get(); } //String cpKey[] = key.toString().split(","); Text outputKey = new Text(); //outputKey.set(cpKey[0]); output.collect(key, new IntWritable(sum)); } } here is my main function public static void main(String[] args) throws Exception { int reduceTasks = 1; int mapTasks = 3; System.out.println("1. New JobConf..."); JobConf conf =…
type: AnsweredQuestion

http://stackoverflow.com/q/27432690
has comment: http://stackoverflow.com/comment/43309255
has comment: http://stackoverflow.com/comment/43306554
has body: This is a program for calculate the area of triangle that create by six points and point out what types of triangle. import java.util.Scanner; public class assignment { public static void main(String[] args) { Scanner input = new Scanner(System.in); int m = 0,n = 0; int[][] x = new int[6][2]; double a,b,c,a1,b1,c1; String y = ""; System.out.println("Please enter six points,"); for(int i = 0 ; i &lt; x.length ; i++ ){ for(int j = 0 ; j &lt; x[i].length ; j++) x[i][j] = input.nextInt(); } for(int i = 0 ; i &lt; 30 ; i++) System.out.print("--"); System.out.print("\n\t\t\t\tTypes of Triangles\n"); for(int i = 0 ; i &lt; 30 ; i++) System.out.print("--"); System.out.println(); System.out.println("Point1\t\tPoint2\t\tPoint3\t\tType of Triangle"); for(int i = 0 ; i &lt; 30 ; i++) System.out.print("--"); System.out.println(); for(int j = 0 ; j &lt; 4 ; j++){ for(int k = j + 1 ; k &lt; 5 ; k++ ){ for(int l = k + 1 ;l &lt; 6 ; l++ ){ a = Math.sqrt(Math.pow((x[j][0]-x[k][0]),2)+Math.pow((x[j][1]-x[k][1]),2)); b = Math.sqrt(Math.pow((x[j][0]-x[l][0]),2)+Math.pow((x[j][1]-x[l][1]),2)); c = Math.sqrt(Math.pow((x[l][0]-x[k][0]),2)+Math.pow((x[l][1]-x[k][1]),2)); c1=Math.max(Math.max(a,b),c); b1=Math.min(Math.min(a,b),c); a1=(a+b+c)-c1-b1; if ( a1 &gt; 0 &amp;&amp; b1 &gt; 0 &amp;&amp; c1 &gt; 0 &amp;&amp; a1 + b1 &gt; c1 &amp;&amp; b1 + c1 &gt; a1 &amp;&amp; c1 + a1 &gt; b1 ){ if(Math.pow(c1,2) == (Math.pow(b1,2) + Math.pow(a1,2))){ if(a1==b1 || b1==c1 || c1==a1){ y = ("Right-angled\tIsosceles"); } else if(a1!=b1 &amp;&amp; b1!=c1 &amp;&amp; c1!=a1){ y = ("Right-angled\tScalene"); } } else if(a1==b1 || b1==c1 || c1==a1){ y = ("Isosceles"); } else if(a1!=b1 &amp;&amp; b1!=c1 &amp;&amp; c1!=a1){ y=("Scalene"); } } else{ y = ("Non-triangle"); } System.out.println("(" + x[j][0] + "," + x[j][1]+ ")\t\t" + "(" + x[k][0] + "," + x[k][1] + ")\t\t" + "(" + x [l][0] + "," + x[l][1]+")\t\t" + y ); } } } System.out.print("Maximum area of triangle =" + Math.max(area())); System.out.print("Maxim…
has comment: http://stackoverflow.com/comment/43306889
downvote count: 3
answer count: 1
has title: I am beginner, why "error: '.class' expected" is appear?
has comment: http://stackoverflow.com/comment/43306742
has comment: http://stackoverflow.com/comment/43307016
favorite count: 0
accepted answer: http://stackoverflow.com/a/27433029
score: -3
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43306825
upvote count: 0
has comment: http://stackoverflow.com/comment/43307151
has answer: http://stackoverflow.com/a/27433029
tagged with: java
has comment: http://stackoverflow.com/comment/43306855
type: Question
has comment: http://stackoverflow.com/comment/43307071
has comment: http://stackoverflow.com/comment/43306630

http://stackoverflow.com/comment/43344980
type: AnswerComment
comment on: http://stackoverflow.com/a/27453121
has text: @aioobe The fact that inlining it also has that bug doesn't detract from my comment, imho. `init()` methods often publish `this` or spin off threads -- that's commonly _why_ they're separate methods as opposed to just being in the constructor. Given that the construct-than-init pattern has a relatively high correlation with init-does-thread-stuff, I thought it'd be helpful to point that danger out explicitly.
score: 0
type: Comment

http://stackoverflow.com/a/27331815
upvote count: 1
has comment: http://stackoverflow.com/comment/43121372
has comment: http://stackoverflow.com/comment/43121400
type: Answer
has comment: http://stackoverflow.com/comment/43121441
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27331768
has body: ..what is best way to solve my problem? Provide a button for the user to lock in answer or check answer Add an action listener to the button. When the action event is detected, proceed. (And ignore the advice that you need a thread. You already have one - the Event Dispatch Thread, and don't need another.)
has comment: http://stackoverflow.com/comment/43121655
has comment: http://stackoverflow.com/comment/43121673

http://stackoverflow.com/q/27333575
tagged with: java
tagged with: eclipse
type: Question
tagged with: debugging
has title: Application is waiting for debugger
downvote count: 0
answer count: 1
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/27333669
tagged with: android-studio
score: 2
has body: I know this has been mentioned many times, but I've noticed strange thing that were not talked before. In fact, when the app get deployed on device, even we disconnect device from pc and restart the phone the app will still show this message "Waiting For Debugger". When we plug in to the pc, and attach debugger in IDE, application start running normally. The same is when we disconnect debugger --> app, popup the black screen and "Waiting For Debugger". We can iterate this to infinity. It looks as if there were some dependency to debugger. Activity that is set as launcher in manifest: &lt;activity android:name=".activities.SplashScreenActivity" android:screenOrientation="portrait"&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; Project buildscript: buildscript { repositories { jcenter() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.14.4' } } app module buildscript: apply plugin: 'android' android { compileSdkVersion 21 buildToolsVersion "21.1.1" defaultConfig { applicationId "com.dot42" minSdkVersion 14 targetSdkVersion 21 versionCode 1 versionName "1.0" } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile project(':deviceList') } } library module buildscript: apply plugin: 'com.android.library' android { compileSdkVersion 'Google Inc.:Google APIs:21' buildToolsVersion "21.1.1" defaultConfig { minSdkVersion 14 targetSdkVersion 21 } } dependencies { compile 'com.android.support:support-v4:21.0.2' } Any ideas?

http://stackoverflow.com/a/27329246
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27329207
has body: If you're just doing a single concatenation, use str1 + str2. This is easy to read, and will be translated to string concat by the compiler, which is perfectly fine if you're not going through a loop or something. In fact, it's faster than using a StringBuilder if you're only going to concatenate strings a single time. See http://blog.codinghorror.com/the-sad-tragedy-of-micro-optimization-theater/ for a description of why you shouldn't bother using a string builder if you're not looping. Also when 2 strings are involved is the complexity of String concat O(n) where n is the length of the longest string? You could say that. I'd say it's O(n) where n is the combined length of the two strings, but since the shortest string cannot, by definition, be an order of magnitude larger than the longest string then it all comes out the same.
type: AcceptedAnswer
score: 1
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27329207

http://stackoverflow.com/a/27372338
has body: The solution is to move the lines: if (a.getString(R.styleable.BootstrapButton_android_textSize) == null) { fontSize = bootstrapSize.getFontSize(); } before the "finally" block which recycles the a variable: finally { a.recycle(); } the final BootstrapButton.java file is here
upvote count: 2
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27364352

http://stackoverflow.com/q/27393619
has comment: http://stackoverflow.com/comment/43234534
has answer: http://stackoverflow.com/a/27393849
type: Question
tagged with: if-statement
answer count: 1
has body: Here is an example of a string expression I am creating that I then want to use in the condition of an if statement. public static String dynamicIf(String a, String b, String c){ String expression = ""; String[] list = {"one", "two", ""}; if(!a.equals("")) expression += "a.equals(list[0])"; if(!b.equals("")) { if(!expression.equals("")) expression += " &amp;&amp; b.equals(list[1])"; else expression += "b.equals(list[1])"; } if(!c.equals("")) { if(!expression.equals("")) expression += " &amp;&amp; c.equals(list[2])"; else expression += "c.equals(list[2])"; } //String[] splitExpression = expression.split(" &amp;&amp; "); return expression; } So the function above creates a string which i would then like to use in the condition of an if statement. The result of the method running with these parameters: dynamicIf("one","two",""); is a.equals(list[0]) &amp;&amp; b.equals(list[1]) How can I get this expression in a string to run within the condition of an if? I hope you understand. Thank you.
has comment: http://stackoverflow.com/comment/43234957
has title: Dynamic If Condition from String expression
downvote count: 0
accepted answer: http://stackoverflow.com/a/27393849
has comment: http://stackoverflow.com/comment/43238104
linked to: http://stackoverflow.com/q/2605032
favorite count: 0
has comment: http://stackoverflow.com/comment/43238062
has comment: http://stackoverflow.com/comment/43234699
has comment: http://stackoverflow.com/comment/43234643
upvote count: 1
has comment: http://stackoverflow.com/comment/43234622
type: AnsweredQuestion
tagged with: dynamic
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43234606
has comment: http://stackoverflow.com/comment/43234592

http://stackoverflow.com/a/27323086
has comment: http://stackoverflow.com/comment/43105390
score: 0
accepted answer of: http://stackoverflow.com/q/27323003
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/43105318
answers question: http://stackoverflow.com/q/27323003
has body: It means that "Do not expect java to handle OR avoid deadlocks for you. If you do not write your code properly then there is no way java will tell you in advance. So, it is your responsibility to make sure your code does not cause any deadlocks".

http://stackoverflow.com/q/27460679
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43357762
has answer: http://stackoverflow.com/a/27460709
answer count: 4
has answer: http://stackoverflow.com/a/27461363
has title: Using this() of a constructor to call another constructor in the same class in Java
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27460738
has answer: http://stackoverflow.com/a/27460714
has body: A small segment of testing code as follows: class Teacher { private String title; String name = "A"; int age = 20; Teacher (String title) { //System.out.println(name); this(name,age,title); } Teacher (String name, int age, String title) { System.out.println("OK"); } } public class Test { public static void main (String[] args) { Teacher teacher1 = new Teacher("John"); Teacher teacher2 = new Teacher("Mike",25,"TA"); } } As above, I annotated System.out.println(name); After compiling, there was an error:Can't reference name(age) before the superclass constructor has been called. However, I annotated this(name,age,title);, which meant I only used System.out.println(name);. And the error was gone. Thus, I think the name and age has been initialized and get the value A,20. That is to say, this(name,age,title) is actually this("a",20,"John") I don't know the principle. Need your help.
score: 0
has comment: http://stackoverflow.com/comment/43358140
has comment: http://stackoverflow.com/comment/43357775
tagged with: constructor

http://stackoverflow.com/q/27427247
has body: I'm working on making a web server that will run MapReduce jobs, however I cannot seem to get the server to start. when I try to run the jar for the project, i get the following error java.io.IOException: Failed on local exception: com.google.protobuf.InvalidProtocolBufferException: Protocol message tag had invalid wire type.; Host Details : local host is: "hadoop4-rdc.ritis.org/10.1.1.33"; destination host is: "hadoop4-rdc.ritis.org":8888; at org.apache.hadoop.net.NetUtils.wrapException(NetUtils.java:764) ~[hadoop-common-2.3.0-cdh5.1.0.jar!/:na] at org.apache.hadoop.ipc.Client.call(Client.java:1413) ~[hadoop-common-2.3.0-cdh5.1.0.jar!/:na] at org.apache.hadoop.ipc.Client.call(Client.java:1362) ~[hadoop-common-2.3.0-cdh5.1.0.jar!/:na] at org.apache.hadoop.ipc.ProtobufRpcEngine$Invoker.invoke(ProtobufRpcEngine.java:206) ~[hadoop-common-2.3.0-cdh5.1.0.jar!/:na] at com.sun.proxy.$Proxy11.getFileInfo(Unknown Source) ~[na:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_45] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_45] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_45] at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_45] at org.apache.hadoop.io.retry.RetryInvocationHandler.invokeMethod(RetryInvocationHandler.java:186) ~[hadoop-common-2.3.0-cdh5.1.0.jar!/:na] at org.apache.hadoop.io.retry.RetryInvocationHandler.invoke(RetryInvocationHandler.java:102) ~[hadoop-common-2.3.0-cdh5.1.0.jar!/:na] at com.sun.proxy.$Proxy11.getFileInfo(Unknown Source) ~[na:na] at org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolTranslatorPB.getFileInfo(ClientNamenodeProtocolTranslatorPB.java:701) ~[hadoop-hdfs-2.3.0-cdh5.1.0.jar!/:na] at org.apache.hadoop.hdfs.DFSClient.getFileInfo(DFSClient.java:1758) ~[hadoop-hdfs-2.3.0-cdh5.1.0.jar!/:na] at org.apache.hadoop.hdfs.DistributedFileSystem$17.doCall(DistributedFileSystem.java:1124) ~[hadoop-hdfs-2.…
tagged with: spring-data-hadoop
type: Question
tagged with: hadoop
has comment: http://stackoverflow.com/comment/43330425
has title: Spring Boot & Hadoop: Protocol message tag had invalid wire type
score: 0
answer count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: spring-boot
has comment: http://stackoverflow.com/comment/43330348
tagged with: java

http://stackoverflow.com/comment/43321134
type: AnswerComment
comment on: http://stackoverflow.com/a/27440669
score: 0
type: Comment
has text: I'm new to Java and thanks very much for your answer. Which could be a possible solution? Add to synchronized to setters?

http://stackoverflow.com/a/27434130
accepted answer of: http://stackoverflow.com/q/27433906
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43309402
answers question: http://stackoverflow.com/q/27433906
has comment: http://stackoverflow.com/comment/43309531
upvote count: 1
type: AcceptedAnswer
has body: I am in a good mood, or I would have just pointed you to Egor's comment; the tutorials are designed to show you the efficient ways to do what you want. LinearLayout.LayoutParams boxParams = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); box.setLayoutParams(boxParams); box.setText(R.string.cheese); // if you want checkbox change listener box.setOnCheckedChangedListener(new OnCheckedChangedListener(){ @Override public void onCheckedChanged(RadioGroup group, int checkedId) { if (isChecked){ // perform logic } } }; // if you want on click listener functionality box.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v){ // perform logic } } linearLayout.addView(box); Haven't tested it, don't know if it is bug free (may have missed something or done something wrong), but I can tell you that unless you plan on only doing this functionality and no other functionality you REALLY need to read into the basics of Android.
type: Answer

http://stackoverflow.com/a/27375045
score: 1
upvote count: 1
has body: As said in the javadoc, String.split() doesn't remove the whitespaces at the beginning/end of each line, but at the beginning/end of the whole String: Returns a copy of the string, with leading and trailing whitespace omitted. [...] This method may be used to trim whitespace (as defined above) from the beginning and end of a string. To do that, you can: split() the String and call trim() on each part, just as you have done use a regexp to implement a "multi-lines trim": str = str.replaceAll("(?m)(^[\u0000-\u0020]+|[\u0000-\u0020]+$)", ""); the (?m) flag tells Java to accept the anchors ^ and $ to match at the start and end of each line [\u0000-\u0020] means every character from 0 to 20 (what is defined as being a whitespace by the trim() javadoc. If you want to remove all the whitespace in the String (even if they are not at the beginning/end of line), you can also do that with a regexp (this will also remove the newlines as they are considered as spaces): str = str.replaceAll("[\u0000-\u0020]+", ""); or str = str.replaceAll("\\s+", "");
downvote count: 0
answers question: http://stackoverflow.com/q/27374585
type: Answer

http://stackoverflow.com/comment/43545175
score: 0
has text: I adjusted my implementation and it seems to work very nice. Unfortunately, I will have write my own lexer (jflex), since the one that comes with [Mathematica](http://reference.wolfram.com/language/JLink/ref/java/com/wolfram/jlink/ui/SyntaxTokenizer.html) isn't fast enough for very long messages. Here is [a first screenshot](https://i.sstatic.net/vY8QZ.png). Anyway, thanks for all the help.
type: Comment
comment on: http://stackoverflow.com/a/27489600
type: AnswerComment

http://stackoverflow.com/comment/43141632
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27343059
type: Comment
has text: I feel like you should also add in the fact that the try-catch statement should, itself, be inside the if-statement.

http://stackoverflow.com/a/27363657
downvote count: 1
answers question: http://stackoverflow.com/q/27363601
score: 1
has body: You can divide by 5 and return the integral answer.
type: Answer
upvote count: 2

http://stackoverflow.com/q/27350398
has comment: http://stackoverflow.com/comment/43155505
tagged with: collections
type: Question
has answer: http://stackoverflow.com/a/27350627
score: 3
tagged with: java
has comment: http://stackoverflow.com/comment/43155252
upvote count: 3
answer count: 2
tagged with: for-loop
tagged with: arrays
favorite count: 0
tagged with: arraylist
type: UnansweredQuestion
has title: Replace cards from bottom of the deck
has body: I am a beginner to java and have created a 2 class program "VideoPoker" that basically mimics a one-person 5 draw game. In this game, a deck of cards is shuffled and the top 5 cards (of the now shuffled deck) are used to play 5 draw. The user can remove some, all, or none of the 5 cards he/she is given when the cards are dealt. If the user removes a card, it will be removed and replaced with the next top card. I am stuck at the point where a user decides to remove a card. In my program, when someone removes all of the cards or sometimes even only some, card #2 (index 1) and card #4 (index 3) always stay in the next hand (5 cards) print. My attempt is in the code PICTURE BELOW: Deck.java: import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.Random; public class Deck { // Constructing a deck from two arrays String[] suit = { "C", "D", "H", "S" }; String[] rank = { "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K" }; ArrayList&lt;String&gt; deck = new ArrayList&lt;String&gt;(suit.length * rank.length); int currentCard = 0; // Storing public variables int suits = suit.length; int ranks = rank.length; int deckSize = deck.size(); // Constructs a deck with 52 cards public Deck(){ for(int i = 0; i &lt; suits; i ++){ for(int j = 0; j &lt; ranks; j++){ String temp = rank[j] + suit[i]; deck.add(temp); } } } public String toString(){ return Arrays.deepToString(deck.toArray()); } // Fisher-Yates Shuffle public ArrayList&lt;String&gt; shuffle(){ Collections.shuffle(deck); return deck; } public String deal(){ return deck.get(currentCard++); } public String remove(int i){ return deck.remove(i); } public String get(int i){ return deck.get(i); } public ArrayList&lt;String&gt; getList(){ return deck; } } Dealer.java (tester program): import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; public class Dealer { public static void main(String[] args) { Scanner in = new Scanner(System.in); Deck testDeck …
downvote count: 0
has answer: http://stackoverflow.com/a/27350590

http://stackoverflow.com/a/27449318
has body: You could use &lt;c:forEach&gt; but since Java runs on server side, it will only help you to generate plain text that may be used for your JavaScript. By knowing this, you could create a JavaScript string array like this: &lt;script type="text/javascript"&gt; var myJavaScriptArray = [ &lt;c:forEach items="${myArray}" var="elem" varStatus="currentStatus"&gt; "${elem}" &lt;c:if test="${not currentStatus.last}"&gt; , &lt;/c:if&gt; &lt;/c:forEach&gt; ]; &lt;/script&gt; Code above not tested yet.
accepted answer of: http://stackoverflow.com/q/27449140
type: Answer
answers question: http://stackoverflow.com/q/27449140
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27402861
tagged with: object
has answer: http://stackoverflow.com/a/27403005
has comment: http://stackoverflow.com/comment/43281731
tagged with: java
has comment: http://stackoverflow.com/comment/43252708
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27403022
upvote count: 1
downvote count: 1
tagged with: arrays
favorite count: 0
has comment: http://stackoverflow.com/comment/43250422
has comment: http://stackoverflow.com/comment/43250686
has title: Creating an array that stores strings and integers in java
has comment: http://stackoverflow.com/comment/43250339
has body: I would like to create an array that stores the names (String) and values (integer) of company stocks, but I don't know how to go about it.
has answer: http://stackoverflow.com/a/27403133
has comment: http://stackoverflow.com/comment/43250417
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43250327
type: Question

http://stackoverflow.com/q/27359758
has comment: http://stackoverflow.com/comment/43172051
favorite count: 0
has title: Detect Collision in Simple Space Invaders
has comment: http://stackoverflow.com/comment/43173057
has comment: http://stackoverflow.com/comment/43172321
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/43172248
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43172310
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/43171843
answer count: 1
has answer: http://stackoverflow.com/a/27360038
has body: Im using java to create a space invaders game but i seem to be having trouble detecting collisions, here is my game panel, we were given some sample code which i have added to. I have created different classes for each enemy which are extended from the enemy class. import java.awt.Color; import java.awt.Graphics; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.util.ArrayList; import java.util.Iterator; import java.util.Random; import javax.swing.JPanel; import javax.swing.Timer; @SuppressWarnings("serial") public class GamePanel extends JPanel implements ActionListener, KeyListener { private Player player; private Enemy enemy; private Enemy mothership; private Enemy destroyer; private Enemy meteor; private int enemyNumber = 0; private int totalscore = 0; private boolean destroyerspawn = false; private boolean meteorspawn = false; private boolean mothershipstop = false; private boolean meteorstop = false; private boolean destroyerstop = false; private Random random = new Random(); private ArrayList&lt;Enemy&gt; enemyList; Timer redrawTimer; public GamePanel() { // As above commented out until enemy classes have been made enemyList = new ArrayList&lt;Enemy&gt;(); // This starts the time that controls how often the screen is redrawn redrawTimer = new Timer(10, this); } // Method to start the game public void startGame(int width, int height) { // Create player player = new Player(width, height); // Create mothership mothership = new Mothership(width, height, 0, 0); // Create destroyer destroyer = new Destroyers(width, height, 0, 0); // Create meteor meteor = new Meteor(width, height, 0, 0); // Loop to create multiple enemies // Goes through y axis changing the enemy type at each increment for (int y = 0; y &lt; 3; y++) { // Goes through x axis making 6 of each enemy type for (int x = 0; x &lt; 6; x++) { if(y == 0 || y == 3) { enemy = new Martians(width, height, (x * 7…

http://stackoverflow.com/comment/43235597
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27393949
score: 0
has text: @gknicker As incredible as it seems, there actually is a logical explaination. See Andrew's answer.

http://stackoverflow.com/comment/43348061
type: QuestionComment
has text: Install a version of eclipse that supports Java 8. Luna has built in support, and I believe there is an update for Kepler. Any earlier version(s) don't support Java 8 compliance level.
score: 1
comment on: http://stackoverflow.com/q/27455103
type: Comment

http://stackoverflow.com/comment/43285622
has text: `flush()` only pushes the data(if any exists) out of the `BufferedWriter`.
comment on: http://stackoverflow.com/q/27421568
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27349555
downvote count: 0
has comment: http://stackoverflow.com/comment/43154018
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27349420
has body: As far as I can see you put an extra blank in front of your "reverseInput" with reverseInput = " "; Because your reverse string won't start with a char you think (it starts with a blank) the result is not what you really want. Try to delete the blank and retry you code.
answers question: http://stackoverflow.com/q/27349420
type: Answer
has comment: http://stackoverflow.com/comment/43153677
has comment: http://stackoverflow.com/comment/43153859
score: 1
has comment: http://stackoverflow.com/comment/43153736
upvote count: 1

http://stackoverflow.com/a/27446984
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27444901
has body: Gary Russells response is right but my code still had some remaining errors: If you create the Queue with no name, RabbitMQ creates gives it a random unique name. You have to retrieve it the moment you declare the queue and then use this name when declaring the container and the binding For clarity I add the modified code block in its final version: public void subscribe(EventType eventType, AbstractEventConsumer consumer) { Assert.notNull(eventType); Assert.notNull(eventType.toString()); Assert.isTrue(!eventType.toString().isEmpty()); Queue queue=new Queue("", false, true, true); Map&lt;String, Exchange&gt; beanMap=context.getBeansOfType(Exchange.class); if(beanMap!=null&amp;&amp;!beanMap.isEmpty()){ Exchange exchange=null; boolean found=false; for(String key : beanMap.keySet()) { exchange=beanMap.get(key); if(getExchangeName(eventType.toString()).equals(exchange.getName())){ found=true; break; } } if(found){ String queueName=amqpAdmin.declareQueue(queue); amqpAdmin.declareBinding(new Binding(queueName, Binding.DestinationType.QUEUE, exchange.getName(), "", null)); SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); container.setConnectionFactory(connectionFactory); container.setQueueNames(queueName); container.setMessageListener(new MessageListenerAdapter(consumer)); container.start(); }else{ //TODO } } }
answers question: http://stackoverflow.com/q/27444901
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/q/27327202
has comment: http://stackoverflow.com/comment/43120077
favorite count: 0
has comment: http://stackoverflow.com/comment/43114326
answer count: 0
tagged with: scala
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43113749
has comment: http://stackoverflow.com/comment/43113678
has body: I'm trying to implement a fast inverse square root algorithm in Scala. The algorithm involves exploiting the binary representation of a 32-bit floating-point number by applying bitwise and integer operations to its binary representation, as though it were an Int. In other words, I must create an Int out of the binary representation of a Float, not just use a cast operator. I remember doing something similar a while back in Java, and I believe it was done using some static method of Integer. I'm new to Scala, though, and I can't seem to find such a method. How does one do this in Scala?
upvote count: 1
score: 1
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/12087259
downvote count: 0
has title: Use Float as Int (without conversion) in Scala
tagged with: type-conversion
has comment: http://stackoverflow.com/comment/43114832

http://stackoverflow.com/q/27355267
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43167565
type: Question
has title: Add items to the Eclipse toolbar
has answer: http://stackoverflow.com/a/27358661
answer count: 1
downvote count: 0
tagged with: eclipse-plugin
favorite count: 0
has body: I created a sample Eclipse plugin project where I need to add an multiple items to the same item in the menu and toolbar. I succeeded with adding item to items in menu bar, but when I tried to add items to item in toolbar - none of them is working for me. How can I add the items to the existing item in the toolbar? Here is my plugin.xml code: I tried adding the following code to the xml, but also it doesn't worked for me.

http://stackoverflow.com/comment/43301135
type: AnswerComment
comment on: http://stackoverflow.com/a/27429721
type: Comment
has text: @fge Yes, I know what's on your mind. But I wanted some variations. So I wrote that ;)
score: 0

http://stackoverflow.com/comment/43352184
comment on: http://stackoverflow.com/q/27454412
score: 0
type: Comment
type: QuestionComment
has text: `Drive service` does compile?

linux
tags question: http://stackoverflow.com/q/27348169
tags question: http://stackoverflow.com/q/27355554
tags question: http://stackoverflow.com/q/27418849
tags question: http://stackoverflow.com/q/27353060
tags question: http://stackoverflow.com/q/27390922
tags question: http://stackoverflow.com/q/27380943
tags question: http://stackoverflow.com/q/27361948
tags question: http://stackoverflow.com/q/27356859
tags question: http://stackoverflow.com/q/27326819
tags question: http://stackoverflow.com/q/27340460
type: Tag
tags question: http://stackoverflow.com/q/27333253
tags question: http://stackoverflow.com/q/27375095
tags question: http://stackoverflow.com/q/27424409
tags question: http://stackoverflow.com/q/27347778
tags question: http://stackoverflow.com/q/27405356
tags question: http://stackoverflow.com/q/27409989
tags question: http://stackoverflow.com/q/27314896
tag name: linux
tags question: http://stackoverflow.com/q/27333829
tags question: http://stackoverflow.com/q/27339555
tags question: http://stackoverflow.com/q/27468844
tags question: http://stackoverflow.com/q/27318788
tags question: http://stackoverflow.com/q/27365318
tags question: http://stackoverflow.com/q/27370630
tags question: http://stackoverflow.com/q/27430340
tags question: http://stackoverflow.com/q/27344786
tags question: http://stackoverflow.com/q/27423541

http://stackoverflow.com/a/27335106
has body: If you don't override the equals() method, equals() and == do the same thing, check the equality of the references. You can make the replacement in this case, since method() will return the same reference as A.STATIC_FIELD when it is true. See this answer.
type: Answer
answers question: http://stackoverflow.com/q/27335052
score: 0

http://stackoverflow.com/a/27369604
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43190947
has body: As @tsnorri mentioned in comment, you should simply declare Rectas class out of Shapeone. public class Shape { } public class Rect extends Shape { //rect instance variables public Rect(){ super(); System.out.print("Youve made a rect within shape"); } } In case you want to learn more about nested classes in Java this is a good starting point: http://docs.oracle.com/javase/tutorial/java/javaOO/nested.html Edit (working example) In general I recommend you some reading about basics of OO programming and JAVA in general. here's a working example of adding both Shape and Rect to an ArrayList. import java.util.ArrayList; class ImageMaker { static ArrayList&lt;Shape&gt; shapes = new ArrayList&lt;Shape&gt;();//all the shapes contained in the image public static void main(String args[]) { shapes.add(new Shape()); shapes.add(new Rect()); } public static class Shape { System.out.print("Created new Shape"); } public static class Rect extends Shape { //rect instance variables public Rect(){ super(); System.out.print("You've made a rect within shape"); } } } cheers
has comment: http://stackoverflow.com/comment/43191417
has comment: http://stackoverflow.com/comment/43191306
type: Answer
has comment: http://stackoverflow.com/comment/43191219
accepted answer of: http://stackoverflow.com/q/27369512
answers question: http://stackoverflow.com/q/27369512
has comment: http://stackoverflow.com/comment/43191506

http://stackoverflow.com/a/27514965
answers question: http://stackoverflow.com/q/27387629
type: Answer
has body: Yes, you can use different Vaadin versions in Liferay, if you are careful: Package the Vaadin into the portlet war itself. Use the latest Vaadin 7.x version if possible (currently 7.3.6) Don't put two Vaadin portlets with different versions on the same page. The client-side GWT most likely does not work correctly. Easiest is to setup the Liferay IDE and use Vaadin Maven archetype to generate your project. Note: most reliable is to use the archetype with latest Vaadin version e.g. com.vaadin:vaadin-archetype-liferay-portlet:7.3.6. Also make sure you create a Maven profile for you local Liferay setup.
score: 0

http://stackoverflow.com/comment/84042942
score: 0
type: Comment
has text: how did you configure your config?
comment on: http://stackoverflow.com/a/27625376
type: AnswerComment

http://stackoverflow.com/q/27366903
answer count: 2
has body: I am using GLSL shaders in a small Java OpenGL project I am making, and I am trying to come up with a well-written object-oriented way of organising my code. So far, I have a class called Model, which can contain multiple meshes, each of which has its own texture and material (a material being a set of parameters to describe ambient, diffuse, specular, blending, etc.). In order to achieve this, I understand that I could pass uniform variables to the shader every time I need to change material. However, the drawing takes place in the model's draw() method. Does that mean that each instance of the Model class needs to have a particular shader associated with it? Also, I have a Camera class, which produces a matrix that will transform vertices simulate the camera's pitch, yaw, and position. This matrix then needs to uploaded to the shader as the view matrix. Doesn't that mean that I need to upload this matrix to every shader that I use? So if each Model can have its own shader, how can I upload the camera's view matrix to all of them? And even so, isn't it inefficient for every single model to have its own shader? If you wanted to draw a certain model lots of times, then you would be use()ing the shader and uploading a matrix to the shader every time you drew it. I'm really struggling to come up with an object-oriented solution that links multiple shaders, multiple objects and multiple materials. Any help is appreciated.
has title: Multiple shaders, objects and materials with OOP
downvote count: 1
upvote count: 4
favorite count: 0
tagged with: shader
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27367564
score: 3
tagged with: oop
tagged with: opengl
tagged with: glsl
tagged with: java
has answer: http://stackoverflow.com/a/27367982
type: Question

http://stackoverflow.com/q/27326570
has answer: http://stackoverflow.com/a/27326717
has body: I am basically looking for a unit testing framework, which I can use to compare POJOs which don't override equals and hascode methods. I had a look at JUnit, Test NG and Mockito but they don't seem to solve the purpose. For example consider the code below : public class CarBean { private String brand; private String color; public CarBean (){ } public CarBean (String brand, String color){ this.brand= brand; this.color= color; } /** * @return the brand */ public String getBrand() { return brand; } /** * @param the brand to set */ public void setBrand(String brand) { this.brand= brand; } /** * @return the color */ public String getColor() { return color; } /** * @param the color to set */ public void setColor(String color) { this.color= color; } } The POJO CarBean represents a real world car. It has two parameters, brand and color. Now, suppose you have two car objects as below : CarBean car1 = new CarBean("Ford","Black"); CarBean car2 = new CarBean("Ford","Black"); Both the objects have same parameter values. But when you compare this using equals, it returns false : car1.equals(car2); // This returns false Now I need to unit test a method that returns CarBean object. In this scenario I would either need to compare the carbean attributes one by one or I would need to implement equals() and hashcode() methods. So my question is - Is there already a unit testing framework which can handle this ?
tagged with: mockito
has answer: http://stackoverflow.com/a/37988260
upvote count: 14
has comment: http://stackoverflow.com/comment/43127058
tagged with: junit
favorite count: 0
has title: How can I compare POJOs by their fields reflectively
possible better answer: http://stackoverflow.com/a/37988260
has comment: http://stackoverflow.com/comment/43112306
answer count: 4
tagged with: testng
has comment: http://stackoverflow.com/comment/73638559
score: 14
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/73638922
downvote count: 0
has answer: http://stackoverflow.com/a/27368600
accepted answer: http://stackoverflow.com/a/27368600
tagged with: java
tagged with: unit-testing
type: Question
has answer: http://stackoverflow.com/a/27335492

http://stackoverflow.com/comment/43310917
type: QuestionComment
comment on: http://stackoverflow.com/q/27435006
has text: can you post up .edgeIs function as well?
score: 0
type: Comment

http://stackoverflow.com/q/27392224
answer count: 1
downvote count: 0
tagged with: jax-rs
favorite count: 0
linked to: http://stackoverflow.com/q/27427429
has title: DropWizard Auth by Example
tagged with: basic-authentication
has answer: http://stackoverflow.com/a/27393546
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27393546
upvote count: 21
type: Question
score: 21
has body: I'm trying to understand how authentication and authorization work in DropWizard. I've read their auth guide as well as the dropwizard-security project on GitHub, but feel like I'm still missing a few important concepts. public class SimpleCredential { private String password; public SimpleCredential(String password) { super(); this.password = password; } } public class SimplePrincipal { pivate String username; public SimplePrincipal(String username) { super(); this.username = username; } } public class SimpleAuthenticator implements Authenticator&lt;SimpleCredential, SimplePrincipal&gt; { @Override public Optional&lt;SimplePrincipal&gt; authenticate(SimpleCredential credential) throws AuthenticationException { if(!"12345".equals(credential.getPassword())) { throw new AuthenticationException("Sign in failed."); } Optional.fromNullable(new SimplePrincipal("simple_user")); } } And then in my Application subclass: @Override public void run(BackendConfiguration configuration, Environment environment) throws Exception { environment.jersey().register(new BasicAuthProvider&lt;SimplePrincipal&gt;(new SimpleAuthenticator(), "SUPER SECRET STUFF")); } And then in a resource method: @GET @Path("address/{address_id}") @Override public Address getAddress(@Auth @PathParam("address_id") Long id) { addressDao.getAddressById(id); } I think I have this half-configured correctly for basic auth, but not understanding the role that SimpleCredential and SimplePrincipal play. Specifically: How do I set basic auth username/password from the Jersey/JAX-RS client? What role do SimpleCredential and SimplePrincipal play with basic auth? Do I need to add anything to them or other classes to make basic auth work such that the only valid username is simple_user and the only valid password is 12345? How do I enforce access/authroization/roles via SimplePrincipal? Or is the concept of authorization non-existent with web services?
tagged with: java
tagged with: jersey
tagged with: dropwizard

http://stackoverflow.com/comment/43788504
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27393785
has text: (1) That `&#38;` can be safely - and more clearly - replaced with `&amp;`. (2) Do you have command line access to that linux machine? (3) When you said your IP is whitelisted, did you mean its internal IP (the one displayed with `ifconfig`) or its external one (one displayed with services like whatismyip.com)? If you are behind a firewall doing NAT the two may not be the same.
score: 0

http://stackoverflow.com/comment/43367752
type: AnswerComment
comment on: http://stackoverflow.com/a/27465698
type: Comment
has text: Please, add the `Client` class implementation. Otherwise I won't be able to help.
score: 0

http://stackoverflow.com/a/27537045
answers question: http://stackoverflow.com/q/27426869
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27426869
has comment: http://stackoverflow.com/comment/43935027
upvote count: 3
type: Answer
downvote count: 0
score: 3
has comment: http://stackoverflow.com/comment/43927700
has body: To add to Chri's answer, JavaScript can't actually track the full value of a long! The most precise number it can track is the equivalent of a Java double (64-bit IEEE 754 floating point), and there are some legal values that when cast to double and back again, are no longer the same number! If you are only reading the property and you don't care if you have enough precision to actually store it, the unsafe long annotation will work. Use double if you can, or use String if you want a db ID or whatever that doesnt change you when you look at it funny through JS...

http://stackoverflow.com/comment/43320846
type: AnswerComment
type: Comment
has text: **What does this means** "If an interface has no direct super-interfaces, then the interface implicitly declares a public abstract member method m with signature s, return type r, and throws clause t corresponding to each public instance method m with signature s, return type r, and throws clause t declared in Object, unless an abstract method with the same signature, same return type, and a compatible throws clause is explicitly declared by the interface." **If I disassemble the class using javap it only shows explicit methods even I don't extend any super-interfaces?**
comment on: http://stackoverflow.com/a/27440411
score: 0

http://stackoverflow.com/q/27356227
has title: Result of deleting object from hibernate database
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27358066
has comment: http://stackoverflow.com/comment/43165793
type: Question
tagged with: java
tagged with: hibernate
tagged with: database
has comment: http://stackoverflow.com/comment/43165146
has comment: http://stackoverflow.com/comment/43165288
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27358066
possible better answer: http://stackoverflow.com/a/27356360
has body: I'm curious what should be result when I create object, Then I delete object and then I try to load this object from database. I guess it should be "null". In one table I receive "null" in second table i receive nothing. Create: public void createPerson(Person p) { session.beginTransaction(); session.save(p); session.getTransaction().commit(); logger.info("Person saved successfully!"); } Delete: public void deletePerson(int id) { session.beginTransaction(); Person p = getPersonById(id); if(p != null){ session.delete(p); session.getTransaction().commit(); } if(getPersonById(id) == null){ logger.info("Person deleted successfully!"); }else{ logger.info("Something went wrong! Person hasn't been deleted!"); } } and load: public Person getPersonById(int id) { session.beginTransaction(); Person p = (Person) session.load(Person.class, id); logger.info("Person loaded successfully!"); return p; } And I receive nothing. What is the problem?
has answer: http://stackoverflow.com/a/27356360

http://stackoverflow.com/comment/43202487
score: 0
type: AnswerComment
has text: @ankurlu That's correct. They are initialized before the constructor is executed. Of course, the constructor can change those default values.
type: Comment
comment on: http://stackoverflow.com/a/27375441

http://stackoverflow.com/q/27344268
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27344311
has comment: http://stackoverflow.com/comment/43143932
has body: Very new to Java so all help is appreciated, but please give the more direct answer possible. I am trying to change a System.out.println statement to one that will be displayed in a JOptionPane. This is my first attempt at GUI, and find myself hopelessly lost. I have Strings being printed through several methods in order to display one snippet of output. The part of the output I want to go in one pane, so I think the easiest way might be to concatenate a string. I have an ArrayList hard that holds a Card value. I overloaded the toString method in Card for the ranks, and the Suit enum that the Card uses returns Strings ("Heart", Spade", etc.) for(int x = 0; x &lt; hand.size(); x++){ System.out.println(hand.get(x)); } //correctly prints the code I was trying to do String handString = ""; for(int x = 0; x &lt; hand.size(); x++){ handString = handString.concat(hand.get(x)); //also tried concat(toString(hand.get(x)) } Can anyone tell me why I am not able to change the Card toString and why it prints to the console, but why I can't put it to a string? I have a feeling this is very obvious but nothing I can find online seems to help with my combination of enums and class objects. Also, how would I go about turning several printings to the console to one printing in a JOptionPane?
has answer: http://stackoverflow.com/a/27344319
tagged with: string-concatenation
score: 0
answer count: 2
has title: system.out of object to string
possible better answer: http://stackoverflow.com/a/27344319
accepted answer: http://stackoverflow.com/a/27344311
tagged with: system.out
has comment: http://stackoverflow.com/comment/43144162
tagged with: joptionpane
type: AnsweredQuestion

http://stackoverflow.com/comment/43374019
comment on: http://stackoverflow.com/q/27469423
type: Comment
type: QuestionComment
has text: There are two Change objects, one created in main and another one in NewText. One is visible, the other one just lurks in memory.
score: 0

http://stackoverflow.com/comment/43096045
score: 0
type: Comment
type: QuestionComment
has text: Could you please edit the code in your question into an [MCVE](http://stackoverflow.com/help/mcve) ?
comment on: http://stackoverflow.com/q/27318280

http://stackoverflow.com/comment/43358710
type: QuestionComment
type: Comment
has text: Double d=(Double)123400/100 will not compile
comment on: http://stackoverflow.com/q/27461118
score: 0

http://stackoverflow.com/q/27448899
upvote count: 1
has body: I am not able to play mp3 that contains large png file as a cover (thumbnail) image using javafx.scene.media.MediaPlayer class. You can find in attached archive example mp3 files and NetBeans project with compiled application that you can use to reproduce my issue. As I try opening mp3, MediaPlayer does not throw any exceptions, however the file is not played. Mp3 file without cover is playing ok and if I include in mp3 the same cover but in jpg format it is also playing fine. I can play mp3 with large png cover using MPC-HC x64 and with standard Windows Media Player. I tested this on Windows 7 Ultimate 64 bit, using Java 8 Update 25, build 1.8.0_25-b18. In my scenario changing mp3 file itself is not feasible. I would greatly appreciate any hint towards workaround that does not involve changing contents of mp3 file. You can find the mentioned archive here: https://www.dropbox.com/s/1vzw6hqteza0164/BugReproduction.zip?dl=0 P.S. you can change mp3 cover image with mp3tag application (http://www.mp3tag.de/en/download.html).
favorite count: 0
downvote count: 0
has answer: http://stackoverflow.com/a/27467279
accepted answer: http://stackoverflow.com/a/27467279
has comment: http://stackoverflow.com/comment/43344009
type: AnsweredQuestion
has title: JavaFX MediaPlayer does not play mp3 with large png cover
score: 1
tagged with: java
tagged with: javafx
type: Question
answer count: 1
tagged with: media

http://stackoverflow.com/q/27349332
has body: I am having issues creating a java binding library in Xamarin from the Sinch Android API. It seems like its not linking all the class files contained in the jar file. obj\Debug\generated\src\Com.Sinch.Android.Rtc.Internal.Client.ConfigRefresher.cs(9,87,9,121): error CS0234: The type or namespace name 'UserAgentMethodInvocationScheduler' does not exist in the namespace 'Com.Sinch.Android.Rtc.Internal.Client' (are you missing an assembly reference?) obj\Debug\generated\src\Com.Sinch.Android.Rtc.Internal.Client.HouseKeeper.cs(9,83,9,117): error CS0234: The type or namespace name 'UserAgentMethodInvocationScheduler' does not exist in the namespace 'Com.Sinch.Android.Rtc.Internal.Client' (are you missing an assembly reference?) obj\Debug\generated\src\Com.Rebtel.Repackaged.Com.Google.Gson.Internal.Bind.TypeAdapters.cs(942,25,942,30): error CS0111: Type 'Com.Rebtel.Repackaged.Com.Google.Gson.Internal.Bind.TypeAdapters.EnumTypeAdapter' already defines a member called 'Write' with the same parameter types I am using the 3.4.1 Android API here: https://www.sinch.com/downloads/
has comment: http://stackoverflow.com/comment/45652951
tagged with: xamarin
has comment: http://stackoverflow.com/comment/57195545
answer count: 1
has comment: http://stackoverflow.com/comment/43170639
favorite count: 0
has answer: http://stackoverflow.com/a/49620022
type: UnansweredQuestion
has title: Xamarin Java Binding Library - Sinch
tagged with: sinch
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/45149414
has comment: http://stackoverflow.com/comment/50097607
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43212118
tagged with: api
has comment: http://stackoverflow.com/comment/44977583
downvote count: 0
has comment: http://stackoverflow.com/comment/48960242
tagged with: binding

http://stackoverflow.com/q/27419175
has body: I am using Maven to build our application. So the war name will be MyTest-1.00-SNAPSHOT1.0 .If I deploy the same in Tomcat I have use the URL as //localhost:8080/MyTest-1.00-SNAPSHOT1.0 but I need to set the context path MyTest eventhough deployed WAR name as MyTest-1.00-SNAPSHOT1.0. I need the URL will be //localhost:8080/MyTest always even though the WAR name has version or etc. Suggest me to achieve this scenario.
has answer: http://stackoverflow.com/a/62224091
has comment: http://stackoverflow.com/comment/43281778
has comment: http://stackoverflow.com/comment/43282405
type: UnansweredQuestion
tagged with: maven
tagged with: java
has title: Set context path irrespective for WAR version name in Tomcat
score: 4
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/27419548
answer count: 2
downvote count: 0
tagged with: tomcat
tagged with: contextpath
favorite count: 0

http://stackoverflow.com/comment/43302175
type: Comment
comment on: http://stackoverflow.com/a/27430413
has text: so would I need to import some more libraries too then?
type: AnswerComment
score: 0

http://stackoverflow.com/q/27374546
accepted answer: http://stackoverflow.com/a/27405120
tagged with: wsdl
has comment: http://stackoverflow.com/comment/43199533
tagged with: soap
possible better answer: http://stackoverflow.com/a/27374754
favorite count: 0
upvote count: 1
has comment: http://stackoverflow.com/comment/43199427
type: AnsweredQuestion
has body: I have a problem with a SOAP Server written in JAVA, the project is running as a windows service and not as a webserver (e.g. GLASSFISH). So the problem is, everytime I make a request from a C# .NET client, the JAVA SOAP server is not able to parse the request. The called function gets a NULL value as input parameter. The communictaion with JAVA clients, SoapUI, aso. works perfectly but the .NET (C#) clients are sending maleformed requests I think. Because the project is already existing and installed a lot of times, I can't develope it in C#. I've read a lot of threads with similar problems, but I couldn't find any solution for my case. I just wrote some simple test cases to show you the problem in a short way. JAVA Code: main.java //... Endpoint endpoint = Endpoint.create(new WS()); endpoint.publish("http://0.0.0.0:8081/test"); //... WS.java //... @WebService(serviceName = "WS") @SOAPBinding(style = SOAPBinding.Style.RPC) public class WS { @WebMethod(operationName = "echo") public String echo(@WebParam(name = "val") String val) { return val; } } The WSDL: <definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://webj/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://webj/" name="WS"> <types/> <part name="val" type="xsd:string"/> <part name="return" type="xsd:string"/> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/> <soap:operation soapAction=""/> <soap:body use="literal" namespace="http://webj/"/> <soap:body use="literal" namespace="http://webj/"/> <soap:address location="http://xxx:8081/test"/> C# Request <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas…
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27405120
type: Question
tagged with: c#
answer count: 2
downvote count: 0
tagged with: .net
has answer: http://stackoverflow.com/a/27374754
has comment: http://stackoverflow.com/comment/43254822
has comment: http://stackoverflow.com/comment/43208981
has title: SOAP Server in JAVA <-> SOAP Client in C#

http://stackoverflow.com/q/27412437
answer count: 0
score: 1
tagged with: java
tagged with: mapreduce
has title: An error when run wordcount program in Hadoop?
has comment: http://stackoverflow.com/comment/43269200
type: Question
tagged with: hadoop
has body: I run wordcount program using Hadoop cdh4 ,I got an error ,couldn't understand the problem it says "file already exist" , I deleted the output directory ,and replace it ,but still the same error appears! Please help! 14/12/11 02:25:25 WARN mapred.JobClient: Use GenericOptionsParser for parsing the arguments. Applications should implement Tool for the same. 14/12/11 02:25:26 INFO mapred.JobClient: Cleaning up the staging area hdfs://localhost:8020/var/lib/hadoop-hdfs/cache/mapred/mapred/staging/training/.staging/job_201412110028_0010 14/12/11 02:25:26 ERROR security.UserGroupInformation: PriviledgedActionException as:training (auth:SIMPLE) cause:org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory hdfs://localhost:8020/user/training/wordcountout already exists Exception in thread "main" org.apache.hadoop.mapred.FileAlreadyExistsException: Output directory hdfs://localhost:8020/user/training/wordcountout already exists at org.apache.hadoop.mapred.FileOutputFormat.checkOutputSpecs(FileOutputFormat.java:117) at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:986) at org.apache.hadoop.mapred.JobClient$2.run(JobClient.java:945) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:415) at org.apache.hadoop.security.UserGroupInformation.doAs(UserGroupInformation.java:1408) at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:945) at org.apache.hadoop.mapred.JobClient.submitJob(JobClient.java:919) at org.apache.hadoop.mapred.JobClient.runJob(JobClient.java:1368) at wordcount1.WordCount.run(WordCount.java:45) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70) at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:84) at wordcount1.WordCount.main(WordCount.java:51) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Delegatin…
has comment: http://stackoverflow.com/comment/43299959
downvote count: 0
has comment: http://stackoverflow.com/comment/43278361
favorite count: 0
type: UnansweredQuestion
upvote count: 1

http://stackoverflow.com/comment/43128004
type: QuestionComment
has text: Excellent - glad to hear it. What was the CLASSPATH that worked for you? We should post it as an answer in order to close out this question.
score: 0
comment on: http://stackoverflow.com/q/27325221
type: Comment

http://stackoverflow.com/comment/43217884
type: AnswerComment
score: 0
has text: Thank you so very much both of you guys now it works perfectly and I also learned a lot from it! Also Mr Richer ;) your German seems to be just fine I would have taken longer to figure out the functioning of that code!
type: Comment
comment on: http://stackoverflow.com/a/27367308

http://stackoverflow.com/comment/43314856
type: QuestionComment
comment on: http://stackoverflow.com/q/27436917
has text: Good luck with that.
score: 0
type: Comment

http://stackoverflow.com/a/27398904
answers question: http://stackoverflow.com/q/27398861
has body: In case of System.out.println(t.s);, property s of t, which is of type Exampleclass is being accessed and printed. But a[1], which is an Object, has no such property.
type: Answer
has comment: http://stackoverflow.com/comment/43243299
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43243454
has comment: http://stackoverflow.com/comment/43243675
has comment: http://stackoverflow.com/comment/43243555
upvote count: 1

http://stackoverflow.com/comment/43266413
score: 0
type: QuestionComment
type: Comment
has text: @MikeLaren Specifically, the error is: error: package com.foo.bar.androidlib does not exist. Android Studio can find these packages no problem, and it is able to first compile them, but during linking it runs into trouble.
comment on: http://stackoverflow.com/q/27409786

http://stackoverflow.com/comment/43245544
type: QuestionComment
comment on: http://stackoverflow.com/q/27399631
has text: Do you have another controller mapped to URL /businnesFunction? If that's the case then, Spring will try to find /businessFunction/list inside that controller. In other words, make sure the {service} name does not conflict with any other request mapped URLs.
score: 0
type: Comment

http://stackoverflow.com/a/27470950
downvote count: 0
type: Answer
has body: This solution took me a few attempts of trying, but now it works. It seems to do what you want, and the code appears quite straight-forward to me (at least when I read it now). I'm using regular expressions to do the text matching (classes Pattern and Matcher), since they make the code pretty simple. Therefore the wildcard pattern first needs to be translated to a regular expression by the compileWildcard method. package so27470328; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.swing.JFrame; import javax.swing.JTextArea; import javax.swing.JTextField; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.text.BadLocationException; import javax.swing.text.DefaultHighlighter; import javax.swing.text.DefaultHighlighter.DefaultHighlightPainter; import javax.swing.text.Highlighter; import javax.swing.text.Highlighter.HighlightPainter; public class Main { public static void main(String[] args) { final JTextArea textarea = new JTextArea(25, 80); textarea.setText("I'm trying to make a word search engine ... method."); Highlighter highlighter = new DefaultHighlighter(); final DefaultHighlightPainter painter = new DefaultHighlightPainter(Color.pink); textarea.setHighlighter(highlighter); final JTextField highlight = new JTextField(80); highlight.getDocument().addDocumentListener(new DocumentListener() { private void updateHighlights() { highlight(textarea, highlight.getText(), painter); } @Override public void removeUpdate(DocumentEvent e) { updateHighlights(); } @Override public void insertUpdate(DocumentEvent e) { updateHighlights(); } @Override public void changedUpdate(DocumentEvent e) { updateHighlights(); } }); JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setLayout(new BorderLayout()); frame.add(highlight, BorderLayout.NORTH); frame.add(textarea, BorderLayout.CENTER);…
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27470328

http://stackoverflow.com/comment/43360683
type: Comment
type: QuestionComment
score: 0
has text: Are you not able to use simple Java Serialization?
comment on: http://stackoverflow.com/q/27460873

http://stackoverflow.com/comment/43447572
score: 0
has text: @Holger Well, I have a 1 million rows in the database which I fetch and do work with asynchronously. Rather than fetching 1 million rows, I fetch 500 and have 20 threads. Really, my question was more about finding out when those 20 threads have worked on 70% of the 500 to fetch more from the database but all threads are in reality busy all the time. I think my edit was a bit incorrectly formulated. Makes sense now? :) I have supplied my answer below.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27462465

http://stackoverflow.com/comment/43318932
type: Comment
has text: See http://stackoverflow.com/questions/3504870/how-to-test-if-one-java-class-extends-another-at-runtime.
score: 0
comment on: http://stackoverflow.com/q/27439532
type: QuestionComment

http://stackoverflow.com/comment/43345736
comment on: http://stackoverflow.com/a/27453593
has text: The method `getValues` is declared to return an `int` value but is returning nothing. Declare it as `void` instead of `int`.
type: AnswerComment
score: 0
type: Comment

ruby-on-rails-4
type: Tag
tags question: http://stackoverflow.com/q/27337759
tag name: ruby-on-rails-4

http://stackoverflow.com/q/27470651
accepted answer: http://stackoverflow.com/a/27493326
has body: The question: is it possible somehow to retrieve the json parser from withing POJO objects and/or POJOcreators (for reporting/debugging purposes) without writing a complete custom deserializer? Let me explain in the example. Currently I'm deserializing JSON using @JSonPOJOBuilder and mixins: public interface Custom { ... } protected class CustomImpl implements Custom { CustomImpl(String prop1, Integer prop2,...) {} ... } @JsonDeserialize(builder=CustomBuilder.class) public abstract class CustomMixIn { public CustomMixIn( JsonProperty("prop1") String prop1, JsonProperty("prop2") Integer prop2, ... ) {} } @JsonPOJOBuilder(buildMethodName="build") public class CustomBuilder { public String prop1; public Integer prop2 ... public Custom build() { // validate fields, perform other prerequisite actions return new CustomImpl(prop1, prop2,...); } } ... ObjectMapper mapper = new ObjectMapper(); mapper.addMixInAnnotations(Custom.class, CustomMixIn.class); As one may see everything is pretty straightforward and it actually works. However I would like to have a reference to the currently active parser from within CustomBuilder.build() method to be able to correctly report of problems/features of the data being loaded. Throwing an exception isn't suitable because those things I'd like to report aren't errors, just "some specific properties" of the data.
tagged with: jackson
has title: How to retrieve parser context while deserializing JSON with Jackson and @JSonPOJOBuilder
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27493326
type: AnsweredQuestion
score: 2
upvote count: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question

http://stackoverflow.com/comment/43149198
comment on: http://stackoverflow.com/q/27347209
has text: `if (0<i<3 && 6<i<9){` isn't legal. Not sure what you're trying to do but if you want to say that `i` should be between 0 and 3 for example, then you need to write it as `if (i > 0 && i < 3)` and go from there. You can have as many &&s or ||s as you need.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/47243262
score: 0
comment on: http://stackoverflow.com/a/28499159
type: AnswerComment
type: Comment
has text: Thanks for sharing Daniel...do you by any change have a fully working exampe on github? And btw, did you manage to run all API modules on the same server/process?

http://stackoverflow.com/a/27377304
score: 0
type: Answer
has body: A couple of things you might like to think about. For one, you're assuming that each token appears on a new line. That might be true for what you're doing; but it would be more flexible to use input.next() rather than input.nextLine(). That will read the next token, without caring whether it's on a new line or not. To read in the next token and determine whether it's an integer or not, the easiest thing is to look at input.hasNextInt(). That will tell you, without advancing past the token, whether the next token can be parsed as an integer or not. If it is, you can read it with input.nextInt(); if not, read a String with input.next().
answers question: http://stackoverflow.com/q/27377100

http://stackoverflow.com/a/27448456
score: 2
downvote count: 0
upvote count: 2
answers question: http://stackoverflow.com/q/27448158
has body: A very efficient way to do this, especially with a large number of points, is to use an Oct-tree (a three-dimensional Quad-tree) as a data structure. See the Wikipedia article for an introduction. This is a 3-dimensional spatial index, allowing you to quickly retrieve points within a certain three-dimensional (rectangular) range. If you want to reduce the number of points further, you can use your distance formula to filter down the points you found further; but the number of points should already be so significantly reduced by using the Oct-tree spatial index that this doesn't subtract much from the performance.
type: Answer

http://stackoverflow.com/a/27433953
has body: So, if you mean "add the d to the end of the numeral"...then there's no difference. In Java, by default, all floating-point literals are double. So these two literals are the same thing: 41.32 41.32d If you were to add f instead of d, then one would be a float instead of a double. You can change an int to a double in this way, too: 113 113d If you're multiplying an int with a double to get a double, then the int is being promoted to a double so that the floating-point arithmetic can take place. From the JLS: Widening primitive conversion (§5.1.2) is applied to convert either or both operands as specified by the following rules: If either operand is of type double, the other is converted to double. Otherwise, if either operand is of type float, the other is converted to float. Otherwise, if either operand is of type long, the other is converted to long. Otherwise, both operands are converted to type int.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27433900
type: Answer
upvote count: 3
score: 3
accepted answer of: http://stackoverflow.com/q/27433900

http://stackoverflow.com/comment/43120630
type: Comment
comment on: http://stackoverflow.com/q/27331424
score: 2
has text: Because the value of `yaxisCounter` is greater than `boardMatrix.length`, so `yaxisCounter < boardMatrix.length` is evaluated to false.
type: QuestionComment

http://stackoverflow.com/a/27373271
type: Answer
accepted answer of: http://stackoverflow.com/q/27360969
answers question: http://stackoverflow.com/q/27360969
has comment: http://stackoverflow.com/comment/72720548
has body: Its because of the following line in the xsd &lt;xs:attribute type="xs:float" name="value" use="optional"/&gt; since value is already defined in 'datatypes.jar' somewhere
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/72707436

http://stackoverflow.com/comment/43275615
type: QuestionComment
comment on: http://stackoverflow.com/q/27415752
has text: @azurefrog I notice that, renew the program above, problem still not be unsolved.
score: 0
type: Comment

http://stackoverflow.com/a/27417362
type: Answer
answers question: http://stackoverflow.com/q/27375644
has body: Pass "org.eclipse.jdt.launching.macosx" plugin in your eclipse while create Product build. It's Working for me. Thanks.
score: 0

http://stackoverflow.com/q/27368074
tagged with: redis
has title: Redis Mass Insertion HSET command
has comment: http://stackoverflow.com/comment/43209496
type: UnansweredQuestion
downvote count: 1
linked to: http://stackoverflow.com/q/18345242
score: 2
has body: I have been looking all over SO for a working solution but no luck :/ I want to perform the mass insertion using the pipelining feature of redis-cli but I am not able to do so. I have a JAVA code snippet which create a file containing all the commands to run. String add = "*4\r\n$4\r\nHSET\r\n$22\r\ndiscountProgramOffers\r\n$" + key.getBytes().length + "\r\n" + key + "\r\n$" + json.getBytes().length + "\r\n" + json + "\r\n"; System.out.println(add); In the above code, I followed mass insertion link present at Redis Documentation site. And this is a demo String which is getting created. *4\r\n$4\r\nHSET\r\n$22\r\ndiscountProgramOffers\r\n$5\r\nmykey\r\n$7\r\nmyvalue\r\n When I run the file which is created by the snippet, sometimes I get nothing, and sometimes I get this error: Error writing to the server: Connection reset by peer EX: echo -e "$(cat massInsert.txt)" | redis/src/redis-cli --pipe Error writing to the server: Connection reset by peer Am I doing something wrong?? Please help. FYI: I referred to these questions: Redis Mass Insertion redis - mass inserts and counters
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/43193005
has answer: http://stackoverflow.com/a/74531227
type: Question
has answer: http://stackoverflow.com/a/74523767
answer count: 2
tagged with: pipelining
linked to: http://stackoverflow.com/q/18870623
tagged with: shell
favorite count: 0
has comment: http://stackoverflow.com/comment/43214149

http://stackoverflow.com/comment/43292165
score: 0
type: Comment
has text: Oh, unfortunately then you will have to look at the code and use memory profiler. Without seeing the code, one cannot anticipate where is the memory leak happening. Plus Java takes care of memory management, so either it is some small mistake or bad design, that's all I can help. :-( Or if I had access to project, I could have checked in free time on weekend.
type: QuestionComment
comment on: http://stackoverflow.com/q/27424315

http://stackoverflow.com/q/27363601
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43179180
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/27363657
upvote count: 1
has answer: http://stackoverflow.com/a/27363809
has comment: http://stackoverflow.com/comment/43179187
type: Question
has answer: http://stackoverflow.com/a/27364241
tagged with: conditional-statements
tagged with: if-statement
accepted answer: http://stackoverflow.com/a/27363701
has answer: http://stackoverflow.com/a/27363799
has body: I have a double and I have multiple checks in if statements to check in the value is passed in is between two values. eg double d = 5.0; if(d &gt;= 0.0 &amp;&amp; d &lt; 5.0) { return 0; } if(d &gt;= 5.0 &amp;&amp; d &lt; 10.0) { return 1; } if(d &gt;= 10.0 &amp;&amp; d &lt; 15.0) { return 2; } I have about 15 of these if checks and it seems very inefficient and thought id ask if there was a more efficient way of computing the return value?
has comment: http://stackoverflow.com/comment/43179197
has title: More efficient way of doing multiple if else statements
has answer: http://stackoverflow.com/a/27363657
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/27363701
favorite count: 0
has comment: http://stackoverflow.com/comment/43179086
has answer: http://stackoverflow.com/a/27363690
has answer: http://stackoverflow.com/a/27363747

http://stackoverflow.com/a/27449045
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27442565
has body: Try with snapshots? Spencer noticed earlier this week there was a weird effect if the local network has a domain (eg you have local DNS or a route that adds a fake domain that isn't present on the localhost lookup). I think we fixed it for him.
answers question: http://stackoverflow.com/q/27442565
type: Answer
score: 3
upvote count: 3

http://stackoverflow.com/comment/43340677
has text: Tell me if it helps ;)
comment on: http://stackoverflow.com/a/27448932
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/79200717
has body: this probably isnt the answer youre looking for, but for whatever reason, just removing the JAVA_HOME environment variable altogether solved this error for me
score: 0
answers question: http://stackoverflow.com/q/27319495
type: Answer

http://stackoverflow.com/q/27435857
downvote count: 2
has answer: http://stackoverflow.com/a/27435978
upvote count: 1
answer count: 1
tagged with: host
tagged with: ip
type: UnansweredQuestion
tagged with: batch-file
has body: I have an IP Address and hostname/computer name of machines in the network. The machines could either be linux PCs, windows PCs, Mac Computers, or printers. I want to filter out which one's are the windows PCs and i am trying to find a command for that. The closest i got was using systeminfo /s \\computer_name This returns unreachable on a non windows PC, so that is good. But if the PC is windows, it requires that the current user has admin privileges on the remote PC, otherwise it also returns unreachable. I dont want the user to input any credentials, so all i have as input is just the IP address and hostname. What other way or command can be used? It can be any command/way. My objective is just to determine if it is a windows machine or not. It could be using batch files or java code. I will be using java, so I can call a batch file but if there is a java specific way it would be good too. Or any other way to implement windows pc discovery using java?
has title: How to if machine is a windows PC using IP Address or Hostname?
favorite count: 0
type: Question
tagged with: windows
score: -1
tagged with: java

http://stackoverflow.com/comment/43169899
score: 0
type: Comment
type: QuestionComment
has text: On some unixes you can't rename across file systems.
comment on: http://stackoverflow.com/q/27357901

http://stackoverflow.com/comment/43359021
type: Comment
comment on: http://stackoverflow.com/q/27461203
has text: the error is saying that the item.data(data can be resolved as a field)
score: 0
type: QuestionComment

http://stackoverflow.com/q/27392832
has comment: http://stackoverflow.com/comment/43233006
type: UnansweredQuestion
has title: Try Catch array?
has body: I get a nullPointerException when I try to use the array. How can I solve it? I have to count the lines in the txt file and use that as my array size. public static void main(String[] args) { String accountNum, password, give; int count=0, menuChoice,size=0; String[] validAccounts=null; //gets the data from the file and stores into an array try { Scanner file= new Scanner (new FileReader("ATMdata.txt")); //counts the lines in the text file while (file.hasNextLine()) { size++; String theLine = file.nextLine(); } validAccounts= new String[size]; for ( int countFile=0; count==size; countFile++) { validAccounts[countFile]= file.nextLine(); } } catch(Exception e) { System.out.println("Error processing file."); }
tagged with: java
has answer: http://stackoverflow.com/a/27392978
type: Question
tagged with: try-catch
has answer: http://stackoverflow.com/a/27392872
tagged with: arrays
has answer: http://stackoverflow.com/a/27392874
score: 0
tagged with: nullpointerexception
answer count: 3

http://stackoverflow.com/q/27365008
type: Question
has answer: http://stackoverflow.com/a/27365043
answer count: 2
accepted answer: http://stackoverflow.com/a/27365046
downvote count: 0
tagged with: string
has body: I have this regex : ^(([A-Z]:)|((\\|/){1,2}\w+)\$?)((\\|/)(\w[\w ]*.*))+\.([txt|exe]+)$ but every time I assign it to any string, Eclipse returns me invalid escape sequences, I have inserted a backward slash but it gives me the same error. How to assign the above expression to string in java?
tagged with: regex
favorite count: 0
has title: Can't use Regex in Java because of escape sequence error, how to remove the error
has answer: http://stackoverflow.com/a/27365046
type: AnsweredQuestion
tagged with: escaping
score: 3
upvote count: 3
tagged with: java
possible better answer: http://stackoverflow.com/a/27365043

http://stackoverflow.com/a/27414220
type: Answer
accepted answer of: http://stackoverflow.com/q/27414070
answers question: http://stackoverflow.com/q/27414070
has comment: http://stackoverflow.com/comment/43294918
score: 0
type: AcceptedAnswer
has body: try this: NorthPanel northernPanel = new NorthPanel(); // to declare and then, northernPanel.updateThermo(mySlider.getValue()); //to call

http://stackoverflow.com/comment/43214607
has text: Thanks for ur response..Calling the method is not an issue here.. when i get the file change event triggered, i need to return the changes to spring controller. Its not being returned..when i reload the page only,it is returned..What can i do for it??
type: Comment
comment on: http://stackoverflow.com/a/27373023
score: 0
type: AnswerComment

http://stackoverflow.com/a/27415361
has comment: http://stackoverflow.com/comment/43274757
has comment: http://stackoverflow.com/comment/43274961
upvote count: 0
has comment: http://stackoverflow.com/comment/43274707
has comment: http://stackoverflow.com/comment/43274799
accepted answer of: http://stackoverflow.com/q/27415335
has comment: http://stackoverflow.com/comment/43275075
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43274895
answers question: http://stackoverflow.com/q/27415335
has comment: http://stackoverflow.com/comment/43274686
score: -3
type: Answer
has body: You need to call your function in your main method: public static void main(String[] args) { int[] deck = new int[36]; int arraySize; arraySize = deck.length ; initDec(deck, arraySize); // add this } Also, when you print an array you need to use System.out.print(Arrays.toString(deck)); Otherwise you print the address
has comment: http://stackoverflow.com/comment/43274740
has comment: http://stackoverflow.com/comment/43274864
downvote count: 3
has comment: http://stackoverflow.com/comment/43274820

http://stackoverflow.com/q/27321271
tagged with: mysql
has answer: http://stackoverflow.com/a/27325067
accepted answer: http://stackoverflow.com/a/27325067
downvote count: 1
possible better answer: http://stackoverflow.com/a/27329188
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43107599
score: 0
has body: How can I display a table recovered from MySQL (in an ArrayList) and display it on Java Swing using JTable.I think that that recovery of the table from MySQL is done. My problem is in displaying it on JTable. Any help will be appreciated. Class Afficher.java package com.hibernate.stock; import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.border.EmptyBorder; import javax.swing.table.DefaultTableModel; import javax.swing.table.TableModel; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.util.ArrayList; import java.util.List; import org.hibernate.SQLQuery; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import org.hibernate.Query; import javax.swing.JTable; import javax.swing.JTextArea; public class Afficher extends JFrame { private JPanel contentPane; private JTable table; ArrayList&lt;Object[]&gt; biens= new ArrayList&lt;Object[]&gt;(); /** * Launch the application. */ private void fillTable(final JTable table, final List biens) { final String columnNames[] = {"ID", "Nom", "Catégorie", "Quantité"}; final DefaultTableModel tableModel = new DefaultTableModel(columnNames, 0); table.setModel(tableModel); for (final Object bien : biens) { // Assuming each row in the biens list is a list of strings... final List&lt;Object&gt; row = (List&lt;Object&gt;) bien; tableModel.addRow(row.toArray()); } } public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { Afficher frame = new Afficher(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } public Afficher() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPa…
has title: recover table from MySQL DB with hibernate and java Swing
has answer: http://stackoverflow.com/a/27329188
favorite count: 0
linked to: http://stackoverflow.com/q/20526917
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/43107935
type: AnsweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/27453085
has title: execution failed for task ':app:compileDebugNdk' failed to run this command ndk-build.cmd
score: 14
possible better answer: http://stackoverflow.com/a/32661577
has answer: http://stackoverflow.com/a/32661577
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/27481081
tagged with: makefile
answer count: 4
has body: Error:Execution failed for task ':app:compileDebugNdk'. com.android.ide.common.internal.LoggedErrorException: Failed to run command: C:\Program Files\ADT\sdk\android-ndk\ndk-build.cmd NDK_PROJECT_PATH=null Error Code: 1 this is the output I get when trying to run a make on my project on android studio. I'm on android studio 1.0 sdk build tools 24.0 but targeting API 14 this is what my Android.mk file looks like LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE := Main LOCAL_SRC_FILES := Main.cpp LOCAL_LDLIBS := -llog -ljnigraphics -lz -landroid LOCAL_SHARED_LIBRARIES := libavformat libavcodec libswscale libavutil include $(BUILD_SHARED_LIBRARY) $(call import-module,ffmpeg/android/arm) this is what my application.mk file looks like APP_ABI := armeabi #APP_ABI := armeabi-v7a APP_PLATFORM := android-14
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/47836408
upvote count: 14
accepted answer: http://stackoverflow.com/a/27481081
tagged with: java
has answer: http://stackoverflow.com/a/47217627
tagged with: android-ndk
type: Question
downvote count: 0

http://stackoverflow.com/q/27328247
has body: I tried searching for some sort of interactive JLabel. I want it to look like this: I'm not sure what this is called or where I could find info on displaying this. I want it to print a refreshed number when the +/- is pressed. I have it working to print on the eclipse console but am unsure how to get it to print to the JFrame. Here is some of the code: String input = JOptionPane.showInputDialog("Please enter the number of laps."); numLaps = Integer.parseInt(input); //frame creation JFrame f = new JFrame("Number of Laps"); f.setSize(550, 450); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setLayout(null); // label creation JLabel label = new JLabel("You entered " + numLaps + " laps. Press + to add a lap. Press - to subtract a lap.", SwingConstants.CENTER); label.setBounds(0,0,500,300); f.add(label); //display window f.setVisible(true); //button creation add JButton add = new JButton ("+"); add.setBounds(350,250,50,50); add.setPreferredSize(new Dimension(50,50)); add.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // what happens when button is pressed //numLaps++; addToLap(); System.out.println(numLaps); } }); f.add(add); //button creation subtract JButton sub = new JButton ("-"); sub.setBounds(100,250,50,50); sub.setPreferredSize(new Dimension(50,50)); sub.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // what happens when button is pressed //numLaps--; subToLap(); System.out.println(numLaps); } }); f.add(sub); &amp; the add/sub methods: private static void addToLap() { // TODO Auto-generated method stub numLaps++; } private static void subToLap() { // TODO Auto-generated method stub numLaps--; }
has comment: http://stackoverflow.com/comment/43115358
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/17874717
tagged with: jlabel
tagged with: jframe
has comment: http://stackoverflow.com/comment/43115259
has comment: http://stackoverflow.com/comment/43123257
tagged with: swing
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27328311
accepted answer: http://stackoverflow.com/a/27328311
has comment: http://stackoverflow.com/comment/43115366
tagged with: java
score: -1
linked to: http://stackoverflow.com/q/5621338
upvote count: 0
has comment: http://stackoverflow.com/comment/43115372
answer count: 1
tagged with: counter
has comment: http://stackoverflow.com/comment/43115407
has title: Creating live counter within a JFrame
has comment: http://stackoverflow.com/comment/43115304
favorite count: 0

http://stackoverflow.com/q/27445341
tagged with: javascript
has comment: http://stackoverflow.com/comment/43330537
has comment: http://stackoverflow.com/comment/43396436
favorite count: 0
has title: Using polymer in Java or NodeJS
tagged with: http://stackoverflow.com/tag/html
tagged with: node.js
answer count: 0
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/43477067
type: Question
tagged with: polymer
has comment: http://stackoverflow.com/comment/43360275
has comment: http://stackoverflow.com/comment/43463658
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/51458956
has body: I would like to generate static HTML5 pages, defining my own tags and rendering more complex HTML in the generated pages. I like the polymer architecture approach to define new sets of tags. When I want to generate my pages, I'm not in a browser, so I can use Java or NodeJS engines to compute the final HTML pages (from a console for instance). To sum up, I want to define my own tag libraries using the polymer approach, code some HTML using those new tags, and "print" the result DOM in a static HTML file, running all that from a console program (using Java or NodeJS). Does somebody know how to do so? It seems I must have some DOM interpreters, and I know that in Java I can use jsoup, but it will probably lack some JavaScript interpreter? Can NodeJS do that more simply?
downvote count: 0
has comment: http://stackoverflow.com/comment/43330442

http://stackoverflow.com/q/27466389
possible better answer: http://stackoverflow.com/a/27466405
answer count: 3
downvote count: 0
tagged with: string
accepted answer: http://stackoverflow.com/a/27466624
favorite count: 0
linked to: http://stackoverflow.com/q/1113408
has body: So I'm having a trouble formatting a String. My output should always be ##.##C or F (temperature conversion) so here is my method: public void setResultLabel(double inNumber, char inChar) { String number, letter; number = String.valueOf(inNumber); letter = String.valueOf(inChar); String temp; temp = number + letter; String format = String.format("%2.5s", temp); /* how do you make this code so that the out put result will always be up to two decimal places with a char C or F? */ result.setText(format); add(result); }
duplicate of: http://stackoverflow.com/q/1113408
has title: java String formatting up to two decimal places with a char
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
linked to: http://stackoverflow.com/q/21995817
type: Question
duplicate of: http://stackoverflow.com/q/8819842
has answer: http://stackoverflow.com/a/27466624
tagged with: format
has comment: http://stackoverflow.com/comment/43368724
has answer: http://stackoverflow.com/a/27466405
has answer: http://stackoverflow.com/a/27466520

http://stackoverflow.com/comment/43264992
comment on: http://stackoverflow.com/a/27397256
score: 0
type: AnswerComment
type: Comment
has text: a newbie question. In my code " result.put(x, count++); " doesn't work properly, but "count++; result.put(x, count);" works. Why?

http://stackoverflow.com/a/27446488
has body: I think probably what you want to do is create a parent project for your modules. Use a folder structure like this. /parent /core /Eclipse /IntelliJ /NetBeans Your parent project's pom.xml will look something like this. 4.0.0 your.group parent 0.0.1-SNAPSHOT pom core Eclipse IntelliJ NetBeans You'll also need to add something like this snippet in each of the child modules your.group parent whatever Once you're set up like this, running mvn install (for example) in the parent project will build all of the child modules (including the core). Running mvn install from within a child module will build only that child. Since the plugin modules already depend on the core, they should already work (though if you change the core, you'll have to mvn install the core to make them aware of the updates, naturally).
answers question: http://stackoverflow.com/q/27445269
downvote count: 0
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/43274572
comment on: http://stackoverflow.com/a/27415239
type: AnswerComment
has text: But I already said that `finalVendor = compData[0]; finalManufact = compData[1]; finalType = compData[2]; finalColor=compData[3];`, why didn't that work?
score: 0
type: Comment

http://stackoverflow.com/comment/43379205
score: 0
type: AnswerComment
has text: Okay, nevermind. Turns out it doesn't much care for '/' in the path. Thank you.
type: Comment
comment on: http://stackoverflow.com/a/27469846

http://stackoverflow.com/a/27323096
score: 0
has body: Your logic is incomplete: public static boolean isPrime (int x){ for(int i=2;i&lt;x;i++){ if(x%i==0){ return false; } } return true; }
answers question: http://stackoverflow.com/q/27323070
accepted answer of: http://stackoverflow.com/q/27323070
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/43112570
comment on: http://stackoverflow.com/a/27325761
score: 0
type: AnswerComment
has text: The fractional part of double numbers may affect the shading of pixels when anti-aliasing is enabled. Additionally, it will be taken into account when the graphics is, for example, scaled up with `g2d.scale(2.0,2.0);`. But in general. `g2d.fill(new Rectangle2D.Double(x,y,w,h));` is the way to go.
type: Comment

http://stackoverflow.com/q/27351680
has body: I am using Camel 2.10 version inwhich we are facing this issue. The JBoss Fuse 6.0 is running on the RHEL and we have mounted a Windows shared folder on the server linux folder is /mnt/sharedwin. Now we are processing file from this folder using file component as below. The from endpoint is as below file:/mnt/sharedwin/Current?preMove=/opt/jboss/fuse/data/target/processing&amp;move=archive/$simple{date:now:yyyyMMdd}/$simple{file:name}&amp;moveFailed=errorFile/$simple{date:now:yyyyMMdd}/$simple{file:name} When running the application we are getting following WARN msg and file are not getting moved to archive folder. Caused by: java.io.IOException: Renaming file from: /mnt/sharedwin/Current/XYZ.csv to: /opt/jboss/fuse/data/target/processing/XYZ.csv failed due cannot delete from file: /mnt/sharedwin/Current/XYZ.csv after copy succeeded Am I missing some parameters in file URL, please help.
score: 0
tagged with: osgi
accepted answer: http://stackoverflow.com/a/27494990
has comment: http://stackoverflow.com/comment/43306484
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43159500
tagged with: jbossfuse
tagged with: java
tagged with: apache-camel
type: Question
has title: Mount folder file handling using Camel 2.10 on LINUX
has answer: http://stackoverflow.com/a/27494990
answer count: 1

http://stackoverflow.com/a/27376067
score: 0
answers question: http://stackoverflow.com/q/27375632
type: Answer
has body: Do one thing , first enter the email field and then do a get text on email field it will give you what you have entered, if it is true go on to Password text box.
has comment: http://stackoverflow.com/comment/43206356
has comment: http://stackoverflow.com/comment/43202161

http://stackoverflow.com/a/27451704
has comment: http://stackoverflow.com/comment/43395556
downvote count: 0
type: Answer
has body: THe root elements need to be namespace qualified. Thus, the incoming XML needs to be something like: &lt;incident xmlns="http://www.ba.com/......."&gt;
answers question: http://stackoverflow.com/q/27446695
score: 1
upvote count: 1

http://stackoverflow.com/comment/43119864
has text: my string is "monday" "sunday" and i get short monday for system locale in "monday". i get short sunday for system locale in "sunday" can i get this strings?
comment on: http://stackoverflow.com/q/27330358
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43376285
score: 1
has text: If you encounter bugs in pgjdbc-ng please report them on the github page, with tests if possible. At a guess, I'd say you have multiple versions of PgJDBC on the classpath, and an older one is being found by C3P0 and used for pooling.
comment on: http://stackoverflow.com/q/27470190
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27393261
has comment: http://stackoverflow.com/comment/43233799
accepted answer: http://stackoverflow.com/a/27393348
tagged with: escaping
type: AnsweredQuestion
tagged with: java
type: Question
has body: please help to append " " at the start and end of String.class in the map using escape sequence, i not sure how to add. static Map Types = new LinkedHashMap(); Types.put(String.class, new StringSerial()); Expected results is "String.class" thanks
has answer: http://stackoverflow.com/a/27393348
score: 0
has title: JAVA excape sequence for map key
tagged with: java-6
answer count: 1

http://stackoverflow.com/q/27393430
has body: I'm new to Hibernate-Search. In the getting started guide, it said that I can specify where to store the index using these two property. &lt;property name="hibernate.search.default.directory_provider" value="filesystem"/&gt; &lt;property name="hibernate.search.default.indexBase" value="/var/lucene/indexes"/&gt; The problem is, that is a static path which may not be the same in development and production. How to change the path at runtime? Through JNDI maybe, or some way to modify persistence.xml at runtime. Thanks in advance.
type: Question
tagged with: jakarta-ee
tagged with: hibernate-search
has answer: http://stackoverflow.com/a/27431218
tagged with: jndi
score: 0
has title: Specify Hibernate-Search runtime directory
answer count: 1
linked to: http://stackoverflow.com/q/9264931
type: UnansweredQuestion
tagged with: java
tagged with: hibernate

http://stackoverflow.com/a/27380285
score: 3
downvote count: 0
type: Answer
upvote count: 3
has body: If you take a look into the source code, you will see that a JDBC driver implements java.sql.Driver. This interface has a method boolean acceptsURL(String url) throws SQLException; From the JavaDoc: Retrieves whether the driver thinks that it can open a connection to the given URL. Typically drivers will return true if they understand the subprotocolspecified in the URL and false if they do not. So the dirver for your database is responsible to implement this method. For H2, this implementation is @Override public boolean acceptsURL(String url) { if (url != null) { if (url.startsWith(Constants.START_URL)) { return true; } else if (url.equals(DEFAULT_URL)) { return DEFAULT_CONNECTION.get() != null; } } return false; } Other DBMS have different implementations. Edit: For H2, the constant Constants.START_URL is "jdbc:h2:". So even the leading jdbc is not part of any formal grammar.
has comment: http://stackoverflow.com/comment/43216432
has comment: http://stackoverflow.com/comment/43210461
has comment: http://stackoverflow.com/comment/43216195
answers question: http://stackoverflow.com/q/27380071

http://stackoverflow.com/comment/43170936
has text: i suppose after adding these two lines to your Spring dispatcher servlet file, Spring mvc will start scanning your components.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27322141
type: Comment

http://stackoverflow.com/a/27444946
answers question: http://stackoverflow.com/q/27444918
has body: Person(String newName) { name = newName; } This is the contructor of class, not the method. To understand the difference between the methods and constructors, please read this article: http://www.javaworld.com/article/2076204/core-java/understanding-constructors.html
type: Answer
score: 5
upvote count: 5
downvote count: 0

http://stackoverflow.com/comment/43141583
type: AnswerComment
comment on: http://stackoverflow.com/a/27342835
score: 0
type: Comment
has text: Well look, the problem is really simple: the `EnumTest` class doesn't know where to find `Day__`. You need to look at your project, observe where your files are, and add an appropriate `import` statement. If you still don't see the problem, add in your post the directory layout of your files, for example like the `tree` command in Linux.

http://stackoverflow.com/a/27351052
type: Answer
has comment: http://stackoverflow.com/comment/43156532
has body: There are a few things that you are doing wrong here. To reference a string in XML you should use android:text="@string/string_name" @string referring to the string.xml file and string_name being the name that you have declared. This is what the line required in string.xml would look like This is a string you are referencing!r Also I have never tried naming a resource with . separating words. This could cause an error but I am not 100% sure. Edit: michal.z is incredibly correct when he says that you cannot reference R. or android.R. resources from XML. you only use these when you are trying to reference a resource programatically.
score: 1
has comment: http://stackoverflow.com/comment/43156527
has comment: http://stackoverflow.com/comment/43156509
accepted answer of: http://stackoverflow.com/q/27350997
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27350997

http://stackoverflow.com/a/27423970
has comment: http://stackoverflow.com/comment/43290415
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/43290837
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27422040
has comment: http://stackoverflow.com/comment/43290295
answers question: http://stackoverflow.com/q/27422040
type: AcceptedAnswer
has body: First, you'll need to use UnorderedBulkOperation for the entire batch to execute. You will need to use a try/catch around your BulkWriteOperation.execute(), catching BulkWriteException which will give you access to a list of BulkWriteError as well as the BulkWriteResult. Here's a quick and dirty example: MongoClient m = new MongoClient("localhost"); DB db = m.getDB( "test" ); DBCollection coll = db.getCollection( "bulk" ); coll.drop(); coll.createIndex(new BasicDBObject("i", 1), new BasicDBObject("unique", true)); BulkWriteOperation bulkWrite = coll.initializeUnorderedBulkOperation(); for (int i = 0; i &lt; 100; i++) { bulkWrite.insert(new BasicDBObject("i", i)); } // Now add 10 documents to the batch that will generate a unique index error for (int i = 0; i &lt; 10; i++) { bulkWrite.insert(new BasicDBObject("i", i)); } BulkWriteResult result = null; List&lt;BulkWriteError&gt; errors = null; try { result = bulkWrite.execute(); } catch (BulkWriteException bwe) { bwe.printStackTrace(); errors = bwe.getWriteErrors(); result = bwe.getWriteResult(); } for (BulkWriteError e : errors) { System.out.println(e.getIndex() + " failed"); } System.out.println(result);

java.util.scanner
tags question: http://stackoverflow.com/q/27404065
tags question: http://stackoverflow.com/q/27325065
tags question: http://stackoverflow.com/q/27368856
tags question: http://stackoverflow.com/q/27463630
tag name: java.util.scanner
tags question: http://stackoverflow.com/q/27451179
tags question: http://stackoverflow.com/q/27371191
tags question: http://stackoverflow.com/q/27445863
tags question: http://stackoverflow.com/q/27464030
tags question: http://stackoverflow.com/q/27377100
tags question: http://stackoverflow.com/q/27455672
tags question: http://stackoverflow.com/q/27453298
tags question: http://stackoverflow.com/q/27416106
type: Tag
tags question: http://stackoverflow.com/q/27473513
tags question: http://stackoverflow.com/q/27325771
tags question: http://stackoverflow.com/q/27322907
tags question: http://stackoverflow.com/q/27345759
tags question: http://stackoverflow.com/q/27325460
tags question: http://stackoverflow.com/q/27315487
tags question: http://stackoverflow.com/q/27441694
tags question: http://stackoverflow.com/q/27428688
tags question: http://stackoverflow.com/q/27416612
tags question: http://stackoverflow.com/q/27394041
tags question: http://stackoverflow.com/q/27370885

http://stackoverflow.com/q/27420513
has comment: http://stackoverflow.com/comment/43296195
has body: I am new to JPA. As per my understanding JPA itself cannot do persistence. It will need JPA Provider for persisting data into database. JPA Provider : It is the vendor product that contains the JPA flavor (javax.persistence). For example Eclipselink, Toplink, Hibernate, etc. http://www.tutorialspoint.com/jpa/jpa_orm_components.htm So any application which wants to use JPA for persistence it will have to use a Provider like Eclipselink, Toplink, Hibernate, etc. also. Is this correct?
answer count: 2
tagged with: jpa
has comment: http://stackoverflow.com/comment/72478261
favorite count: 0
has comment: http://stackoverflow.com/comment/43292229
has title: What is a JPA Provider?
has answer: http://stackoverflow.com/a/27423224
has comment: http://stackoverflow.com/comment/43283765
has answer: http://stackoverflow.com/a/27420790
score: 8
upvote count: 11
type: UnansweredQuestion
downvote count: 3
linked to: http://stackoverflow.com/q/9881611
type: Question
tagged with: java

http://stackoverflow.com/a/27409794
upvote count: 0
has body: Because a List could be a linked list, and a linked list does not provide fast random access. (Accessing the k th element takes O(k) time, and "fast" means constant time.)
has comment: http://stackoverflow.com/comment/43263876
answers question: http://stackoverflow.com/q/27409287
score: -1
has comment: http://stackoverflow.com/comment/43264821
downvote count: 1
type: Answer

http://stackoverflow.com/q/27467893
has comment: http://stackoverflow.com/comment/43371228
score: 0
has comment: http://stackoverflow.com/comment/43371270
answer count: 2
has body: My task is to receive a command via the Terminal like "insert number" and call an insert methode using the number. My methode is working. This is my code snippet: String command = Terminal.readLine(); while (command != null) { switch (command) { case "insert number": String[] split = command.split(" "); linkedTuple.insert(Integer.parseInt(split[1])); break; only a part of my complete code. My problem is if I use case "insert number" it will only work if I really would write insert number in my terminal but instead I want to write for example insert 3 to insert the number 3 but how can I call that in my switch case? My Terminal is working because a command like quit which is quitting my Application is working. Thank you! Edit: For clarity my main methode: public static void main(String[] args) { int[] tuple = { 1 }; LinkedNaturalNumberTuple linkedTuple = new LinkedNaturalNumberTuple( tuple); String command = Terminal.readLine(); String[] split = command.split(" "); while (command != null) { switch (split[0]) { case "insert": linkedTuple.insert(Integer.parseInt(split[1])); break; case "remove": Terminal.printLine("" + linkedTuple.remove(Integer.parseInt(split[1]))); break; case "swap": if (!linkedTuple.swap(Integer.parseInt(split[1]), Integer.parseInt(split[2]))) { Terminal.printLine("Error, your numbers are invalid please try again!"); } break; case "min": if (linkedTuple.min() == -1) { Terminal.printLine("Error, your tuple is empty, use insert number to insert a number!"); } else { Terminal.printLine("" + linkedTuple.min()); } break; case "max": if (linkedTuple.max() == -1) { Terminal.printLine("Error, your tuple is empty, use insert number to insert a number!"); } else { Terminal.printLine("" + linkedTuple.max()); } break; case "info": Terminal.printLine(linkedTuple.toString()); break; case "quit": System.exit(1); break; } command = Terminal.readLine(); } } If I enter a command and then want to enter another one the first one will be called instead. for example: in…
has answer: http://stackoverflow.com/a/27467944
has comment: http://stackoverflow.com/comment/43371273
tagged with: java
possible better answer: http://stackoverflow.com/a/27468012
has answer: http://stackoverflow.com/a/27468012
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27467944
has title: How can I receive an input from my Terminal and use it properly
tagged with: terminal
has comment: http://stackoverflow.com/comment/43371241
type: Question

http://stackoverflow.com/comment/43224370
has text: you only get the result you ask for, in this case column _id, name and password
comment on: http://stackoverflow.com/q/27388104
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43303666
type: Comment
type: QuestionComment
has text: Logically if the query returns results in query window but not in java code the problem is either A) not pointed to right DB having data you expect B) logic writing output is flawed ("ShowTime"!="Showtime") C) you're getting an error when passing in the SQL that you're not trapping for in Java. SO 1) Confirm you're connecting to the same database with the same permissions you have in your query window, 2) update ShowTime, 3) add some error handling to see if you have an error in the SQL driver, and if so report the error message.
score: 0
comment on: http://stackoverflow.com/q/27430551

http://stackoverflow.com/q/27315776
tagged with: java
tagged with: scroll
has answer: http://stackoverflow.com/a/27319838
tagged with: scrollbar
type: Question
accepted answer: http://stackoverflow.com/a/27319838
score: 0
tagged with: jscrollpane
has title: JScrollBar setValue not working when a dialog not visible
answer count: 1
has body: Here is my simple example: import java.awt.BorderLayout; import java.awt.Dialog; import java.awt.Dimension; import java.awt.FlowLayout; import java.util.ArrayList; import java.util.Enumeration; import javax.swing.AbstractButton; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JScrollPane; import javax.swing.JRadioButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class SelectItem extends JDialog { private static final long serialVersionUID = 1L; private final JPanel contentPanel = new JPanel(); private String item; private ButtonGroup group; /** * Launch the application. */ public static void main(String[] args) { final JFrame frame = new JFrame(); frame.setBounds(100, 100, 133, 102); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(new BorderLayout(0, 0)); JButton btnSelectItem = new JButton("select item"); btnSelectItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ArrayList&lt;String&gt; items = new ArrayList&lt;String&gt;(); for (char c = 'A'; c &lt;= 'Z'; c++) items.add(String.valueOf(c)); SelectItem dialog = new SelectItem(frame, items, items.get(20)); System.out.println("Item = " + dialog.showChooseDialog()); } }); frame.getContentPane().add(btnSelectItem); frame.setVisible(true); } public String showChooseDialog(){ setVisible(true); return item; } /** * Create the dialog. */ public SelectItem(JFrame parent, ArrayList&lt;String&gt; items, String selectedItem) { super(parent, null, Dialog.ModalityType.DOCUMENT_MODAL); setTitle("Select Item"); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setBounds(100, 100, 450, 300); getContentPane().setLayout(new BorderLayout()); contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLay…
tagged with: swing
type: AnsweredQuestion

http://stackoverflow.com/comment/43262639
type: QuestionComment
has text: You can use a `switch`.
score: 0
comment on: http://stackoverflow.com/q/27409131
type: Comment

http://stackoverflow.com/a/27317905
accepted answer of: http://stackoverflow.com/q/27317729
answers question: http://stackoverflow.com/q/27317729
score: 0
type: AcceptedAnswer
type: Answer
has body: I think you should change else if(fragmentName.equals("FavoritenFragment")) { WebView mWebView = ((LoadUrlFragment) fragment).getMWebView(); to else if(fragmentName.equals("FavoritenFragment")) { WebView mWebView = ((FavoritenFragment) fragment).getMWebView(); This looks like a nice copy &amp; paste based exception :)
has comment: http://stackoverflow.com/comment/43095323

http://stackoverflow.com/comment/43308703
type: Comment
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27433693
has text: You haven't actually asked a question. Your title claims that `setValue()` isn't working, but it must be if the results of `getValue()` are correct. What is the actual problem here?

http://stackoverflow.com/q/27446122
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43332804
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43331304
has comment: http://stackoverflow.com/comment/43332363
has comment: http://stackoverflow.com/comment/43331907
has comment: http://stackoverflow.com/comment/43331864
type: Question
tagged with: split
linked to: http://stackoverflow.com/q/27444398
has answer: http://stackoverflow.com/a/27448816
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43333710
has comment: http://stackoverflow.com/comment/43331948
has body: I have this string token1=value1Token2=value2Token3[12]=value3 where tokenX might be a string with numbers (e.g.: myToken12 or my2Token) and valueX just numbers or symbols (e.g.: 123123 or {{1, 2}, 3, 4}) that I'd like to transform into this array: ['token1=value1', 'token2=value2', 'token3[12]=value3'] example of string I might have: String s = na23me=12341234las4tName={{0,0,0},{0,0,0},{0,0,0}}stree2t[696]=764545457OK I tried with split and matcher ... this question has been already posted but this is different as it is more general (token=value) where value in the previous question was just a number or in a different post symbols. I'd like to have a general answer here. thanks. MORE DETAIL: with this string: String s = na23me=12341234las4tName=654567stree2t[696]=764545457OK this solution: String[] tokens = s.split("(?&lt;==\\d{1,1000})(?=[a-zA-Z])"); works, but I might have as "value" something like this {1, 2, 3} that I'd like to consider. that's why is different. ONE LEVEL MORE what about if I want to include the "TEST" too? e.g.: conf=0ticket[0,9]="TEST"config={0,0,0}platform_id=121212 I've tried with this String[] tokens = buffer.split("(?&lt;==\\d{1,1000}|\\W| **\"\\w\"**)(?=[a-zA-Z])"); EXPECTED: At the end just managing the "STRING" as "value", but it shouldn't be a big issue as is into the double quote. ['conf=0', 'ticket[0,9]="TEST"', 'config={0,0,0}', 'platform_id=121212'] doesn't work ..idea?
favorite count: 0
has comment: http://stackoverflow.com/comment/43334658
tagged with: regex
has comment: http://stackoverflow.com/comment/43331783
accepted answer: http://stackoverflow.com/a/27448816
has comment: http://stackoverflow.com/comment/43332584
has title: String split token=value in java and regex
upvote count: 1

http://stackoverflow.com/comment/43289756
has text: Thanks Joe, I've got a config file in place similar to how you suggest. The paths I mention are under the control of "us" but will definitely be referred to via a properties file in case they should change. Nothing is hard-coded (where possible anyway)
type: AnswerComment
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27423790

http://stackoverflow.com/comment/43346464
score: 0
type: AnswerComment
type: Comment
has text: Well, they don't HAVE to be `private`, but it's good practice to make a field or a method `private` if it's not going to be used outside the class where it's declared. There are lots of reasons for this, but one really good reason is so that if you encounter a problem where one of those variables doesn't have the value that you expect it to have, then you only have to look in ONE class for your problem, rather than the entire program.
comment on: http://stackoverflow.com/a/27454036

http://stackoverflow.com/comment/43192710
type: QuestionComment
score: 0
has text: @markspace - didn't think of that! - Math.abs(-2^31) also yields a negative result which I didn't know until now.
comment on: http://stackoverflow.com/q/27370394
type: Comment

http://stackoverflow.com/comment/43309913
score: 0
type: Comment
type: QuestionComment
has text: how would i do that ?
comment on: http://stackoverflow.com/q/27434276

http://stackoverflow.com/a/50771185
score: 1
has comment: http://stackoverflow.com/comment/101288989
answers question: http://stackoverflow.com/q/27391028
upvote count: 2
has body: Arrays.asList() method................: 22 ms Arrays.stream() method................: 26 ms Stream.of() method....................: 26 ms Arrays.asList() (premade array) method: 8 ms Arrays.stream() (premade array) method: 30 ms Stream.of() (premade array) method....: 17 ms When you change doSomething to actually do nothing as follows: public static void doSomething(String s){ } Then you're measuring the actual speed of these operations instead of the operation String = String + String; This is what doSomething was doing, and of course it is about the same speed consistently. However, the actual speed isn't the same and asList with a premade array is much faster. The real result here has already been noted by others that you should beware of the stream as it is typically 4 times slower than the plain old java (non-lambda) approach.
type: Answer
downvote count: 1

http://stackoverflow.com/comment/43173946
has text: int num2 = 0, num1 = 0, num3= 0; try that
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27360846
type: AnswerComment

http://stackoverflow.com/q/27414053
answer count: 4
type: AnsweredQuestion
has title: Eclipse ADT not generating MainActivity
tagged with: java
type: Question
tagged with: adt
tagged with: eclipse
has body: I am having an immensely frustrating issue with Eclipse and the ADT after updating all the SDK's, API's and Support Libraries for Android this week. Ever since updating everything I am unable to properly create an Android Project in Eclipse. It does not generate the MainActivity.java or the main_layout.xml files at all. I have read through most of the other posts regarding this and the fixes they suggest don't seem to work. I have tried looking for the updated software by going to: Help --> Check for updates (Everything is up-to-date). I have also tried the manual way by going to: Help --> Install New Software and inputting https://dl-ssl.google.com/android/eclipse/ It still says I have the latest version of the ADT. I have also tried reinstalling the ADT plugin as well, but to not avail. Trying to create an Activity after project creation also does not work. Versions of software that I am running: Android SDK Tools 24.0.1 Android API 1.5 up to and including API 5.0.1 Eclipse: Luna Service Release 1(4.4.1) ADT Plugin Not sure Thank you for taking the time to read this.
score: 0
has answer: http://stackoverflow.com/a/27438009
has answer: http://stackoverflow.com/a/27414314
accepted answer: http://stackoverflow.com/a/27438009
has answer: http://stackoverflow.com/a/27456666
tagged with: sdk
tagged with: android
possible better answer: http://stackoverflow.com/a/27414093
has answer: http://stackoverflow.com/a/27414093

http://stackoverflow.com/comment/43274632
comment on: http://stackoverflow.com/q/27415304
score: 0
has text: You have WAYYY too many quotation marks I don't know what you are trying to do with this String but you need to remove all the extra "" marks first and foremost or else you will get nothing but a ton of compiler erors String level = "(subject:\Chemistry\ OR (course:\Organic Chemistry\ OR course:\Inorganic Chemistry\ OR (unit:\unit1\)))";
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43324067
type: QuestionComment
score: 1
has text: I guess @tomsontom is right, are you sure that what you have isn't a compile error regarding the `Controller` class, which does not exist (or isn't imported) ?
comment on: http://stackoverflow.com/q/27441960
type: Comment

http://stackoverflow.com/q/27378444
favorite count: 0
type: UnansweredQuestion
tagged with: multithreading
upvote count: 1
has body: I am trying to develop a project for my graduation project. I am using free version of Hazelcast so i couldn't ask support for help. I wrote a java application that works on single computer. I am using LinkedList for queue, and have a pool of 5 worker threads. Worker threads just take one of the job from queue and executes it. Code for the job: package com.stackoverflow.multithread.app; import java.util.Date; /** * Job */ public class Job implements Runnable { private final Object req; private final long createTime = new Date().getTime(); public Job(Object req) { this.req = req; } public boolean isPoison() { return req == null; } public long getWaitTime(){ return new Date().getTime() - createTime; } @Override public void run() { try { //Do the job } catch (Exception e){ e.printStackTrace(); } } } Code for the Work Queue package com.stackoverflow.multithread.app; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; /** * WorkQueue */ public class WorkQueue { private static int minThreads; private static int maxThreads; private static final List&lt;PoolWorker&gt; threads = new ArrayList&lt;PoolWorker&gt;(); private static final LinkedList queue = new LinkedList(); private static WorkQueue instance = null; /** * WorkQueue */ protected WorkQueue() { minThreads = 1; maxThreads = 5; for (int i = 0; i &lt; minThreads; i++) { PoolWorker worker = new PoolWorker(); threads.add(worker); worker.start(); } } /** * getInstance * * @return Singleton WorkQueue instance */ public static WorkQueue getInstance() { if (instance == null) { instance = new WorkQueue(); } return instance; } /** * clone * * @return null * @throws CloneNotSupportedException: Singleton class can not be cloned. */ @Override public WorkQueue clone() throws CloneNotSupportedException { throw new CloneNotSupportedException("Singleton class can not be cloned."); } public void execute(Job r) { synchronized (queue) { queue.addLast(r); manageWorkers(); queue.notify(); } } private void manag…
score: 1
tagged with: java
tagged with: queue
type: Question
downvote count: 0
answer count: 1
tagged with: hazelcast
tagged with: pool
has title: How to make a Multithread Application using Hazelcast
has answer: http://stackoverflow.com/a/27500362

http://stackoverflow.com/a/27386279
has body: Use this code for uploading and clicking on the Upload button: (Assuming the element for uploading file is an 'input tag' with type 'file') driver.findElement(By.xpath("//input[@type='file']")).sendKeys("C:\\Users\\user\\Desktop\\Ontology.owl"); driver.findElement(By.xpath("//input[@value='Upload']")).click(); Alternative:- Below is an alternative to the above method. Please only import the classes related to "java.awt" package, as "Robot, KeyEvent, StringSelection and Toolkit" will only work then //Clicking on the Browse button driver.findElement(By.xpath("//input[@type='file']")).click(); //Setting the Clipboard contents StringSelection path = new StringSelection("C:\\Users\\user\\Desktop\\Ontology.owl");//the code needed to be pasted in the second dialog box Toolkit.getDefaultToolkit().getSystemClipboard().setContents(path, null); Thread.sleep(4000);//Sleep time to detect the window dialog box //Pasting the path in the File name field Robot robot = new Robot(); robot.keyPress(KeyEvent.VK_CONTROL); robot.keyPress(KeyEvent.VK_V); robot.keyRelease(KeyEvent.VK_V); robot.keyRelease(KeyEvent.VK_CONTROL); //To click the Open button so as to upload file robot.keyPress(KeyEvent.VK_ENTER); robot.keyRelease(KeyEvent.VK_ENTER); //Click on Upload button driver.findElement(By.xpath("//input[@value='Upload']")).click();
has comment: http://stackoverflow.com/comment/43220971
score: 1
has comment: http://stackoverflow.com/comment/43221119
answers question: http://stackoverflow.com/q/27385781
has comment: http://stackoverflow.com/comment/43221516
upvote count: 1
has comment: http://stackoverflow.com/comment/43222472
has comment: http://stackoverflow.com/comment/43221970
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27385781
has comment: http://stackoverflow.com/comment/43221662
has comment: http://stackoverflow.com/comment/43275824
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43275933
has comment: http://stackoverflow.com/comment/43222487
has comment: http://stackoverflow.com/comment/43222624
has comment: http://stackoverflow.com/comment/43223255
has comment: http://stackoverflow.com/comment/43222145
has comment: http://stackoverflow.com/comment/43221291
type: Answer

http://stackoverflow.com/comment/43304901
type: AnswerComment
comment on: http://stackoverflow.com/a/27431699
type: Comment
has text: Thanks for the reply. I updated my code to have a proper redirect. That really isn't my question though. My question involves the code that is located in the getInformationMessage method. It doesn't seem right to have formatted html text in a controller, since at least in my mind the controller should be agnostic of how its view actually displays anything. That is the crux of my problem.
score: 0

http://stackoverflow.com/comment/43135754
comment on: http://stackoverflow.com/q/27339552
score: 0
has text: @MadProgrammer Sorry if my question lacked clarity. I want the buttons to be smaller when the frame is opened initially, so that they are smaller than the buttons on the board itself (maybe size (100,25)ish). And thanks! It's my first real attempt at a program beyond the bare basics on my own.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27403662
type: AcceptedAnswer
score: 6
type: Answer
downvote count: 0
answers question: http://stackoverflow.com/q/27403638
accepted answer of: http://stackoverflow.com/q/27403638
has body: 1 &lt;&lt; 31 is an int, not a long. And what you have is not really an overflow, but Integer.MIN_VALUE (sign bit set, all the rest zeroes). Unless you suffix them appropriately, any numeric constant in Java is an int by default. If you want a long, you have to tell the compiler that you want a long: 1L &lt;&lt; 31 (note the L). And note that even (long) (1 &lt;&lt; 31) wouldn't work; even in this scenario, 1 &lt;&lt; 31 remains an int. Casting "after the fact" doesn't help ;)
upvote count: 6

http://stackoverflow.com/q/27425182
has answer: http://stackoverflow.com/a/27425669
tagged with: sql-server
answer count: 2
has body: Hi I have client java program that execute with jar file. However that client program contain JDBC with user name and password. I think it's not really good for security because everyone can decompile jar file. Which one is best way to make JDBC connection string with secured module. Program is built by Java version 1.6. Database is Sql-server. Thank you!
downvote count: 0
favorite count: 0
has title: Java Security Database connection
tagged with: jdbc
accepted answer: http://stackoverflow.com/a/27425669
possible better answer: http://stackoverflow.com/a/27425688
has answer: http://stackoverflow.com/a/27425688
type: AnsweredQuestion
tagged with: database-connection
score: 1
tagged with: java
upvote count: 1
type: Question
linked to: http://stackoverflow.com/q/11538637

http://stackoverflow.com/comment/43231569
comment on: http://stackoverflow.com/q/27392006
type: Comment
type: QuestionComment
has text: Import the class if it's not in the same pkg
score: 0

http://stackoverflow.com/a/27320916
has comment: http://stackoverflow.com/comment/43102817
has comment: http://stackoverflow.com/comment/43112046
has comment: http://stackoverflow.com/comment/43102609
has comment: http://stackoverflow.com/comment/43103660
has body: You are so close to getting this right. Below is the relevant code to make this generic. Unfortunately, java serialized objects are not type aware, so you will need to cast the object still. public &lt;T&gt; ArrayList&lt;T&gt; ReadData(String filename, T type) { ..... this.objects = (ArrayList&lt;T&gt;) in.readObject(); ..... } If you want to know more about generic programming, oracle has written a solid tutorial that will show you the basics. In addition to changing the method signatures for your class, you will need to make the class generic. public class ReadDataMembers&lt;T&gt; { public ReadDataMember(String filename) { } } You don't need to pass in the type through the constructor, but you can use the following syntax ReadDataMembers rdm = new ReadDataMembers&lt;Member&gt;("member.dat");
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27320705
type: Answer
has comment: http://stackoverflow.com/comment/43102889
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27320705
has comment: http://stackoverflow.com/comment/43101755

http://stackoverflow.com/comment/43369369
type: QuestionComment
type: Comment
has text: For those people who know java but not php, what does the code do?
comment on: http://stackoverflow.com/q/27466734
score: 0

http://stackoverflow.com/q/27380219
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43209582
has comment: http://stackoverflow.com/comment/43209531
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27380455
upvote count: 1
tagged with: methods
tagged with: eclipse
downvote count: 1
type: Question
has title: Java cannot be resolved to a variable or not applicable for the arguments (boolean)
has body: I'm reasonably new to Java and I'm making a little game that runs in the console. I need to call this method if somebody wants to play again. printGrid(A1, A2, A3, B1, B2, B3, C1, C2, C3); I have tried this below (where turn and newGame are declared as global variables: private static void xWins(boolean turn, boolean newGame) { String playerChoice; System.out.println("Player X Wins!"); System.out.println("|Would you like to play again? |"); System.out.println("|Enter Y or N |"); playerChoice = enterChoice(turn); switch(playerChoice){ case "n": thankYou();break; case "N": thankYou();break; case "no": thankYou(); break; case "No": thankYou();break; case "NO": thankYou();break; case "nO": thankYou();break; default: turn = true; newGame = true; } } I tried to make it work with this, which goes with this in the main loop if (newGame == true) printGrid(A1, A2, A3, B1, B2, B3, C1, C2, C3); The error message I am getting in Eclipse is The method xWins(boolean, boolean) in the type ticTacToe is not applicable for the arguments (boolean) Otherwise, if I try to call printGrid directly instead of newGame = true; at the end of the class then I get messages telling me that each of these globally defined variables cannot be resolved to a variable. Making this a public class also makes no difference. After looking on StackOverflow for similar answers I am still clueless.
has comment: http://stackoverflow.com/comment/43210201
tagged with: class
has comment: http://stackoverflow.com/comment/43210716
score: 0
accepted answer: http://stackoverflow.com/a/27380455
has comment: http://stackoverflow.com/comment/43209702

http://stackoverflow.com/a/27400775
has body: public void Sum(int a,int b) { int result = 0; if(a&gt;b) //swap them { result=a; a=b; b=result; result=0; } while (a &lt;=b) { result+=a; a++; } System.out.println("The sum of all numbers is "+result); }
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43246654
answers question: http://stackoverflow.com/q/27400700
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/43283856

http://stackoverflow.com/a/27405797
has comment: http://stackoverflow.com/comment/43256256
has body: Your else condition is returning (double)(num * 100). You need to return a String. Try the code below, you need to convert the double value to a String: public String listProjectedPortfolioTimeframe(double desiredBalance) { desiredBalance = 88; String str = ""; double num = 200; if (bankAccounts.size() &lt;= 0) { str = "enter ammount to find number of years of constant saving will give 200 euro"; for (BankAccount ba: bankAccounts) { str += ba.getAccNumber(); str += ba.getBalance(); } } else { str = String.valueOf(num * 100); } return str; } I don't normally get in the habit of doing peoples work for them, but I had a little bit of free time this afternoon: public String listProjectedPortfolioTimeframe(double desiredBalance) { String str = ""; double amountOfIncreasePerYear = 50; // You need to replace this... for (BankAccount ba: bankAccounts) { String currentBalance = ba.getBalance(); if(Double.parseDouble(currentBalance) &lt;= desiredBalance) { double numberOfYears = (desiredBalance - Double.parseDouble(currentBalance)) / amountOfIncreasePerYear; String currentAccNumber = ba.getAccNumber(); str += String.Format( "Account#: %s, Current Balance: %.2f, Number of Years to Reach %.2f: %f \r\n", currentAccNumber, currentBalance, desiredBalance, numberOfYears ); } } if(str == "") { str = "No Bank Accounts"; } return str; } Keep in mind, I just typed this out in notepad so you may have to check that it compiles. Also you need to determine the value that should be in the amountOfIncreasePerYear variable. What determines that value. Is it something you can get from a BankAccount class member?
has comment: http://stackoverflow.com/comment/43256685
type: Answer
has comment: http://stackoverflow.com/comment/43256391
has comment: http://stackoverflow.com/comment/43258681
has comment: http://stackoverflow.com/comment/43257098
has comment: http://stackoverflow.com/comment/43256958
has comment: http://stackoverflow.com/comment/43260445
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27405726
has comment: http://stackoverflow.com/comment/43257725
has comment: http://stackoverflow.com/comment/43256808
has comment: http://stackoverflow.com/comment/43256833
has comment: http://stackoverflow.com/comment/43257240
has comment: http://stackoverflow.com/comment/43257493
has comment: http://stackoverflow.com/comment/43257564
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43257334
has comment: http://stackoverflow.com/comment/43260354
answers question: http://stackoverflow.com/q/27405726
has comment: http://stackoverflow.com/comment/43257600

http://stackoverflow.com/a/27349419
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27349374
has body: You are not reading any cell. See this example: import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.xssf.usermodel.XSSFSheet; //.. FileInputStream file = new FileInputStream(new File("C:\\test.xlsx")); //Get the workbook instance for XLS file XSSFWorkbook workbook = new XSSFWorkbook (file); //Get first sheet from the workbook XSSFSheet sheet = workbook.getSheetAt(0); //Get iterator to all the rows in current sheet Iterator&lt;Row&gt; rowIterator = sheet.iterator(); //Get iterator to all cells of current row Iterator&lt;Cell&gt; cellIterator = row.cellIterator(); try { FileInputStream file = new FileInputStream(new File("C:\\test.xls")); //Get the workbook instance for XLS file HSSFWorkbook workbook = new HSSFWorkbook(file); //Get first sheet from the workbook HSSFSheet sheet = workbook.getSheetAt(0); //Iterate through each rows from first sheet Iterator&lt;Row&gt; rowIterator = sheet.iterator(); while(rowIterator.hasNext()) { Row row = rowIterator.next(); //For each row, iterate through each columns Iterator&lt;Cell&gt; cellIterator = row.cellIterator(); while(cellIterator.hasNext()) { Cell cell = cellIterator.next(); switch(cell.getCellType()) { case Cell.CELL_TYPE_BOOLEAN: System.out.print(cell.getBooleanCellValue() + "\t\t"); break; case Cell.CELL_TYPE_NUMERIC: System.out.print(cell.getNumericCellValue() + "\t\t"); break; case Cell.CELL_TYPE_STRING: System.out.print(cell.getStringCellValue() + "\t\t"); break; } } System.out.println(""); } file.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); }

http://stackoverflow.com/a/31610661
has comment: http://stackoverflow.com/comment/56301046
downvote count: 0
answers question: http://stackoverflow.com/q/27316983
has body: I had the same error, using Hibernate 4.3.6 and Jadira usertype 4.0.0.GA. My guess is that the library Jadira usertype 4.0.0.GA is not compatible with multi-tenancy mode of Hibernate. My solution is to remove usertype dependency and obviously don't use it in the code. For now you have to choose using hibernate multi-tenancy or using usertype. For more details, usertype uses deprecaded API ConnectionProvider getConnectionProvider() which returns null on multi-tenancy mode because MultiTenantConnectionProvider is not an instance of ConnectionProvider. In multi-tenancy mode there is no service of type ConnectionProvider. Usertype should use a JdbcConnectionAccess instead. I hope it'll be fixed in next versions.
type: Answer
upvote count: 1
score: 1

http://stackoverflow.com/comment/43357438
comment on: http://stackoverflow.com/q/27458617
score: 1
has text: Your app already runs on server which runs server-side code (servlets) and gives static to server. I assume that "not found error" occurs because of wrong routing. You must configure routing correctly in your WEB-INF/web.xml file.
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27387116
tagged with: testing
answer count: 2
score: 5
accepted answer: http://stackoverflow.com/a/27395739
downvote count: 0
favorite count: 0
tagged with: testfx
has answer: http://stackoverflow.com/a/27395739
tagged with: unit-testing
type: AnsweredQuestion
has body: I'm having some trouble getting TestFx working with Oracle's JavaFx HelloWorld app: public class HelloWorld extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) { primaryStage.setTitle("Hello World!"); Button btn = new Button(); btn.setText("Say 'Hello World'"); btn.setOnAction(new EventHandler&lt;ActionEvent&gt;() { @Override public void handle(ActionEvent event) { System.out.println("Hello World!"); } }); StackPane root = new StackPane(); root.getChildren().add(btn); primaryStage.setScene(new Scene(root, 300, 250)); primaryStage.show(); } } TestFx junit test: class MyTest extends GuiTest { public Parent getRootNode() { return nodeUnderTest; } What should nodeUnderTest be for this example?
upvote count: 5
tagged with: java
tagged with: javafx
has title: Getting started with TestFx
possible better answer: http://stackoverflow.com/a/27803267
has answer: http://stackoverflow.com/a/27803267
type: Question

http://stackoverflow.com/comment/43207808
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27348779
has text: @Arsham I am using Eclipse on a mac, is there an equivalent?

http://stackoverflow.com/comment/43088503
type: Comment
type: QuestionComment
has text: check pDialog is not null before dismiss from onPostExecute.
score: 0
comment on: http://stackoverflow.com/q/27314087

http://stackoverflow.com/a/27345789
type: Answer
accepted answer of: http://stackoverflow.com/q/27334394
score: 0
answers question: http://stackoverflow.com/q/27334394
has body: you are having too many imageviews which tend to have for example 925 * 1300 kinda like dimension, now this will not always run on some devices but maybe run or will run on tablets..so trim your images and it will work all the time.. if it will be suitable trim your images and put the original size in your xxxhdpi folder, and trim the images to smaller sizes and put it in your maybe hdpi folder.. or maybe if you have created a "drawable" folder place it in.. so that the android os will call for the trimed images on smaller sized phones on call the bigger image on tablet kinda phones OR to make things easier google "supporting screen sizes in android" you will get a better foresight on how to go about this in terms of re-sizing the images for phones and tablets ok. As i said, for rep sake.. be good..
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43149496

http://stackoverflow.com/comment/43144027
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27344206
has text: So... what is your question?

http://stackoverflow.com/q/27343815
score: -1
has body: I am having this error: Exception in thread "main" java.lang.ClassNotFoundException: com.msql.jdbc.Driver at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at test.main(test.java:12) And this is my code: import java.sql.*; import com.mysql.jdbc.Statement; public class test { public static void main(String[] args) throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException { String url = "jdbc:mysql://localhost:3306/test"; Statement sql; ResultSet rs; Class.forName("com.msql.jdbc.Driver").newInstance(); Connection con = DriverManager.getConnection(url, "root", "root"); sql = (Statement) con.createStatement(); rs = sql.executeQuery("select*from persoane"); while (rs.next()) { System.out.println("id=" + rs.getInt("Id") + ", name= " + rs.getString("name") + ", age=" + rs.getInt(3)); } } } I don't understand why. I created my project, I went to Project, Project Properties, Libraries, Add External Jars and added mysql-connector-java-5.1.34-bin
tagged with: java
has title: Can't connect my Java App with my SQL Database
tagged with: mysql
tagged with: mysql-connector
downvote count: 1
type: Question
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27343830
favorite count: 0
type: UnansweredQuestion

servlets
tags question: http://stackoverflow.com/q/27322818
tags question: http://stackoverflow.com/q/27398030
tags question: http://stackoverflow.com/q/27314976
tags question: http://stackoverflow.com/q/27381042
tags question: http://stackoverflow.com/q/27434806
tags question: http://stackoverflow.com/q/27340829
tags question: http://stackoverflow.com/q/27331607
tags question: http://stackoverflow.com/q/27422788
tags question: http://stackoverflow.com/q/27417494
tags question: http://stackoverflow.com/q/27400747
tags question: http://stackoverflow.com/q/27441773
tags question: http://stackoverflow.com/q/27409883
tags question: http://stackoverflow.com/q/27332811
tags question: http://stackoverflow.com/q/27423844
tags question: http://stackoverflow.com/q/27417363
tags question: http://stackoverflow.com/q/27428623
tags question: http://stackoverflow.com/q/27315006
tags question: http://stackoverflow.com/q/27423353
tags question: http://stackoverflow.com/q/27326953
tags question: http://stackoverflow.com/q/27373836
tags question: http://stackoverflow.com/q/27372294
tags question: http://stackoverflow.com/q/27390089
tags question: http://stackoverflow.com/q/27346683
tags question: http://stackoverflow.com/q/27423541
tags question: http://stackoverflow.com/q/27344048
tags question: http://stackoverflow.com/q/27344766
tags question: http://stackoverflow.com/q/27325234
tags question: http://stackoverflow.com/q/27356075
tags question: http://stackoverflow.com/q/27344005
tags question: http://stackoverflow.com/q/27369840
tags question: http://stackoverflow.com/q/27445101
tags question: http://stackoverflow.com/q/27410847
tags question: http://stackoverflow.com/q/27334637
tags question: http://stackoverflow.com/q/27397382
tags question: http://stackoverflow.com/q/27412367
tags question: http://stackoverflow.com/q/27340938
tags question: http://stackoverflow.com/q/27361612
tags question: http://stackoverflow.com/q/27399564
tags question: http://stackoverflow.com/q/27437566
tags question: http://stackoverflow.com/q/27366445
tags question: http://stackoverflow.com/q/27350064
tags question: http://stackoverflow.com/q/27373426
tags question: http://stackoverflow.com/q/27407985
tags question: http://stackoverflow.com/q/27397326
tags question: http://stackoverflow.com/q/27419893
tags question: http://stackoverflow.com/q/27396478
tags question: http://stackoverflow.com/q/27462755
tags question: http://stackoverflow.com/q/27339078
tags question: http://stackoverflow.com/q/27449140
tags question: http://stackoverflow.com/q/27472955
tags question: http://stackoverflow.com/q/27465040
tags question: http://stackoverflow.com/q/27369146
tags question: http://stackoverflow.com/q/27342333
tags question: http://stackoverflow.com/q/27471665
tags question: http://stackoverflow.com/q/27344863
tags question: http://stackoverflow.com/q/27459207
tags question: http://stackoverflow.com/q/27398849
tags question: http://stackoverflow.com/q/27339933
tags question: http://stackoverflow.com/q/27337621
tags question: http://stackoverflow.com/q/27405555
tags question: http://stackoverflow.com/q/27433844
tags question: http://stackoverflow.com/q/27359930
tags question: http://stackoverflow.com/q/27457663
tags question: http://stackoverflow.com/q/27463092
tags question: http://stackoverflow.com/q/27405275
tags question: http://stackoverflow.com/q/27375192
tags question: http://stackoverflow.com/q/27426553
tags question: http://stackoverflow.com/q/27400671
tags question: http://stackoverflow.com/q/27473673
tags question: http://stackoverflow.com/q/27335512
tags question: http://stackoverflow.com/q/27434168
tags question: http://stackoverflow.com/q/27405463
tag name: servlets
tags question: http://stackoverflow.com/q/27459747
tags question: http://stackoverflow.com/q/27452141
tags question: http://stackoverflow.com/q/27346332
tags question: http://stackoverflow.com/q/27333056
tags question: http://stackoverflow.com/q/27408125
tags question: http://stackoverflow.com/q/27366384
tags question: http://stackoverflow.com/q/27337404

http://stackoverflow.com/comment/95815429
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27485941
has text: I will post an answer with sample code. It does not have to be done within the JRE.
type: Comment

http://stackoverflow.com/comment/43235717
comment on: http://stackoverflow.com/q/27394353
type: Comment
type: QuestionComment
score: 1
has text: This question appears to be off-topic because it is about a matter that can be answered by looking at the new tag added.

http://stackoverflow.com/q/27389561
downvote count: 0
favorite count: 0
tagged with: list
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43227105
has body: Let's say I have a JSONArray called table in json-simple-1.1.1. I want to truncate it to a maximum number of values. To do so, I take a sub-set and reassign it like so: List&lt;Object&gt; rows = this.table.subList(0, newSize); table.clear(); table.addAll(rows); However, doing this results in a java.util.ConcurrentModificationException on the table.addAll(rows) line. The kicker is, that there is only one thread. From reading about the exception on Oracle, it's evident that I'm doing some kind of invalid operation here, but I'm not sure what. Here's code that will produce the error: package recordIndexer.server.importer; import java.util.List; import org.json.simple.JSONArray; import org.json.simple.JSONValue; public class Main { public static void main(String[] args) { JSONArray j = (JSONArray)JSONValue.parse("[\"Hello\", \"world\"]"); List&lt;Object&gt; sub = j.subList(0, 1); j.clear(); j.addAll(sub); } }
tagged with: json-simple
upvote count: 1
has comment: http://stackoverflow.com/comment/43227227
score: 1
tagged with: java
has title: Truncating a JSONArray in java json simple
type: Question
has comment: http://stackoverflow.com/comment/43227192
has comment: http://stackoverflow.com/comment/43227207

http://stackoverflow.com/comment/43670601
type: Comment
has text: What if the predicate can only be constructed when the condition is met? That will be the case in enough cases, that's one reason why such an approach is problematic in the API, but feel free to customize JPAQuery to your needs.
comment on: http://stackoverflow.com/a/27389398
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43138387
comment on: http://stackoverflow.com/a/27341173
score: 0
type: AnswerComment
type: Comment
has text: `percent90OrMore` must return double or float.

validation
tags question: http://stackoverflow.com/q/27423353
tags question: http://stackoverflow.com/q/27471781
type: Tag
tag name: validation
tags question: http://stackoverflow.com/q/27466200
tags question: http://stackoverflow.com/q/27325239
tags question: http://stackoverflow.com/q/27346075
tags question: http://stackoverflow.com/q/27470665
tags question: http://stackoverflow.com/q/27372294
tags question: http://stackoverflow.com/q/27326958
tags question: http://stackoverflow.com/q/27470278

http://stackoverflow.com/q/27407371
has answer: http://stackoverflow.com/a/27407845
tagged with: android
has body: I m working in an android project. This project contains many activities. I m trying to remove the system bar (footer bar) from one fo the existing activities So I added the following lines in the AndroidManifest.xml under the &lt;manifest&gt; tag: &lt;category android:name="android.intent.category.HOME" /&gt; &lt;uses-permission android:name="android.permission.EXPAND_STATUS_BAR"/&gt; and in the related activity java file I added the following line under the OnCreate method sessionView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE); But The system bar (footer bar) is not removed. My Android version is 4.2.2 Am I missing something?
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/21164836
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43259274
has title: How to remove system bar of android (footer bar)
has answer: http://stackoverflow.com/a/27421778
possible better answer: http://stackoverflow.com/a/27407976
has answer: http://stackoverflow.com/a/27407976
score: 0
answer count: 3
linked to: http://stackoverflow.com/q/12605266
favorite count: 0
accepted answer: http://stackoverflow.com/a/27421778

http://stackoverflow.com/comment/43131406
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27337363
has text: There is no `method()` on anything but your anonymous inner class, if you correct it, it will just recurse and crash. You admit that correcting it makes it correct. How it is no is invalid code.
type: AnswerComment

http://stackoverflow.com/comment/43173583
type: Comment
has text: wow down vote on a correct but not perfect answer. Amazing :)
type: AnswerComment
comment on: http://stackoverflow.com/a/27360746
score: 0

http://stackoverflow.com/comment/43237229
type: Comment
comment on: http://stackoverflow.com/a/27395066
has text: @JonnyHenly sir i just update the question ady,along with the new error..tq
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43137928
type: QuestionComment
has text: you can use your name or your application name. i.e Log.d("shanling", "value = " + randomRGB);
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27340999

http://stackoverflow.com/comment/43278128
has text: override the equals method provided by default by the Object class
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27417376
type: Comment

http://stackoverflow.com/q/27405480
has answer: http://stackoverflow.com/a/27405794
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/43256350
type: Question
score: -2
has comment: http://stackoverflow.com/comment/43255686
has title: save and access data from a map inside of another map
upvote count: 0
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43255869
type: UnansweredQuestion
has body: I have a problem saving and accessing data from a map which is inside another map. Map&lt;String, Integer&gt; Mapname=new LinkedHashMap&lt;String, Integer&gt;(); Mapname.put("hello",2); Mapname.put("bye",3); Map&lt;String, Map&lt;String,Integer&gt; OutsiderMap = new LinkedHashMap&lt;String, Map&lt;String, Integer&gt;&gt;(); String s="name"; OutsiderMap.put(s,Mapname); for (Map.Entry&lt;String, Map&lt;String,Integer&gt;&gt; entry : OutsiderMap.entrySet()) { Map&lt;String,Integer&gt; innermap; innermap=entry.getValue(); for (Map.Entry&lt;String, Integer&gt; entry2 : innermap.entrySet()) { } } Output should be: Should print the Outsider map not the inner map Output now: s={}; My output right now is the name of the string s={}. So my oustider map is empty. Can you please tell me what is wrong?
has comment: http://stackoverflow.com/comment/43255787

http://stackoverflow.com/q/27411136
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27411283
has title: How to see test failed in mvn
answer count: 1
score: 0
linked to: http://stackoverflow.com/q/19966620
has comment: http://stackoverflow.com/comment/43266728
has answer: http://stackoverflow.com/a/27411283
tagged with: maven
has body: I have one single simple test public class SimpleCheck { @Test public void check(){ assertTrue(1 &lt; 0); } } I run mvn test and see following message. [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ check-check --- [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1.024 s [INFO] Finished at: 2014-12-10T23:25:13+02:00 [INFO] Final Memory: 8M/245M [INFO] ------------------------------------------------------------------------ As you noticed this test will fails, however i don't see any failures at least. I have clean pom.xml with just one junit dependency. How to see failures? EDIT: I found the solution - i should simply name it with *Test prefix. My test was Check, and now it is CheckTest.
type: AnsweredQuestion

http://stackoverflow.com/a/27339643
answers question: http://stackoverflow.com/q/27339609
has comment: http://stackoverflow.com/comment/43135915
type: AcceptedAnswer
downvote count: 0
upvote count: 2
has body: You are not updating index within your while loop. Add this line at the end of your loop: index = myScanner.nextInt(); after System.out.println("Which employee number do you want to see --&gt;");
type: Answer
has comment: http://stackoverflow.com/comment/43135951
score: 2
has comment: http://stackoverflow.com/comment/43135872
has comment: http://stackoverflow.com/comment/43135851
accepted answer of: http://stackoverflow.com/q/27339609

http://stackoverflow.com/comment/43105396
has text: @KickButtowsk nope - just didn't notice your comment when I started typing mine `-)
comment on: http://stackoverflow.com/a/27323029
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43289426
type: Comment
has text: This solution suites my needs at present, Thank you
comment on: http://stackoverflow.com/a/27422998
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43289471
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27423431
has text: Ah I missed you problem to some extent: The qustion to the user can have three outcomes KEEP, SAVE and DROP. I am updating my answer accordingly.

http://stackoverflow.com/comment/43349196
comment on: http://stackoverflow.com/q/27455662
score: 0
has text: possible duplicate of [Scanner double value - InputMismatchException](http://stackoverflow.com/questions/17150627/scanner-double-value-inputmismatchexception)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27347259
score: 0
type: Answer
has body: If you want to cache your HQL quert result, you have to instrument your query: List&lt;Foo&gt; result = session .createQuery("select p from Foo p order ... ") .setCacheable(true) .list(); Additionaly you can tell Hibernate, which cache configuration (cache region) it should use: List&lt;Foo&gt; result = session .createQuery("select p from Foo p order ... ") .setCacheable(true) .setCacheRegion("foo_region") .list(); Of course, global setting hibernate.cache.use_query_cache must be set to true. @Cache annotation on entity class is used to cache single entity when it is fetched by ID: Foo foo = session.get(Foo.class, fooId);
answers question: http://stackoverflow.com/q/27346702

http://stackoverflow.com/q/27354384
has answer: http://stackoverflow.com/a/27441735
tagged with: comments
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: word-wrap
has body: How can I ensure that the comment holder will be big enough to show the comment? I've searched for some property like wrap text, but I had no luck. if(drawingPatriarch == null) { drawingPatriarch = sh.createDrawingPatriarch(); } HSSFClientAnchor anchor = new HSSFClientAnchor(); anchor.setCol1(cell.getColumnIndex()); anchor.setCol2(cell.getColumnIndex()+1); anchor.setRow1(row.getRowNum()); anchor.setRow2(row.getRowNum()+3); Comment cellComment = drawingPatriarch.createCellComment(anchor); cellComment.setString(new HSSFRichTextString(comment)); if(author != null) cellComment.setAuthor(author); cell.setCellComment(cellComment);
tagged with: apache-poi
tagged with: java
tagged with: excel
type: Question
has title: Apache poi excel comments wrap text

http://stackoverflow.com/comment/43147111
has text: Well, if you changed to `guessloop`, that means that your actual human guess isn't updating it, right? (Hard to tell without seeing your changed code in front of me.) In that case, the loop condition will always stay true, and so you won't exit the loop.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27345590
type: Comment

http://stackoverflow.com/comment/43363345
comment on: http://stackoverflow.com/a/27460293
score: 0
type: Comment
has text: It's supposed to be http streaming which I've never dealt with until recently. I was using URL.openStream() to receive my data because it didn't close out my request prematurely... unlike the httpclient connection.
type: AnswerComment

http://stackoverflow.com/a/27773621
has body: How about create some flag and set it when necessary? if (completed) { try { Utils.sleep(pollIntervalInMilliseconds); } catch (InterruptedException e) { // Do nothing } return; }
type: Answer
answers question: http://stackoverflow.com/q/27354438
score: 0

http://stackoverflow.com/comment/43305649
has text: Im sure you are frustrated with me, everywhere I move it too I get even more errors than before. sorry :/ im so lost on where its supposed to go...
type: Comment
comment on: http://stackoverflow.com/a/27430536
score: 0
type: AnswerComment

http://stackoverflow.com/q/27382202
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43213874
has comment: http://stackoverflow.com/comment/43273783
has title: Android ImageLoader, how to set image in ViewPager as WallPaper
upvote count: 2
tagged with: wallpaper
favorite count: 0
has body: Hi I am using nostra13/Android-Universal-Image-Loader library. What I want to do is when a Image is loaded in the ViewPager it will set it as wallpaper. The problem that I am having it that. when I load image 2. the image 1 get set to wallpaper or sometimes a ramdom image. here is my code: ... @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i(TAG, "onCreate"); options = new DisplayImageOptions.Builder() .showImageForEmptyUri(R.drawable.ic_empty) .showImageOnFail(R.drawable.ic_error) .resetViewBeforeLoading(true) .cacheOnDisk(true) //.imageScaleType(ImageScaleType.EXACTLY) .imageScaleType(ImageScaleType.EXACTLY_STRETCHED) .bitmapConfig(Bitmap.Config.RGB_565) .considerExifParams(true) .displayer(new FadeInBitmapDisplayer(300)) .build(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.custom_fr_image_pager, container, false); ViewPager pager = (ViewPager) rootView.findViewById(R.id.pager); Log.i(TAG, "onCreateView"); imageUrls = null; pager.setAdapter(new ImageAdapter()); pager.setCurrentItem(getArguments().getInt(Constants.Extra.IMAGE_POSITION, 0)); return rootView; } //------------------------------------------------------------------------------------------------------ // ImagePagerAdapter //------------------------------------------------------------------------------------------------------ private class ImageAdapter extends PagerAdapter { private LayoutInflater inflater; ImageAdapter() { inflater = LayoutInflater.from(getActivity()); } @Override public void destroyItem(ViewGroup container, int position, Object object) { container.removeView((View) object); } @Override public int getCount() { return imageUrls.length; } @Override public Object instantiateItem(ViewGroup view, int position) { View imageLayout = inflater.inflate(R.layout.item_pager_image, view, false); assert imageLayout != null; imageView = (Ima…
type: UnansweredQuestion
tagged with: android
score: 2
has comment: http://stackoverflow.com/comment/43213286
tagged with: view
answer count: 0
downvote count: 0
tagged with: universal-image-loader

http://stackoverflow.com/q/27385593
has answer: http://stackoverflow.com/a/27386990
has body: When following this tutorial, I have imported the library by putting this into gradle: compile 'com.google.zxing:core:3.1.0' compile 'com.google.zxing:android-integration:3.1.0' However when I paste the Activity in the manifest e.g. : <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.DEFAULT"/> <action android:name="com.google.zxing.client.android.SCAN"/> <category android:name="android.intent.category.DEFAULT"/> I get an error "com.google.zxing.client.android.CaptureActivity" not found and cannot be resolved. Has anyone else tried implementing this in AS?
answer count: 2
has title: "com.google.zxing.client.android.CaptureActivity" not found and cannot be resolved
downvote count: 0
has answer: http://stackoverflow.com/a/29095321
favorite count: 0
tagged with: android
possible better answer: http://stackoverflow.com/a/29095321
tagged with: zxing
upvote count: 1
accepted answer: http://stackoverflow.com/a/27386990
type: Question
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/comment/43124409
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27333509
has text: I never used Singleton, I don't know how it is working but I will try it. Thanks.
type: Comment

http://stackoverflow.com/q/27336936
has comment: http://stackoverflow.com/comment/43229859
answer count: 1
downvote count: 0
tagged with: prettyfaces
has title: PrettyFaces Redirect Loop on invalid URLs
favorite count: 0
has comment: http://stackoverflow.com/comment/43163597
has comment: http://stackoverflow.com/comment/43162520
has answer: http://stackoverflow.com/a/28281206
has comment: http://stackoverflow.com/comment/43177468
type: UnansweredQuestion
tagged with: google-app-engine
upvote count: 1
has comment: http://stackoverflow.com/comment/43170130
score: 1
tagged with: java
has body: I am working on a web application based on Java and JSF2.0 and I am using Google AppEngine to host it. I am using PrettyFaces for modifying the URLs. Since I started using PrettyFaces, if someone enters an invalid URL, redirect looping occurs like the following: www.example.com is the website so if you enter www.example.com/invalidasdas it keeps appending index.jsp to the end of the invalid URL such as : www.example.com/invalidasdas/index.jsp/index.jsp/index.jsp/index.jsp/index.jsp I am not sure how I can fix this problem. Any suggestions to fix this would be nice. I can post my code if needed. PrettyFaces Configuration: <view-id value="/index.jsf" /> <view-id value="/blog.jsf" /> <view-id value="/stockpicks.jsf" /> <view-id value="/adminlogin.jsf" /> <view-id value="/dashboard.jsf" /> <view-id value="/WEB-INF/error.jsf" /> <view-id value="/search.jsf"/> And here's my web.xml file! <?xml version="1.0" encoding="utf-8"?> index.jsf javax.faces.PROJECT_STAGE Production Faces Servlet javax.faces.webapp.FacesServlet 1 Faces Servlet *.jsf Faces Servlet /resources/* State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2 javax.faces.STATE_SAVING_METHOD client javax.servlet.jsp.jstl.fmt.localizationContext resources.application com.sun.faces.config.ConfigureListener eot application/vnd.ms-fontobject otf font/opentype ttf application/x-font-ttf woff application/x-font-woff svg image/svg+xml javax.faces.WEBAPP_RESOURCES_DIRECTORY /WEB-INF/resources javax.faces.application.CONFIG_FILES /WEB-INF/faces-config.xml 404 /error/ 10080 10080 PrettyFilter com.ocpsoft.pretty.PrettyFilter PrettyFilter /* FORWARD REQUEST ERROR AuthenticationFilter filters.AuthenticationFilter AuthenticationFilter /dashboard/* /dashboard.jsf FORWARD REQUEST Restrict direct access to XHTML files <web-resource-collection> XHTML files *.xhtml </web-resource-collection> <auth-constraint /> EDIT: It turns out that the issue is AppEngine and not PrettyFaces. Please stop editing posts w…
has comment: http://stackoverflow.com/comment/43226172
type: Question
tagged with: jsf-2
has comment: http://stackoverflow.com/comment/43184644
has comment: http://stackoverflow.com/comment/43259092

http://stackoverflow.com/comment/43098128
comment on: http://stackoverflow.com/a/27319044
score: 0
type: AnswerComment
has text: @user3001634 Make sure the buttons are not part of the scrollpane. I don't see why it would vanish otherwise. If it continues, a new question might be applicable as the original problem is technically solved.
type: Comment

http://stackoverflow.com/comment/43134051
has text: these static numbers ROW_SIZE given to me. which is = 10, and COLUMN_SIZE i put a random number which is 5;
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27338669

http://stackoverflow.com/a/27333948
score: 17
answers question: http://stackoverflow.com/q/27333879
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/73877481
has body: If you look at the Java Documentation in 10.4: Arrays must be indexed by int values; short, byte, or char values may also be used as index values because they are subjected to unary numeric promotion (§5.6.1) and become int values. An attempt to access an array component with a long index value results in a compile-time error. The error you would get would look something like this: test.java:12: possible loss of precision found : long required: int System.out.println(array[index]); ^ 1 error If for some reason you have an index stored in a long, just cast it to an int and then index your array. You cannot create an array large enough so it cannot be indexed by an integer in Java. So there is no need for long integers here.
type: Answer
accepted answer of: http://stackoverflow.com/q/27333879
has comment: http://stackoverflow.com/comment/43125112
upvote count: 17

http://stackoverflow.com/comment/43204703
comment on: http://stackoverflow.com/a/27375038
score: 0
type: Comment
has text: check the answer to that comment please.
type: AnswerComment

http://stackoverflow.com/q/27411071
has title: Java: How to create a specific class instance?
has answer: http://stackoverflow.com/a/27448636
score: 0
answer count: 1
tagged with: generics
has comment: http://stackoverflow.com/comment/43266802
accepted answer: http://stackoverflow.com/a/27448636
type: AnsweredQuestion
tagged with: reflection
has comment: http://stackoverflow.com/comment/43267593
tagged with: java
has comment: http://stackoverflow.com/comment/43266555
has body: I have a method with signature &lt;T extends AbstractClass&gt; T method(Class&lt;T&gt; abstractClass) and I cannot modify the signature. Also I have a string with class name com.test.MyClass. Is it possible to create a class by class name to pass to my method? Something like that Class&lt;? extends AbstractClass&gt; clz = (Class&lt;? extends AbstractClass&gt;) Class.forName(classNameStr);
type: Question
has comment: http://stackoverflow.com/comment/43266527

http://stackoverflow.com/comment/43232901
score: 0
has text: @MadProgramer...Thanks, that helpful.
comment on: http://stackoverflow.com/a/27392062
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27437834
score: -2
possible better answer: http://stackoverflow.com/a/27437890
has comment: http://stackoverflow.com/comment/43315995
accepted answer: http://stackoverflow.com/a/27437858
downvote count: 4
has body: Error in String.... My error: C:\Users\Kiran\Desktop\java\bin&gt;javac String.java String.java:7: error: incompatible types String text = "Hello"; ^ required: String found: java.lang.String String.java:9: error: incompatible types String blank = " "; ^ required: String found: java.lang.String String.java:11: error: incompatible types String name = "Kiran"; ^ required: String found: java.lang.String String.java:13: error: bad operand types for binary operator '+' String message = text + blank + name; ^ first type: String second type: String 4 errors My program: public class String { public static void main(String args[]) { int myNumber = 7; String text = "Hello"; String blank = " "; String name = "Kiran"; String message = text + blank + name; System.out.println(message); System.out.println("Hello Java" + " " + "Iam Kiran"); System.out.println("my integer is : " +myNumber); double myDouble = 7.8; System.out.println("my number is: " + myDouble + "!!"); } } I don't know why this error coming. I wrote approximately Right. But it still keeps coming. My java program is in Desktop.
has answer: http://stackoverflow.com/a/27437910
tagged with: string
answer count: 4
favorite count: 0
upvote count: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27437858
has comment: http://stackoverflow.com/comment/43315917
tagged with: java
has answer: http://stackoverflow.com/a/27437890
type: Question
has answer: http://stackoverflow.com/a/27437966
has title: Compilation error "incompatible types" in a Java class named String

http://stackoverflow.com/a/27465661
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43367445
answers question: http://stackoverflow.com/q/27465582
type: AcceptedAnswer
has body: public static void printArray(int[] arr) { int size = arr.length; System.out.print("["); for(int i=0;i&lt; size; i++){ System.out.print(arr[i]); if(i&lt;size-1){ System.out.print(","); } } System.out.println("]"); } Arrays.toString(arr) will be better usually but your question says "loop through array".
accepted answer of: http://stackoverflow.com/q/27465582

http://stackoverflow.com/a/27360238
has body: Getting this information after you've only got an OutputStream variable feels like the wrong approach to me. After all, there's no guarantee that an OutputStream is writing to a file at all - it could be a ByteArrayOutputStream or writing to a socket. You can get this information before you create the FileOutputStream though. For example: File file = new File("test.txt"); System.out.println("Absolute path: " + file.getAbsolutePath()); Or Path path = Paths.get("text.txt"); System.out.println("Absolute path: " + path.toAbsolutePath()); ... then create the FileOutputStream based on that.
upvote count: 5
type: Answer
downvote count: 0
score: 5
answers question: http://stackoverflow.com/q/27360141

http://stackoverflow.com/a/27442640
answers question: http://stackoverflow.com/q/27442206
has body: This is wildly unsafe and just there to make client's life easier (Edit: By the way, your compiler / IDE should also add a warning. This is not an error for backwards compatibility reasons). You don't even need myClassInstance.&lt;Vehicle&gt;getMyVariable(), you can just myClassInstance.getMyVariable() (as long as you store it into a variable of type Vehicle or return it from a method that returns Vehicle. In both cases, the type is inferred). A safer approach is to pull the type parameter into the class, which can then ensure that any MyClass&lt;Vehicle&gt; only holds Vehicles at compile time.
accepted answer of: http://stackoverflow.com/q/27442206
downvote count: 0
score: 4
type: AcceptedAnswer
type: Answer
upvote count: 4

http://stackoverflow.com/a/27450237
score: 1
upvote count: 1
has body: In onPageFinished, store the URL to system preferences (or somewhere else). Then, in onCreateView, retrieve this value, and if not null, use it as the url to load.
answers question: http://stackoverflow.com/q/27446125
downvote count: 0
type: Answer

http://stackoverflow.com/comment/43366287
comment on: http://stackoverflow.com/a/27464938
score: 0
has text: Thanks but I don't think my teacher would be happy with that. Surely there must be some way to eliminate the ambiguity?
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43277264
comment on: http://stackoverflow.com/a/27416808
score: 0
type: AnswerComment
type: Comment
has text: a) who said I downvoted? b) why do you think the OP is using windows?

http://stackoverflow.com/comment/43129850
has text: If the string is like this = 15,15,15,11,15,15,15,15,15,12, i want the output will become 15(3)11(1)15(5)12(1) , even the no 15 appear 2 times.
comment on: http://stackoverflow.com/q/27336506
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43320597
has text: @EJP In here between proxy server and hosts do we have create socket per request from proxy server side
type: QuestionComment
comment on: http://stackoverflow.com/q/27437177
score: 0
type: Comment

http://stackoverflow.com/a/27412198
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/43271957
has body: An int[] array maps most naturally to a List&lt;Integer&gt;. Unfortunately, there is no built-in way to convert directly from an int array to an Integer list, due to the boxing that is required. You'll have to build the List manually. int[] things = {11, 22, 33, 44}; List&lt;Integer&gt; list = new ArrayList&lt;&gt;(); for (int i: things) { list.add(i); } int n = list.get(1); System.out.println(n); The excellent Guava library from Google has a convenience method you could use, if you're willing to rely on a third-party library call. int[] things = {11, 22, 33, 44}; List&lt;Integer&gt; list = Ints.asList(things); int n = list.get(1); System.out.println(n); Or if your goal is simply to get a List of numbers, you could skip the intermediate array. List&lt;Integer&gt; list = Arrays.asList(11, 22, 33, 44);
answers question: http://stackoverflow.com/q/27412070
upvote count: 2
has comment: http://stackoverflow.com/comment/43268866
downvote count: 0

http://stackoverflow.com/q/27361612
has comment: http://stackoverflow.com/comment/43216659
has comment: http://stackoverflow.com/comment/43214557
tagged with: jdbc
has comment: http://stackoverflow.com/comment/43215582
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43215209
tagged with: java
tagged with: servlets
type: Question
has title: Do I require a 64-bit version of sqljdbc4.jar
answer count: 1
has body: We have a Java servlet running on Windows through Tomcat and a recent SQL server database migration caused issues that have so far been resolved by upgrading the sqljdbc to sqljdbc4.jar. This has worked fine on 32bit operating systems but it still seems to hang and timeout on a 64 bit server. The top error message in the logs is; org.hibernate.exception.GenericJDBCException: Cannot open connection Is there a 64bit version of this driver? So far I have not found one. Is there something else that I have configured wrong?
tagged with: sql-server
score: 0
has comment: http://stackoverflow.com/comment/43207125
has answer: http://stackoverflow.com/a/27361804

http://stackoverflow.com/q/27416346
tagged with: algorithm
tagged with: java
linked to: http://stackoverflow.com/q/16086958
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43276448
has comment: http://stackoverflow.com/comment/92806151
has title: How do I create a Binary Search Tree from a General tree
has body: As the title states. I am trying to create a binary search tree from a general tree that I have created. The code for my general node class is: Node&lt;E&gt; parent; E data; ArrayList&lt;Node&lt;E&gt;&gt; children = new ArrayList&lt;Node&lt;E&gt;&gt;(); public Node(E data){ this.data = data; } public ArrayList&lt;Node&lt;E&gt;&gt; getChildren(){ return this.children; } public void addChild(Node child){ int counter = 0; for (int i = 0; i &lt; children.size(); i++){ if (child.toString().equals(children.get(i).toString())){ System.out.println("already exists"); counter++; } } if (counter &gt; 0){} else{ children.add(child); } } public void removeChild(Node&lt;E&gt; child){ children.remove(child); } public Node&lt;E&gt; getChild(Node&lt;E&gt; child){ for (int i = 0; i &lt; children.size(); i++){ if (children.get(i) == child){ return child; } } return null; } public void setParent(Node parent){ this.parent = parent; } public Node&lt;E&gt; getParent(){ return this.parent; } public boolean isDirectory(Node node){ if (data == node.data){ return false; } return true; } public boolean hasChildren(){ return getChildren() != null; } public E getData(){ return this.data; } public String toString(){ return data.toString(); } }//end class And my tree class is full of methods to the brim, so to save all you guys the eye strain, my tree class consists of a root and the constructor which sets the root as the root of the tree. I know that to convert the general tree to the binary search tree, i must set my general tree root to the root of the binary search tree. My question is then where do i go from there? How do i traverse my general tree to add the nodes to the binary search tree? Any help would be appreciated.
has answer: http://stackoverflow.com/a/27419205
tagged with: binary-search-tree
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43277851
type: Question
tagged with: tree

http://stackoverflow.com/comment/43257244
type: QuestionComment
has text: I can remove that Shri
comment on: http://stackoverflow.com/q/27400290
score: 0
type: Comment

http://stackoverflow.com/a/27404210
has comment: http://stackoverflow.com/comment/43263411
has comment: http://stackoverflow.com/comment/43265141
has comment: http://stackoverflow.com/comment/73084901
has body: The computers will need to be on the same network or their IP address will need to be accessible to the internet. If you are in windows, you can find the local IP address by opening a cmd window (press windows key + R then type cmd) and running ipconfig. On linux (maybe it works on Mac as well) you can run ifconfig in a terminal. If your computers are on the same local area network you should be able to use the IP addresses indicated by those commands. If they are not on the same local area network, a router in between the computers may have a firewall policy which is blocking the connection.
has comment: http://stackoverflow.com/comment/43292321
upvote count: 1
answers question: http://stackoverflow.com/q/27403964
type: Answer
has comment: http://stackoverflow.com/comment/43266041
has comment: http://stackoverflow.com/comment/43290976
downvote count: 0
score: 1

http://stackoverflow.com/q/27456194
tagged with: listview
answer count: 1
tagged with: adapter
score: 0
has comment: http://stackoverflow.com/comment/43354072
tagged with: android
has comment: http://stackoverflow.com/comment/43357953
has body: I'm parsing a web service to display in a listView backed by my own subclass of ArrayAdapter. The data is static ArrayList&lt;Wait&gt; in Application.java. You'll see it referenced by App.getWaits(). I use a simple refresh method for when there's new data. I've confirmed that it's being updated but it only renders if I navigate away and then return to the view. In the past I've been able to refresh the listView by calling notifyDataSetChanged() on the adapter but right now none of these have worked for me. Thanks for taking a look... any ideas!? //1 This is how I'd normally update the listView dynamically, but not tonight. adapter.notifyDataSetChanged(); //2 It's the same thing really, so no good. ((WaitAdapter) list.getAdapter()).notifyDataSetChanged(); //3 Saw this as the answer to a similar question, doesn't work. adapter.getWaits().clear(); adapter.getWaits().addAll(App.getWaits()); adapter.notifyDataSetChanged(); //4 Called in onCreate but tried a 2nd time in refresh() to manually reset adapter, doesn't work. adapter = new WaitAdapter(getHost().getApplicationContext(), App.getWaits()); list.setAdapter(adapter); //5 Kinda the same thing, new adapter, reset adapter... also no good. WaitAdapter adapter = new WaitAdapter(getHost().getApplicationContext(), App.getWaits()); list.setAdapter(adapter); //6 I read ArrayAdapter keeps its own reference to initial data object but this fails too. adapter = null; adapter = new WaitAdapter(getHost().getApplicationContext(), App.getWaits()); list.setAdapter(adapter); *Update to share my WaitAdapter.java. public class WaitAdapter extends ArrayAdapter&lt;Wait&gt; { private LayoutInflater inflater; private ArrayList&lt;Wait&gt; waits; public WaitAdapter(Context context, ArrayList&lt;Wait&gt; data) { super(context, R.layout.list_item_wait, data); inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); waits = data; } @Override public View getView(int position, View convertView, ViewGroup parent) { Vie…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27456569
has comment: http://stackoverflow.com/comment/43361760
type: Question
has comment: http://stackoverflow.com/comment/43357975
has title: Refresh ListView with ArrayAdapter
has comment: http://stackoverflow.com/comment/43350426
tagged with: android-arrayadapter
tagged with: java

http://stackoverflow.com/a/27447889
score: 0
has body: import java.io.File; 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; public class XPathTest { public static void main(String args[]) { try { File Employee = new File("Employee.xml"); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); Document doc = dBuilder.parse(Employee); doc.getDocumentElement().normalize(); System.out.println("root of xml file" + doc.getDocumentElement().getNodeName()); NodeList nodes = doc.getElementsByTagName("Employee"); System.out.println("=========================="); for (int i = 0; i &lt; nodes.getLength(); i++) { Node node = nodes.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { Element element = (Element) node; System.out.println("Employee Age: " + getValue("age", element)); System.out.println("Employee Name: " + getValue("name", element)); System.out.println("Employee Gender: " + getValue("gender", element)); System.out.println("Employee Role: " + getValue("role", element)); } } } catch (Exception ex) { ex.printStackTrace(); } } private static String getValue(String tag, Element element) { NodeList nodes = element.getElementsByTagName(tag).item(0).getChildNodes(); Node node = (Node) nodes.item(0); return node.getNodeValue(); } } went onto change everything and now it works, brought in xml values without a problem
answers question: http://stackoverflow.com/q/27434486
type: Answer

http://stackoverflow.com/comment/43364700
comment on: http://stackoverflow.com/q/27463989
score: 1
type: Comment
type: QuestionComment
has text: You could chain your animations together, so that when the first is complete, you would start the second one...

http://stackoverflow.com/comment/43234831
score: 1
has text: @paxdiablo Nothing in Java can be "forced" into a boolean, except for `Boolean` which is unboxed. If `performEffect` doesn't return a `boolean` or `Boolean`, the compiler will reject it.
type: AnswerComment
comment on: http://stackoverflow.com/a/27393713
type: Comment

http://stackoverflow.com/comment/43319320
score: 0
type: Comment
has text: start the jvisualVM before you start the emulator, and you can see in the left side of jvisualVM's window the active processes, start then the emulator, you will see in JVM the emulator's process and open the monitor tab, you will see how much heap will allocate for the process. After your java android process crashes create a dump with JVM and then open that dump with MAT and investigate all the leaks.
comment on: http://stackoverflow.com/a/27439159
type: AnswerComment

http://stackoverflow.com/comment/43161167
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/66383/discussion-between-re350-and-sanjay).
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27322141
type: Comment

http://stackoverflow.com/a/27464087
has comment: http://stackoverflow.com/comment/43364385
has comment: http://stackoverflow.com/comment/43364570
has comment: http://stackoverflow.com/comment/43364681
has body: This depends on how you want to use your setNumber() method. If you also want to use it to set numbers that are not based on the users input, putting the Scanner outside of the method is advised. Personally I would have the Scanner outside of the method to make which would make the method more versatile. If you need to scan multiple numbers, maybe put the scanning part in its own method that returns an int based on the users input. class YourClass { YourClass() { //Initialize setNumber(); } } public static main(String[] args) { //Create new YourClass object and set value from user input YourClass object = new YourClass(); }
has comment: http://stackoverflow.com/comment/43364476
has comment: http://stackoverflow.com/comment/43364348
has comment: http://stackoverflow.com/comment/43364441
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27464030

http://stackoverflow.com/q/27445344
has answer: http://stackoverflow.com/a/27456296
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/43329625
has title: Get formatted log message
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27446015
type: Question
has body: When you log a message, for example: log.error("This is a message"); The message is formatted by the layout before logged in a file. For example: 2014-12-12 13:45:18 ERROR This is a message How can I get this formatted message programmatically? I'm using JAVA with log4j. Thanks. EDIT: I think one solution is generating a LoggingEvent programmatically and call the format method of my custom Layout, but I think it will not have the same timestamp.
answer count: 2
downvote count: 0
favorite count: 0
tagged with: log4j

http://stackoverflow.com/comment/43173150
type: Comment
has text: I'm not going to go into a discussion about that, I agree to disagree.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27360399

http://stackoverflow.com/q/27388618
type: Question
tagged with: batch-file
has title: Android Studio basic project - error on compilation - com.android.ide.common.internal.LoggedErrorException failed to run comand ...\dx.bat
upvote count: 1
tagged with: android
favorite count: 0
tagged with: compiler-errors
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java
has body: Hy everyone. I've started to learn android development. I watched this tutorial( https://www.youtube.com/watch?v=mPnOgqZhK_o&amp;index=6&amp;list=PL_PaSTBkUwk4PXlhZIe4COpwnWeCRnw2F ) and i have written same code, but i get this errors when i try to compile and run this project: Error:Execution failed for task ':app:dexRelease'. com.android.ide.common.internal.LoggedErrorException: Failed to run command: C:\Users\Gabi\Desktop\adt-bundle-windows-x86-20140702\sdk\build-tools\android-4.4W\dx.bat --dex --output C:\Users\Gabi\AndroidStudioProjects\ContactManager\app\build\intermediates\dex\release C:\Users\Gabi\AndroidStudioProjects\ContactManager\app\build\intermediates\classes\release Error Code: 1 Output: The system cannot find the path specified. I don't know how to resolve this... please help me

http://stackoverflow.com/comment/43223842
has text: the situation of that object in array list is important for me @Panther
type: Comment
comment on: http://stackoverflow.com/q/27387702
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43274332
type: AnswerComment
score: 0
type: Comment
has text: m is object of Load. List is just holder, you can simple add method. It will be better if you see java docs for methods understanding.
comment on: http://stackoverflow.com/a/27414992

http://stackoverflow.com/a/27423838
answers question: http://stackoverflow.com/q/27418451
has body: Running single test with surefire : http://maven.apache.org/surefire/maven-surefire-plugin/examples/single-test.html
score: 0
type: Answer

http://stackoverflow.com/q/27420879
has comment: http://stackoverflow.com/comment/43290404
has body: I am trying to add "print file" button to a dynamically created pdf file. I am not even sure whether its possible or where to start. EDIT: I have this one solution using Javascript from this link. But some PDF Readers dont allow Javascript by default.
score: 0
has comment: http://stackoverflow.com/comment/43285280
has comment: http://stackoverflow.com/comment/43285611
has comment: http://stackoverflow.com/comment/43285529
has comment: http://stackoverflow.com/comment/43284917
has comment: http://stackoverflow.com/comment/43285404
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43285366
answer count: 0
linked to: http://stackoverflow.com/q/26751910
tagged with: java
tagged with: itext
type: Question
has comment: http://stackoverflow.com/comment/43285817
has comment: http://stackoverflow.com/comment/43285319
has title: Add print file button to pdf created using iText
has comment: http://stackoverflow.com/comment/43285444

http://stackoverflow.com/q/27314087
has comment: http://stackoverflow.com/comment/43088503
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27314137
has body: Im getting the same issue in my login and register class whenever i hit the login button i get some LogCat errors. can someone please explain to me the error and how to get rid of it my login class package com.Flawed.hearmeout; import java.util.ArrayList; import java.util.List; import library.JSONParser; import org.apache.http.NameValuePair; import org.apache.http.message.BasicNameValuePair; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.Editor; import android.os.AsyncTask; import android.os.Bundle; import android.preference.PreferenceManager; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class LoginScreen extends Activity implements OnClickListener{ private EditText user, pass; private Button mSubmit, mRegister; // Progress Dialog private ProgressDialog pDialog; // JSON parser class JSONParser jsonParser = new JSONParser(); //php login script location: //localhost : //testing on your device //put your local ip instead, on windows, run CMD &gt; ipconfig //or in mac's terminal type ifconfig and look for the ip under en0 or en1 // private static final String LOGIN_URL = "http://xxx.xxx.x.x:1234/webservice/login.php"; //testing on Emulator: private static final String LOGIN_URL = "http://10.0.2.2:1234/webservice/login.php"; //testing from a real server: //private static final String LOGIN_URL = "http://www.yourdomain.com/webservice/login.php"; //JSON element ids from repsonse of php script: private static final String TAG_SUCCESS = "success"; private static final String TAG_MESSAGE = "message"; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView…
has comment: http://stackoverflow.com/comment/43088506
score: 0
answer count: 3
tagged with: android
has title: fatal exception : asynctask #1 java.lang.runtimeException: an error occured while excuting doinbackground
has answer: http://stackoverflow.com/a/27314633
has comment: http://stackoverflow.com/comment/43088449
tagged with: android-asynctask
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27314215

http://stackoverflow.com/comment/43221956
score: 0
comment on: http://stackoverflow.com/q/27386752
has text: Well if you pass `null`, what do you think `str.length()` will do? I suggest you to try.
type: Comment
type: QuestionComment

static
tags question: http://stackoverflow.com/q/27399706
tags question: http://stackoverflow.com/q/27405679
tags question: http://stackoverflow.com/q/27470499
tags question: http://stackoverflow.com/q/27320101
tags question: http://stackoverflow.com/q/27427834
tags question: http://stackoverflow.com/q/27398329
tags question: http://stackoverflow.com/q/27317684
tags question: http://stackoverflow.com/q/27433837
tags question: http://stackoverflow.com/q/27332934
tag name: static
tags question: http://stackoverflow.com/q/27370037
tags question: http://stackoverflow.com/q/27458104
type: Tag
tags question: http://stackoverflow.com/q/27465393

http://stackoverflow.com/comment/43104988
has text: Shouldn't `one = one.next.next` be `one = one.next`? since you are swaping one and two, one takes the position of two thus making the start of the next pair be the first node after one, not second
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27322787
score: 0

http://stackoverflow.com/comment/43313689
comment on: http://stackoverflow.com/q/27436479
type: Comment
type: QuestionComment
has text: @benji OP didn't say they had to be in original order. Of course, it's possible you're right - the question is ambiguous. But the letters `abc` are certainly in `aabbc`. And then you posted my comment as an answer, so clearly you agree with me.
score: 1

http://stackoverflow.com/q/27472580
has answer: http://stackoverflow.com/a/27473178
has title: Is extending an annotation interface meaningless and discouraged?
upvote count: 3
tagged with: annotations
accepted answer: http://stackoverflow.com/a/27525827
type: Question
score: 3
tagged with: java
answer count: 2
tagged with: intellij-idea
downvote count: 0
favorite count: 0
has body: Here's an example of it in the JavaDoc of AnnotationLiteral e.g. "An instance of an annotation type may be obtained by subclassing AnnotationLiteral." public abstract class PayByQualifier extends AnnotationLiteral&lt;PayBy&gt; implements PayBy { } PayBy paybyCheque = new PayByQualifier() { public PaymentMethod value() { return CHEQUE; } }; There is a more complete example in Section 5.6.3 in the CDI spec. 5.6.3. Using AnnotationLiteral and TypeLiteral javax.enterprise.util.AnnotationLiteral makes it easier to specify qualifiers when calling select(): @Qualifier @Retention(RUNTIME) @Target({METHOD, FIELD, PARAMETER, TYPE}) public @interface Synchronous {} @Qualifier @Retention(RUNTIME) @Target({METHOD, FIELD, PARAMETER, TYPE}) public @interface PayBy { PaymentMethod value(); @Nonbinding String comment() default ""; } public PaymentProcessor getSynchronousPaymentProcessor(PaymentMethod paymentMethod) { class SynchronousQualifier extends AnnotationLiteral&lt;Synchronous&gt; implements Synchronous {} class PayByQualifier extends AnnotationLiteral&lt;PayBy&gt; implements PayBy { public PaymentMethod value() { return paymentMethod; } } return anyPaymentProcessor.select(new SynchronousQualifier(), new PayByQualifier()).get(); } And finally according to section 9.6 of the Java annotation types spec.: Unless explicitly modified herein, all of the rules that apply to normal interface declarations apply to annotation type declarations. For example, annotation types share the same namespace as normal class and interface types; and annotation type declarations are legal wherever interface declarations are legal, and have the same scope and accessibility. However, the Java compiler complains when I attempt to implement an annotation. In particular, Intellij warns: "Reports any classes declared as implementing or extending an annotation interface. While it is legal to extend an annotation interfaces, IT IS NEARLY MEANINGLESS, AND DISCOURAGED." (emphasis mine). Here is the error me…
has answer: http://stackoverflow.com/a/27525827
possible better answer: http://stackoverflow.com/a/27473178
type: AnsweredQuestion

http://stackoverflow.com/q/27384000
has body: I am designing a GUI where an user can add a new ship to the system by just adding the name of the ship. The name of new ship will be stored in an ArrayList. Within my GUI design, I have implemented a JList which uses the ship ArrayList as data. The idea behind the implementation was when a new ship is added to the system, the JList would be updated with the name of the new ship in the JList as well. I know for sure that the ship name is being added to the ArrayList, because upon printing it as output, it displays, however, it does show on the JList. I was maybe thinking, is there a refresh method I can make (if so how) or call which refreshes the frame, because I am assuming the problem is that it needs the frame to refresh in order for the JList to be updated?
has comment: http://stackoverflow.com/comment/43253811
tagged with: arraylist
score: 0
tagged with: user-interface
answer count: 1
type: UnansweredQuestion
has title: Refreshing a JList to show new items being added to ArrayList
tagged with: java
has answer: http://stackoverflow.com/a/27414033
tagged with: swing
linked to: http://stackoverflow.com/q/1851217
type: Question
has comment: http://stackoverflow.com/comment/43216689

http://stackoverflow.com/q/27329203
favorite count: 0
has comment: http://stackoverflow.com/comment/43116921
has comment: http://stackoverflow.com/comment/43117063
tagged with: multithreading
has comment: http://stackoverflow.com/comment/43116898
accepted answer: http://stackoverflow.com/a/27329740
has comment: http://stackoverflow.com/comment/43117004
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: terminate
tagged with: concurrency
has comment: http://stackoverflow.com/comment/43117330
type: Question
has comment: http://stackoverflow.com/comment/43123684
has body: A general case for my question was, how do we detect if a particular function call has been taking too long so that we want to terminate it? On top of my head I think of using a thread to run that function, and kill the thread if it runs too long, as defined below: class MyThread extends Thread { public void run() { someFunction(); } } And say someFunction might be: public void someFunction() { // Unknown code that could take arbitrarily long time. } In the code above, someFunction() might take no time to finish, or takes forever, so say I want to stop it when it's taking too long. However, in a Java thread implementation, apparently I can't use a shared variable or any timestamp in the thread so that the thread will have a sense of time, because someFunction() funs atomically and such check-against-timestamp code can only go after someFunction, thus becoming useless since at the point of the coding being executed, someFunction is already done. NOTE that I also want to do so with someFunction() being agnostic. That is, someFunction() shouldn't be worrying about how much time it runs. It simply shouldn't be aware of it at all. Can anyone provide some insight in how I can accomplish this functionality?
downvote count: 0
has title: How to limit a thread's execution time and terminate it if it runs too long?
has answer: http://stackoverflow.com/a/27329740
has comment: http://stackoverflow.com/comment/43148082
answer count: 1
has comment: http://stackoverflow.com/comment/43116886

http://stackoverflow.com/a/27455129
has body: Maybe if (difference &gt; 12) difference = 24 - difference?
score: 2
answers question: http://stackoverflow.com/q/27455073
upvote count: 2
downvote count: 0
type: Answer

http://stackoverflow.com/comment/43099893
score: 1
has text: Ok, extreme short version is that ComboBoxCell.editable is a bit screwy anyway. The `editable` field is all that needs to be set to false *before* you render the first time, and all instances will be non-editable. It is private, so you can set it either via JSNI, or make an element to pass in that meets the criteria of whatever appearance you are using. Sorry, its kinda vague, and I'll try to do a more complete writeup later, but hopefully that gets you in the right direction.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27318742

integer
tags question: http://stackoverflow.com/q/27391668
tags question: http://stackoverflow.com/q/27464661
tags question: http://stackoverflow.com/q/27400700
tags question: http://stackoverflow.com/q/27470229
tags question: http://stackoverflow.com/q/27367676
tags question: http://stackoverflow.com/q/27385770
tags question: http://stackoverflow.com/q/27346809
tags question: http://stackoverflow.com/q/27390854
tags question: http://stackoverflow.com/q/27372028
tags question: http://stackoverflow.com/q/27369663
tags question: http://stackoverflow.com/q/27341802
tag name: integer
tags question: http://stackoverflow.com/q/27338487
type: Tag

http://stackoverflow.com/comment/43269150
comment on: http://stackoverflow.com/a/27412214
score: 0
type: Comment
has text: agreed, Integer is immutable, autoboxing is doing it's mind tricks again on me. And if you put it that way (references passed as values) you may argue it's all pass by value, although may be surprised, i also heard the term call-by-object-sharing. nevertheless, the second suggestions will work.
type: AnswerComment

oop
tags question: http://stackoverflow.com/q/27353878
tags question: http://stackoverflow.com/q/27316109
tags question: http://stackoverflow.com/q/27374225
tags question: http://stackoverflow.com/q/27331979
tags question: http://stackoverflow.com/q/27469655
tags question: http://stackoverflow.com/q/27337929
tags question: http://stackoverflow.com/q/27354084
tags question: http://stackoverflow.com/q/27435846
tag name: oop
tags question: http://stackoverflow.com/q/27332347
tags question: http://stackoverflow.com/q/27343837
tags question: http://stackoverflow.com/q/27356149
tags question: http://stackoverflow.com/q/27333119
tags question: http://stackoverflow.com/q/27467527
tags question: http://stackoverflow.com/q/27337906
tags question: http://stackoverflow.com/q/27455310
tags question: http://stackoverflow.com/q/27351728
tags question: http://stackoverflow.com/q/27426548
tags question: http://stackoverflow.com/q/27335243
tags question: http://stackoverflow.com/q/27355033
tags question: http://stackoverflow.com/q/27462420
tags question: http://stackoverflow.com/q/27446433
tags question: http://stackoverflow.com/q/27351913
tags question: http://stackoverflow.com/q/27431215
tags question: http://stackoverflow.com/q/27394939
tags question: http://stackoverflow.com/q/27439884
tags question: http://stackoverflow.com/q/27431373
tags question: http://stackoverflow.com/q/27463477
tags question: http://stackoverflow.com/q/27442665
tags question: http://stackoverflow.com/q/27366903
tags question: http://stackoverflow.com/q/27343448
tags question: http://stackoverflow.com/q/27342669
tags question: http://stackoverflow.com/q/27349987
tags question: http://stackoverflow.com/q/27379968
tags question: http://stackoverflow.com/q/27468879
type: Tag

http://stackoverflow.com/comment/43593655
comment on: http://stackoverflow.com/q/27420675
score: 1
has text: Have you considered providing a pull request to fix the issue? It may be as simple as making a copy of the list before sorting it. Looks like the code is at https://github.com/arquillian/arquillian-core/blob/master/junit/core/src/main/java/org/jboss/arquillian/junit/Arquillian.java
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43370930
comment on: http://stackoverflow.com/q/27467515
has text: What library gives you @downloadXML@?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43151669
type: Comment
type: QuestionComment
has text: A way could be to declare a class: `DnsRecordTypeEJJD extends EnumerableJacksonJsonDeserializer<DnsRecordType>` and use `DnsRecordTypeEJJD` in the annotation
comment on: http://stackoverflow.com/q/27348283
score: 0

http://stackoverflow.com/comment/43274482
type: Comment
has text: @dex90: Can u pastebin 2 inputs you are trying to combine? What is N125DL...etc
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27349743

http://stackoverflow.com/comment/43543386
type: AnswerComment
comment on: http://stackoverflow.com/a/27475673
type: Comment
score: 0
has text: I removed the no argument constructor ItemRecord(). Now the error is NullPointerException. This assignment has already been turned in and graded. The class compiles but won't run. If I comment out everything after the end of method main it does run. But I'm trying to print out the modified field values and if I could just figure out how to solve the NullPointeException I could learn something.

http://stackoverflow.com/a/27365739
has comment: http://stackoverflow.com/comment/43184413
has comment: http://stackoverflow.com/comment/43185622
type: Answer
has comment: http://stackoverflow.com/comment/43184803
downvote count: 0
has comment: http://stackoverflow.com/comment/43184691
has comment: http://stackoverflow.com/comment/43185330
answers question: http://stackoverflow.com/q/27365596
has comment: http://stackoverflow.com/comment/43184159
has comment: http://stackoverflow.com/comment/43184409
score: 1
has comment: http://stackoverflow.com/comment/43185281
accepted answer of: http://stackoverflow.com/q/27365596
has comment: http://stackoverflow.com/comment/43185146
has comment: http://stackoverflow.com/comment/43184628
has comment: http://stackoverflow.com/comment/43184587
has body: Put a method in your activity that will handle the speaking such as: public void speak(String text) { tts.speak(text, TextToSpeech.QUEUE_FLUSH, null); } } Then in your fragment when you have a String to speak, here's an example implementation: String textToSpeak = "Hello from my fragment"; MyActivity myActivity = (MyActivity) getActivity(); myActivity.speak(textToSpeak); With something like this you'll be able to keep the TTS in your activity but still speak phrases from the fragment. Here's something to look at in the new code you posted: tts = new TextToSpeech(this, this); From the documentation the constructor takes a Context and a Listener: TextToSpeech(Context context, TextToSpeech.OnInitListener listener) Try this instead: tts = new TextToSpeech(getActivity(), this); Furthermore, if you use "this" as the listener, you would have to implement it which you haven't in the posted code.
has comment: http://stackoverflow.com/comment/43184479
has comment: http://stackoverflow.com/comment/43184999
has comment: http://stackoverflow.com/comment/43184733
has comment: http://stackoverflow.com/comment/43184550
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43184042
has comment: http://stackoverflow.com/comment/43184369
has comment: http://stackoverflow.com/comment/43185660
has comment: http://stackoverflow.com/comment/43184782
has comment: http://stackoverflow.com/comment/43184129
upvote count: 1

http://stackoverflow.com/q/27319674
type: UnansweredQuestion
upvote count: 1
has body: I have parser rule s+=statement and my statement rule declaration is as statement returns [List&lt;CommonTree&gt; myList] what Antlr3 generates against this is as: state._fsp--; if (state.failed) return retval; if ( state.backtracking==0 ) stream_plsql_statement.add(s.getTree()); if (list_s==null) list_s=new ArrayList(); list_s.add(s.getTree()); That means s+=... transforms into the list_s thing. The problem is that I need to access the list returned from the underlying rule. I have tried $s.myList but it gives an error and code isn't compiled. Can anyone guide me about how to access this list.
score: 1
tagged with: java
type: Question
has title: Get list returned from ANTLR Parser rule with += syntax
downvote count: 0
favorite count: 0
answer count: 0
tagged with: antlr3

http://stackoverflow.com/q/27334406
tagged with: broadcastreceiver
has answer: http://stackoverflow.com/a/27334995
answer count: 1
has body: I have a outGoingCall broadcast receiver. basically I want it to intercept any outgoing call and show a dialog for certain pre-defined numbers. so I made this broadcast init an activity which inits an FragmentDialog which init a AlertDialog. When the user click "no" I want to stop the call from happening. I know setResultData(null); in the broadcast should do it. But how can I pass the dialog result to the broadcast ? there is no onActivityResult() in a broadcast. I know how to pass it till the activity only. fragmentDialog code: public class YesNoDialogFragment extends DialogFragment { private YesNoDialogFragmentListener mListener; @Override public void onAttach(Activity activity) { super.onAttach(activity); try { // Instantiate the NoticeDialogListener so we can send events to the // host mListener = (YesNoDialogFragmentListener) activity; } catch (ClassCastException e) { // The activity doesn't implement the interface, throw exception throw new ClassCastException(activity.toString() + " must implement NoticeDialogListener"); } } here is my activity code: public class MainActivity extends FragmentActivity implements YesNoDialogFragmentListener { public static final String TAG = "MainActivity"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); showYesNoDialog(); } @Override public void onDialogPositiveClick() { // how to send result to receiver ?? finish(); } here is my receiver code: @Override public void onReceive(final Context context, final Intent intent) { Log.v(Constants.LOGTAG, "OutgoingCallReceiver onReceive"); if (intent.getAction() .equals(OutgoingCallReceiver.OUTGOING_CALL_ACTION)) { Log.v(Constants.LOGTAG, "OutgoingCallReceiver NEW_OUTGOING_CALL received"); // get phone number from bundle String phoneNumber = intent.getExtras().getString( OutgoingCallReceiver.INTENT_PHONE_NUMBER); if ((phoneNumber != null) &amp;&amp; phoneNumber .equals(OutgoingCallReceiver.ABORT_PHONE_NUMBER)) { Toast.makeText( context, …
tagged with: android
tagged with: android-activity
score: 0
type: UnansweredQuestion
tagged with: android-intent
tagged with: java
type: Question
has title: how to end an outgoing call after activity result?

http://stackoverflow.com/q/27474115
has answer: http://stackoverflow.com/a/27474138
accepted answer: http://stackoverflow.com/a/27474138
has answer: http://stackoverflow.com/a/27474136
type: AnsweredQuestion
score: 1
possible better answer: http://stackoverflow.com/a/27474136
tagged with: java
has title: Java - Adding to an array
type: Question
upvote count: 1
tagged with: arrays
has body: Using Java and no IDE, but rather the command line, I'm supposed to write a basic-ish phone book program focusing around arrays in which the user has three options: search for a name in an array and print the name and phone number if the name is found, add a new name and phone number to the array based on user input, and delete a name and number from the array based on user input. The search function works exactly how it should, but the add function does not function properly. The delete function can be left alone for the time being since I simply haven't gotten to it yet. When I say the add function does not function properly, I basically mean that my code doesn't compile and I get errors regarding the function; I also only kind of know what the heck I'm doing. These are the specific instructions for the 'add entry' part of the program: "To add a new name and number to the array, first look for a cell that contains null. Then construct a new PhoneEntry object and assign its reference to that cell. If no cells contain null report an error (but don't exit the program.)" Here's my code: import java.util.*; class PhoneEntry { String name; // name of a person String phone; // their phone number PhoneEntry( String n, String p ) { name = n; phone = p; } } class PhoneBook { PhoneEntry[] phoneBook; PhoneBook() // constructor { phoneBook = new PhoneEntry[ 10 ] ; phoneBook[0] = new PhoneEntry( "James Barclay", "(418) 665-1223" ); phoneBook[1] = new PhoneEntry( "Grace Dunbar", "(860) 399-3044" ); phoneBook[2] = new PhoneEntry( "Paul Kratides", "(815) 439-9271" ); phoneBook[3] = new PhoneEntry( "Violet Smith", "(312) 223-1937" ); phoneBook[4] = new PhoneEntry( "John Wood", "(913) 883-2874" ); phoneBook[5] = new PhoneEntry( null, null ); phoneBook[6] = new PhoneEntry( null, null ); phoneBook[7] = new PhoneEntry( null, null ); phoneBook[8] = new PhoneEntry( null, null ); phoneBook[9] = new PhoneEntry( null, null ); } PhoneEntry search( String targetName ) { for ( int i = 0 ; i &l…
has comment: http://stackoverflow.com/comment/43382705
has comment: http://stackoverflow.com/comment/43383169
answer count: 3
has answer: http://stackoverflow.com/a/27474408
favorite count: 0
has comment: http://stackoverflow.com/comment/43382605
downvote count: 0

http://stackoverflow.com/comment/43307225
type: Comment
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27432827
has text: Write your input output in plain text. It will be more obvious to everyone trying to help you.

timer
tag name: timer
tags question: http://stackoverflow.com/q/27465406
tags question: http://stackoverflow.com/q/27471015
tags question: http://stackoverflow.com/q/27344671
tags question: http://stackoverflow.com/q/27411689
type: Tag
tags question: http://stackoverflow.com/q/27371733
tags question: http://stackoverflow.com/q/27463989
tags question: http://stackoverflow.com/q/27353482
tags question: http://stackoverflow.com/q/27394095
tags question: http://stackoverflow.com/q/27452742
tags question: http://stackoverflow.com/q/27465169
tags question: http://stackoverflow.com/q/27427504

http://stackoverflow.com/comment/47589840
score: 0
type: QuestionComment
has text: I am working on a some what same task of creating WADL for a restful web service that i have created .So were you able to create WADL ?
type: Comment
comment on: http://stackoverflow.com/q/27327018

http://stackoverflow.com/q/27358994
tagged with: java
has title: Static vs Object instantiation
has comment: http://stackoverflow.com/comment/43170409
type: Question
has comment: http://stackoverflow.com/comment/43170716
answer count: 2
has comment: http://stackoverflow.com/comment/43170339
downvote count: 0
has comment: http://stackoverflow.com/comment/43170559
has comment: http://stackoverflow.com/comment/43170210
has body: I'm developing a website using struts2 framework. I just need recommendations about when to use static methods and when to instantiate an object for a class. For example: in my database connection, I use a singleton so that there will only be one database connection for every user(is this correct?) and I'm thinking if I have a class, let's say it is a class full of methods just for manipulating datas from a database. Should I make those methods static also? Or should I do make the class a singleton also so my app will only have one instance of the class full of methods?
has comment: http://stackoverflow.com/comment/43170228
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43170240
has answer: http://stackoverflow.com/a/27359317
has answer: http://stackoverflow.com/a/27359461
score: 3
has comment: http://stackoverflow.com/comment/43170200
upvote count: 3

http://stackoverflow.com/q/27387784
tagged with: for-loop
answer count: 1
has comment: http://stackoverflow.com/comment/43223759
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/43223673
score: 0
has title: for loop with try-catch stopping at first index
has answer: http://stackoverflow.com/a/27388398
has comment: http://stackoverflow.com/comment/43223585
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43223611
has comment: http://stackoverflow.com/comment/43224055
has comment: http://stackoverflow.com/comment/43223600
type: Question
tagged with: try-catch
has comment: http://stackoverflow.com/comment/43223632
has body: String[] urls contains URLs as strings (code reads inputStream of each URL). I cannot iterate through any indices of String[] URLs after the first index (index 0) even though the exit condition in the for loop is 'i &lt; urls.length'. NOTE: It works when String[] urls size is 1. I'm testing it on when String[] urls size is 2, in which case only the first index but not the second is iterating. And I'm only interested in what's between the &lt;body&gt; blocks (hence if (s.contains("&lt;br&gt;")) Any ideas as to why this is happening? public void readData(String[] urls) { for (int i=0; i&lt;urls.length; i++) { System.out.println(i); //for a String[] urls of size 2, only 0 gets printed. //I want both 0 and 1 printed String str=""; try { URL url=new URL(urls[i]); URLConnection conn=url.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String s; while (( s = in.readLine())!=null) { if (s.contains("&lt;br&gt;")) { str += s; } } } catch(Exception e) { e.printStackTrace(); } System.out.println(str); // for String[] urls of size 2, //only the inputstream of urls' first index gets printed. //I want both to be printed } } EDIT: This is the sample of an html I want to read (what each element of String[] urls brings to) &lt;html&gt; &lt;head&gt; &lt;title&gt; Title &lt;/title&gt; &lt;/head&gt; &lt;body&gt; Name1 Age1 Hometown1&lt;br&gt; Name2 Age2 Hometown2&lt;br&gt; Name3 Age3 Hometown3&lt;br&gt; &lt;/body&gt; &lt;/html&gt;
tagged with: java
has comment: http://stackoverflow.com/comment/43225847
has comment: http://stackoverflow.com/comment/43224237
tagged with: inputstream
has comment: http://stackoverflow.com/comment/43223595

http://stackoverflow.com/comment/96253975
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27424377
has text: @VadymPechenoha: I assume that the JavaDoc isn't trying to provide an exhaustive list here. IMHO, there are some other standard classes/methods that can throw this exception.
score: 1

http://stackoverflow.com/q/27372530
tagged with: java
has comment: http://stackoverflow.com/comment/43196796
has answer: http://stackoverflow.com/a/27372965
accepted answer: http://stackoverflow.com/a/27372799
downvote count: 0
tagged with: string
possible better answer: http://stackoverflow.com/a/27372965
has body: Part of my code is here! bufferedReader=new BufferedReader (inputstreamreader); message=bufferedReader.readLine ();// ex: message has (1,-3) String[] msg=message.split (",") //I use comma (,) as deliminator int x=Integer.parseInt (msg [0]); int y=Integer.parseInt (msg [1]); This clearly parses but the problem is it looses negative sign. That is the "message" contains (1,-3). Pls help me to parse without loosing -ve sign.
type: AnsweredQuestion
score: 3
tagged with: android
favorite count: 0
tagged with: parsing
has comment: http://stackoverflow.com/comment/43196768
type: Question
has answer: http://stackoverflow.com/a/27372799
answer count: 2
upvote count: 3
has title: How to parse string containing negative number into integer?

http://stackoverflow.com/comment/43163503
type: AnswerComment
type: Comment
has text: It works on Java 7+. Prior versions do not support switch on String.
comment on: http://stackoverflow.com/a/27353980
score: 0

http://stackoverflow.com/comment/116871825
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27441088
type: AnswerComment
has text: @Topolnik It's not exactly a session concept - The same named thread can service unrelated events, but the same group of related events have to go to the same thread. It's a way of ensure sequential processing of events in the same related group. Sequencialness and Asynchronousness/scalability are fundamentally opposing forces we have to joggle at times. Opinions differ on how to ensure sequence, which is not the current question. I had simple enough (one class) wrapper to achieve named-thread summon and execute using JDK concurrent API, but was wondering alternatives to the home-grown setup.

http://stackoverflow.com/q/27449466
score: 1
possible better answer: http://stackoverflow.com/a/27449520
accepted answer: http://stackoverflow.com/a/27449507
upvote count: 1
type: Question
has title: String get text at the end of line
tagged with: java
has comment: http://stackoverflow.com/comment/43337596
has comment: http://stackoverflow.com/comment/43337645
tagged with: substring
has body: I have a .txt file that contains a text like: blah blah blah size: 80 blah blah blah blah size: 150 Aka there is some text, then a size:, space, an int, new line, repeat... Now, I need to get that integer and store it to a variable. I use a BufferedReader that reads the text line by line and everything is normal, but, just because the length of that integer varies, I can't tell for example: String x = line.substring(line.indexOf("size") + 6, line.indexOf("size") + 8) because if size has 3 digits, it will only get the first two of them. Any suggestions?
downvote count: 0
tagged with: bufferedreader
has answer: http://stackoverflow.com/a/27449556
tagged with: string
has answer: http://stackoverflow.com/a/27449507
favorite count: 0
has answer: http://stackoverflow.com/a/27449557
has answer: http://stackoverflow.com/a/27449551
answer count: 5
has answer: http://stackoverflow.com/a/27449520
tagged with: regex
type: AnsweredQuestion

http://stackoverflow.com/comment/43173801
comment on: http://stackoverflow.com/a/27360746
score: 0
type: Comment
has text: The answer was exactly as the one above you, it was redundant and posted minutes after the first one was posted.
type: AnswerComment

http://stackoverflow.com/q/27465406
tagged with: timer
tagged with: android
tagged with: onpause
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27465796
type: Question
has title: Using onPause()/onResume() for pausing/resuming a timer of a minigame?
score: 0
has body: So here's the situation. I've been working on a minigame for android and this game has a timer that makes a countdown from 60 to 0. http://postimg.org/image/5kcbo7t49/ When you click the pause button (II), it displays a dialog that serves as a pause, the timer should stop and of course when you click on continue it should continue. http://postimg.org/image/j2j80i59l/ My issue is that the timer keeps working even when the Dialog pops, i thought that i could stop the timer on the onPause() method but I read that the dialogs doesnt call the onPause method because theyre not necessarily activities. So, my question is, what could i use to make my activity call the onPause() and onResume()? Should i use something different than dialogs? if so, what could i use? Or can i force the onPause/OnResume to activate in some way and is taht convenient? Here's some code: The code for the pause button. Just calls the pause dialog. _Btn_Pause.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub GameManager.createDialogPause(_Activity, _Activity); } }); The code for the pause and on resume methods. protected void onPause() { // TODO Auto-generated method stub super.onPause(); _C.cancel(); _TimeReady = 4; _StartGame = false; } @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); setGame(); } public void setGame() { _C.scheduleAtFixedRate(_GameTimer, 1000, 1000); }
answer count: 1
tagged with: onresume
has answer: http://stackoverflow.com/a/27465796

http://stackoverflow.com/comment/43164288
score: 0
comment on: http://stackoverflow.com/q/27354979
type: Comment
type: QuestionComment
has text: When I tried to use 0.14.0 it gave the error: Gradle build finished with 100 error(s) in 30 sec followed by a long list of items (from R.java) that look like: Error:(198, 1) error: unknown tag: colgroup

http://stackoverflow.com/comment/43329764
score: 0
has text: I can't see a `eureka.client.serviceUrl` (maybe it's in the config server)?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27442565

http://stackoverflow.com/comment/43091217
score: 0
type: QuestionComment
has text: @aioobe System output should be in monospace, not proportional blockquote.
type: Comment
comment on: http://stackoverflow.com/q/27315633

http://stackoverflow.com/q/27335886
type: Question
tagged with: android
accepted answer: http://stackoverflow.com/a/27342789
answer count: 2
downvote count: 3
has title: getting this Unfortunately your app has stopped
has answer: http://stackoverflow.com/a/27336575
has comment: http://stackoverflow.com/comment/43129492
possible better answer: http://stackoverflow.com/a/27336575
tagged with: java
score: -3
has body: I keep on getting this message of unfortunately your app has stopped without knowing the reason this is my main import android.app.ActionBar; import android.app.Activity; import android.app.SearchManager; import android.content.Context; import android.os.Bundle; import android.support.v7.widget.SearchView; import android.view.KeyEvent; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import android.widget.EditText; import android.widget.TextView; import android.widget.TextView.OnEditorActionListener; import android.widget.Toast; public class MainActivity extends Activity { private ActionBar actionBar; @Override protected void onCreate(Bundle savedInstanceState) { try { super.onCreate(savedInstanceState); setContentView(R.layout.main); actionBar = getActionBar(); // add the custom view to the action bar actionBar.setCustomView(R.layout.actionbar_view); EditText search = (EditText) actionBar.getCustomView().findViewById(R.id.searchfield); search.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { return true; } }); actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME); } catch (NullPointerException ex) { throw new IllegalStateException("null property", ex); } } @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); // Associate searchable configuration with the SearchView SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); SearchView searchView = (SearchView) menu.findItem(R.id.search_action) .getActionView(); //searchView.setSearchableInfo(searchManager // .getSearchableInfo(getComponentName())); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically h…
has comment: http://stackoverflow.com/comment/43139501
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/43129061
has answer: http://stackoverflow.com/a/27342789
favorite count: 0

http://stackoverflow.com/a/27319980
answers question: http://stackoverflow.com/q/27319534
score: 0
type: Answer
has body: as solution passed by @ControllAltDel is strongly recommended, if you dont want to play with Dateformat, you could implement simple method for time arthmetics, based on this static String sub (String a,String b){ String[] tmp = a.split(":"); int ah = Integer.parseInt(tmp[0]); int am = Integer.parseInt(tmp[1]); tmp = b.split(":"); int bh = Integer.parseInt(tmp[0]); int bm = Integer.parseInt(tmp[1]); int cm = am-bm; int reminder = 0; cm=cm%60; if (cm&lt;0) { reminder--; cm+=60; } int ch = ah-bh+reminder; return ch+":"+cm; }

http://stackoverflow.com/q/27435997
has comment: http://stackoverflow.com/comment/43313540
answer count: 1
downvote count: 0
tagged with: awt
favorite count: 0
has title: Why does my frame show nothing?
has answer: http://stackoverflow.com/a/27436012
upvote count: 1
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/43325463
has body: I want to show a progress bar window when I close the main frame. However, the progress bar window will show nothing and I have no idea about it. Here is the code. import java.awt.BorderLayout; import java.awt.EventQueue; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; public class MainFrame { public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { @Override public void run() { // TODO Auto-generated method stub MainFrame mainFrame = new MainFrame(); mainFrame.createUI(); } }); } public void createUI(){ JFrame frame = new JFrame(); JPanel mainPanel = new JPanel(new BorderLayout()); JButton button = new JButton("Close"); button.setBorder(new EmptyBorder(20, 20, 20, 20)); button.addActionListener(new ButtonListener()); mainPanel.add(button,BorderLayout.CENTER); frame.add(mainPanel,BorderLayout.CENTER); frame.setLocationRelativeTo(null); frame.pack(); frame.setVisible(true); } class ButtonListener implements ActionListener{ @Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub FeedbackBox feedbackBox = new FeedbackBox(); feedbackBox.createUI(); feedbackBox.increment(0, 100); try { feedbackBox.getThread().join(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } feedbackBox.closeBox(); } } } And the progress bar window is: import java.awt.BorderLayout; import java.awt.Color; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JProgressBar; public class FeedbackBox { private JFrame frame; private JProgressBar progressBar; Thread thread; public void createUI(){ frame = new JFrame("Reminder"); MainPanel mainPanel = new MainPanel(); frame.add(mainPanel,BorderLayout.CENTER); frame.setDefaultCl…
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27436012

http://stackoverflow.com/a/27416931
downvote count: 0
has body: Use a TreeSet and the collection will sort for you. And the generic type goes on the left. Something like, int[] arr1 = { 4, 7, 3, 9, 2 }; int[] arr2 = { 3, 2, 12, 9, 40, 32, 4 }; Set&lt;Integer&gt; treeSet = new TreeSet&lt;&gt;(); for (int i = 0; i &lt; arr1.length; i++) treeSet.add(arr1[i]); for (int i = 0; i &lt; arr2.length; i++) treeSet.add(arr2[i]); Integer[] arr = treeSet.toArray(new Integer[0]); System.out.println(Arrays.toString(arr)); Output is [2, 3, 4, 7, 9, 12, 32, 40] If you can use the object wrapper types, you could eliminate the loops by using addAll and Arrays.asList(T...) like Integer[] arr1 = { 4, 7, 3, 9, 2 }; Integer[] arr2 = { 3, 2, 12, 9, 40, 32, 4 }; Set&lt;Integer&gt; treeSet = new TreeSet&lt;&gt;(); treeSet.addAll(Arrays.asList(arr1)); treeSet.addAll(Arrays.asList(arr2)); Integer[] arr = treeSet.toArray(new Integer[0]); System.out.println(Arrays.toString(arr)); For the same output as before.
score: 1
answers question: http://stackoverflow.com/q/27416872
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/43277388

http://stackoverflow.com/comment/43190240
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27363865
has text: `panel.setLayout(null);` Java GUIs have to work on different OS', screen size, screen resolution etc. As such, they are not conducive to pixel perfect layout. Instead use layout managers, or [combinations of them](http://stackoverflow.com/a/5630271/418556) along with layout padding and borders for [white space](http://stackoverflow.com/a/17874718/418556).
type: AnswerComment

http://stackoverflow.com/q/27370949
type: UnansweredQuestion
upvote count: 1
has title: Braintree create submerchant unsuccessful but with no errors in the result object
has body: I wanted to use the Braintree Marketplace (I've got the approval and signed to use the marketplace functionality). I used JAVA for my backend and played with the Sandbox account. I was trying to create a submerchant accorinding to the tutorials in the overview and the specific section. E.g., the code I directly copied from the guide is (I'VE ALSO TRIED TO USE MY VALID PERSONAL INFORMATION BELOW): MerchantAccountRequest request = new MerchantAccountRequest(). individual(). firstName("Jane"). lastName("Doe"). email("jane@14ladders.com"). phone("5553334444"). dateOfBirth("1981-11-19"). ssn("456-45-4567"). address(). streetAddress("111 Main St"). locality("Chicago"). region("IL"). postalCode("60622"). done(). done(). funding(). descriptor("Blue Ladders"). destination(MerchantAccount.FundingDestination.BANK). email("funding@blueladders.com"). mobilePhone("071101307"). accountNumber("1123581321"). routingNumber("071101307"). done(). tosAccepted(true). masterMerchantAccountId("14ladders_marketplace"). id("blue_ladders_store"); Result&lt;MerchantAccount&gt; result = gateway.merchantAccount().create(request); I've also tried to use the testing first name com.braintreegateway.test.MerchantAccount.Approve so that the creation should always succeed. The code snippet is: Result&lt;MerchantAccount&gt; result = gateway.merchantAccount().create( new MerchantAccountRequest(). individual() .firstName(com.braintreegateway.test.MerchantAccount.Approve) .done() ); However, in any case, when I tried to check if the result is successful (and if not, what the errors are): logger.info("Is the result successful? " + result.isSuccess()); ValidationErrors errors = result.getErrors(); logger.info("Number of errors returned " + result.getErrors().size()); The result.isSuccess() always returns false, while there are no errors in result.getErrors(). I also cannot find any (error) information from the sandbox web account. Any insights what might go wrong? or is this because I haven't enabled the ma…
score: 1
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27430823
answer count: 1
downvote count: 0
tagged with: braintree
favorite count: 0

http://stackoverflow.com/comment/43220971
type: Comment
has text: Now I think file is uploading. But finally display Error 404: Not Found message. And browser link as showing "http://localhost:3030/No session/upload". what's wrong with it?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27386279

http://stackoverflow.com/a/27409724
type: Answer
has comment: http://stackoverflow.com/comment/43264524
has comment: http://stackoverflow.com/comment/43264366
upvote count: 2
answers question: http://stackoverflow.com/q/27409123
has comment: http://stackoverflow.com/comment/43264135
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43264292
has body: Well there are several problems in your code. Just from a brief look at your code I can say that your mouse_x and mouse_y are local to mousePressed ( MouseEvent e ) method, declare them outside of the method so you can use them in your updateMainMenu() method. Another thing is you are implementing Listeners without actually using them, the values you assign to mouse_x and mouse_y are screen coordinates which are not relative to your JPanel. Add a constructor to your B0ssCore class and add the Listeners you implement, something like: public B0ssCore(){ super(); addMouseListener(this); } and change the public void mousePressed ( MouseEvent e ) to something like: public void mousePressed ( MouseEvent e ) { // don't forget to declare mouse_x and mouse_y at the class level mouse_Y = e.getX(); // relative to container coordinates mouse_X = e.getX(); } There are other issues in your code. For example this: while (true) { repaint(); mainMenu.drawMainMenu(getWidth(), getHeight()); System.out.println(mouse_X, mouse_Y); Thread.sleep(20); } looks suspicious. There are a lot of things that can be done much better in your code but I guess that's how you learn so Good luck.

http://stackoverflow.com/a/27451258
score: 0
answers question: http://stackoverflow.com/q/27356521
type: Answer
has body: You could have a problem if you are using a datasource and the configuration in Weblogic Server is wrapping the data types. Open the Weblogic Server Administration Console (server:port/console) in a browser Go to Services -> Data Sources -> YourDataSource -> Connection Poll -> Advanced Uncheck the property Wrap Data Types. Hope it helps...

http://stackoverflow.com/comment/54158263
type: Comment
score: 1
comment on: http://stackoverflow.com/a/33170314
type: AnswerComment
has text: I am not in the position to test this anymore, but it sounds clever and promising. I will mark it as the solution though, thanks!

http://stackoverflow.com/comment/43354069
type: Comment
has text: How would you implement `printData()` as the OP asked?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27458547

http://stackoverflow.com/comment/43355754
type: Comment
type: QuestionComment
has text: @Everv0id Resource also doesn't work
comment on: http://stackoverflow.com/q/27459207
score: 0

http://stackoverflow.com/q/27416323
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27420348
score: 1
tagged with: java
type: Question
upvote count: 1
answer count: 1
has body: What is DefaultActionSupport class in Struts2 and why do I use it when I am using ActionSupport? Is there any necessity of using DefaultActionSupport instead of ActionSupport?
favorite count: 0
tagged with: struts2
has title: What is the difference between ActionSupport and DefaultActionSupport?

http://stackoverflow.com/comment/43236668
score: 1
has text: Looks like your homework?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27395049

http://stackoverflow.com/a/27396827
has body: I see two immediate ways to improve your program: do not use the obsolete wait/notify mechanism. Instead rely on concurrency helpers in java.util.concurrent. Depending on the wider picture, CountDownLatch, Semaphore, or Phaser may be the best choice; it is dangerous to let the subprocess run without consuming its output streams, it may easily lead to a deadlock on waitFor(). Use ProcessBuilder with inheritIO to avoid that.
has comment: http://stackoverflow.com/comment/43240161
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27396574
downvote count: 0
type: Answer

http://stackoverflow.com/comment/43147285
type: Comment
has text: Well the code is like it was before. The other code I got is the code from my professor which is letting me read from a file. All i changed now is that I expanded my placeholderMatrix to the length Integer.MAX_VALUE: placeholderMatrix[Integer.MAX_VALUE][Integer.MAX_VALUE] because the numbers I'm getting are from the whole Integer numbers. So I need a 2 dimensional Array which can show them. or am I wrong? I'll add my Task I have to do in my main post
score: 0
comment on: http://stackoverflow.com/a/27341889
type: AnswerComment

http://stackoverflow.com/a/27381954
has comment: http://stackoverflow.com/comment/43213186
has body: Your problem seems to be with generics. Adding to a generics list ... I usually reason about this stuff, by remembering a mnemonic I learned in Effective Java: PECS: producer-extends, consumer super. So this means the following in your case: Since the returned list in the method getTable() is a consumer(i.e. you are adding to this list), then u should declare it as: public &lt;TI extends TableItem&gt; ArrayList&lt;? super TableItem&gt; getTable() { ArrayList&lt;TableItem&gt; list = new ArrayList&lt;TableItem&gt;(); TableItem item = new TableItem(); list.add(item); return list; }
has comment: http://stackoverflow.com/comment/43212896
has comment: http://stackoverflow.com/comment/43335339
downvote count: 0
upvote count: 2
type: Answer
answers question: http://stackoverflow.com/q/27381523
score: 2

http://stackoverflow.com/a/27834811
upvote count: 1
has body: you need to add the JMS header "JMSDeliveryMode" as 2. As per the jms-1.1.jar package javax.jms; public interface DeliveryMode { int NON_PERSISTENT = 1; int PERSISTENT = 2; }
answers question: http://stackoverflow.com/q/27423158
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27423158
type: Answer
score: 1

http://stackoverflow.com/a/27337379
answers question: http://stackoverflow.com/q/27337222
upvote count: 2
type: Answer
has body: An overload in a child class hides the method being overloaded in the parent class. In this case, Problematic.method() overloads and hides Parent.method(int).
downvote count: 1
has comment: http://stackoverflow.com/comment/43131979
score: 1
has comment: http://stackoverflow.com/comment/43131402
has comment: http://stackoverflow.com/comment/43131382

http://stackoverflow.com/q/27473880
upvote count: 8
type: Question
has answer: http://stackoverflow.com/a/27474728
accepted answer: http://stackoverflow.com/a/27474728
answer count: 2
has body: How can i join two tables using HQL? At first, here is my SQL create query for two tables: CREATE TABLE `subject` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `name` VARCHAR(50) NOT NULL, PRIMARY KEY (`id`) ) CREATE TABLE `employee` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `subject_id` INT(11) UNSIGNED NOT NULL, `surname` VARCHAR(50) NOT NULL, PRIMARY KEY (`id`), INDEX `FK_employee_subject` (`subject_id`), CONSTRAINT `FK_employee_subject` FOREIGN KEY (`subject_id`) REFERENCES `subject` (`id`) ON UPDATE CASCADE ON DELETE CASCADE ) I'm using Netbeans and here is my generated entities. Subject entity: @Entity @Table(name = "subject", catalog = "university") public class Subject implements java.io.Serializable { private Integer id; private String name; private Set&lt;Employee&gt; employees = new HashSet&lt;Employee&gt;(0); private Set&lt;Report&gt; reports = new HashSet&lt;Report&gt;(0); public Subject() { } public Subject(String name) { this.name = name; } public Subject(String name, Set&lt;Employee&gt; employees, Set&lt;Report&gt; reports) { this.name = name; this.employees = employees; this.reports = reports; } @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "id", unique = true, nullable = false) public Integer getId() { return this.id; } public void setId(Integer id) { this.id = id; } @Column(name = "name", nullable = false, length = 50) public String getName() { return this.name; } public void setName(String name) { this.name = name; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "subject") public Set&lt;Employee&gt; getEmployees() { return this.employees; } public void setEmployees(Set&lt;Employee&gt; employees) { this.employees = employees; } @OneToMany(fetch = FetchType.LAZY, mappedBy = "subject") public Set&lt;Report&gt; getReports() { return this.reports; } public void setReports(Set&lt;Report&gt; reports) { this.reports = reports; } } Employee entity: @Entity @Table(name = "employee", catalog = "university") public class Employee implemen…
favorite count: 0
possible better answer: http://stackoverflow.com/a/41974112
has title: Join two tables HQL query
score: 8
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/41974112
downvote count: 0
tagged with: join
tagged with: java
tagged with: mysql
tagged with: hql

http://stackoverflow.com/a/32866883
has body: For those who have same problem. From above code i understand you want to change colour of SeekBar i had same problem , after lot of search i made method of my own. public void changeSeekbarColor(SeekBar s,int colorp,int colors,int color b) { PorterDuff.Mode mMode = PorterDuff.Mode.SRC_ATOP; LayerDrawable layerDrawable = (LayerDrawable) s.getProgressDrawable(); Drawable progress = (Drawable) layerDrawable.findDrawableByLayerId(android.R.id.progress); Drawable secondary = (Drawable) layerDrawable.findDrawableByLayerId(android.R.id.secondaryProgress); Drawable background = (Drawable) layerDrawable.findDrawableByLayerId(android.R.id.background); Drawable th = s.getThumb(); // Setting colors progress.setColorFilter(colorp,mMode); secondary.setColorFilter(colors,mMode); background.setColorFilter(colorb, mMode); th.setColorFilter(colorp,mMode); // Applying Tinted Drawables layerDrawable.setDrawableByLayerId(android.R.id.progress, progress); layerDrawable.setDrawableByLayerId(android.R.id.secondaryProgress, secondary); layerDrawable.setDrawableByLayerId(android.R.id.background, background); }
upvote count: 4
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/27444822
type: Answer

http://stackoverflow.com/comment/43374093
type: Comment
comment on: http://stackoverflow.com/q/27469423
score: 0
has text: Pass the Change object through method create into the constructor of NewText.
type: QuestionComment

http://stackoverflow.com/comment/43333555
has text: i think you forgot "f.createNewFile();" before the return statement and after .mkdirs()
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/27445957
type: Comment

http://stackoverflow.com/comment/43125511
comment on: http://stackoverflow.com/q/27332319
type: QuestionComment
has text: Yep I realised my description wasn't right. Equals() was the problem, I am not good programmer :D (btw I don't know how to make method duplicateVertices more efficient. I appreciate any idea)
type: Comment
score: 0

http://stackoverflow.com/comment/116702097
has text: @csotiriou It passes it in the constructor... see "new ListView<CustomThing>(*data*) <==="
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27439026

http://stackoverflow.com/a/27441107
has comment: http://stackoverflow.com/comment/43322196
accepted answer of: http://stackoverflow.com/q/27441078
has comment: http://stackoverflow.com/comment/43324276
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43321766
has comment: http://stackoverflow.com/comment/43322591
score: 1
has body: Initialize someData before using it. This should be the code in your onClick method : String stringData = etNewListName.getText().toString(); someData = getSharedPreferences(filename,0); SharedPreferences.Editor editor = someData.edit(); editor.putString("sharedString", stringData); editor.commit(); String dataReturned = someData.getString("SharedString", "Unable to Load Data"); tvResults.setText(dataReturned); SET operations : Set&lt;String&gt; set = new HashSet&lt;String&gt; (); for (String s : set) { //do operations on string s }
has comment: http://stackoverflow.com/comment/43322863
upvote count: 1
answers question: http://stackoverflow.com/q/27441078
has comment: http://stackoverflow.com/comment/43322002

http://stackoverflow.com/q/27363324
has answer: http://stackoverflow.com/a/27363739
favorite count: 0
has title: Difficulty saving and storing
has body: I am trying to save and store data in an android app using java. At the moment the data will not save and it causes my app to crash. Can anyone make any suggestions to my code? Part of my page includes a total budget and I am difficulty storing and saving the total budget. public class Summary extends Activity implements TextWatcher, View.OnClickListener { DecimalFormat df = new DecimalFormat("£0.00"); int noOfGifts, giftsPurchased; double cost; EditText budgetEntered; double savedBudget = 0; String budgetString; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.summary); budgetEntered = (EditText) findViewById(R.id.s2TotalBudget); budgetEntered.addTextChangedListener(this); Button saveBudget = (Button) findViewById(R.id.s2ViewList); saveBudget.setOnClickListener(saveButtonListener); if(savedBudget != 0) { saveBudget.setText(budgetString); } Bundle passedInfo = getIntent().getExtras(); if (passedInfo != null) { cost = passedInfo.getDouble("cost"); noOfGifts = passedInfo.getInt("noOfGifts"); giftsPurchased = passedInfo.getInt("giftsPurchased"); } Button logoutButton = (Button) findViewById(R.id.s2LogoutButton); logoutButton.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Intent myIntent = new Intent(Summary.this, MainActivity.class); startActivity(myIntent); } }); Button viewList = (Button) findViewById(R.id.s2ViewList); viewList.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Intent myIntent = new Intent(Summary.this, GiftList.class); startActivity(myIntent); } }); String [][] summary = {{"Number of Presents to buy: ", (noOfGifts + "")}, {"Number of Presents bought:", (giftsPurchased + "")}, {"Cost: £", (cost + "")}, {"Budget: £", "50"}}; String passedBudget=null; //convert totalPresents to double from String String tempPresents = summary[0][1]; int presents = Integer.parseInt(tempPresents); //convert presentsBought to double fro…
type: UnansweredQuestion
tagged with: android
score: -3
has comment: http://stackoverflow.com/comment/43179037
has comment: http://stackoverflow.com/comment/43178552
tagged with: java
downvote count: 3
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/43178560
answer count: 1

http://stackoverflow.com/a/31309659
has body: Just for the sake of it I'll post the following, if any one disagrees please correct me. In general in java you are advised to use Spring/hibernate and JPA. Hibernate implements JPA so you will need dependencies for Spring and Hibernate. Next let Spring/hibernate manage your transactions and the committing part. It is bad practice to flush/commit your data yourself. For instance let assume the following method: public void changeName(long id, String newName) { CustomEntity entity = dao.find(id); entity.setName(newName); } Nothing will happen after this method (you could call merge and commit). But if you annotate it with @Transactional, your entity will be managed and at the end of the @Transactional method Spring/hibernate will commit your changes. So this is enough: @Transactional public void changeName(long id, String newName) { CustomEntity entity = dao.find(id); entity.setName(newName); } No need to call flush, Spring/Hibernate will handle all the mess for you. Just don't forget that your tests have to call @Transactional methods, or should be @Transactional themselves.
type: Answer
answers question: http://stackoverflow.com/q/27356794
score: 0

http://stackoverflow.com/comment/43145301
score: 0
type: Comment
type: QuestionComment
has text: Are you using html 5?
comment on: http://stackoverflow.com/q/27345018

http://stackoverflow.com/q/27367325
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27367885
tagged with: encryption
tagged with: android
has body: I'm trying to understand a code that lists all supported encryption algorithms on an Android device. I'm just wondering why is it necessary to add the step with ('Alg.Alias') and remove these characters from the service name ? The application stops working without it and I don't understand why ! package com.example.lab_enc_dec; import java.security.Provider; import java.security.Security; import java.util.Iterator; import java.util.Set; import java.util.TreeSet; import com.example.lab_enc_dec.R; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class ListCryptoAlgorithms extends Activity { static final String TAG = "ListCryptoAlgorithms"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.algorithm_list); ListSupportedAlgorithms(); } public void ListSupportedAlgorithms() { String result = ""; // get all the providers Provider[] providers = Security.getProviders(); for (int p = 0; p &lt; providers.length; p++) { // get all service types for a specific provider Set&lt;Object&gt; ks = providers[p].keySet(); Set&lt;String&gt; servicetypes = new TreeSet&lt;String&gt;(); for (Iterator&lt;Object&gt; it = ks.iterator(); it.hasNext();) { String k = it.next().toString(); k = k.split(" ")[0]; if (k.startsWith("Alg.Alias.")) k = k.substring(10); servicetypes.add(k.substring(0, k.indexOf('.'))); } // get all algorithms for a specific service type int s = 1; for (Iterator&lt;String&gt; its = servicetypes.iterator(); its.hasNext();) { String stype = its.next(); Set&lt;String&gt; algorithms = new TreeSet&lt;String&gt;(); for (Iterator&lt;Object&gt; it = ks.iterator(); it.hasNext();) { String k = it.next().toString(); k = k.split(" ")[0]; if (k.startsWith(stype + ".")) algorithms.add(k.substring(stype.length() + 1)); else if (k.startsWith("Alg.Alias." + stype +".")) algorithms.add(k.substring(stype.length() + 11)); } int a = 1; for (Iterator&lt;String&gt; ita = algorithms…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43188167
accepted answer: http://stackoverflow.com/a/27367885
tagged with: java
has comment: http://stackoverflow.com/comment/43193304
type: Question
has title: Encryption Android
has comment: http://stackoverflow.com/comment/43187718
has comment: http://stackoverflow.com/comment/43188011

http://stackoverflow.com/comment/43228631
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27390321
score: 1
has text: Very clever .. "destroy" the old [question](http://stackoverflow.com/questions/27384270/breaks-from-loop) (with answers) and create a new one with the exact same code.

http://stackoverflow.com/comment/43103949
score: 0
type: Comment
type: QuestionComment
has text: Related: http://stackoverflow.com/questions/22360737/gradle-how-do-i-include-a-local-jar-from-a-dependent-java-project-in-an-android?rq=1 - "This is not directly possible as local jars are not declared as transitive dependencies in Gradle."
comment on: http://stackoverflow.com/q/27319423

http://stackoverflow.com/a/27434351
accepted answer of: http://stackoverflow.com/q/27434229
has comment: http://stackoverflow.com/comment/43312078
has comment: http://stackoverflow.com/comment/43343234
has comment: http://stackoverflow.com/comment/43310714
score: 1
has body: As far as I can see you create a new GameConsole object in your main, so I assume this is the object the whole game is played on. If this is the case, why does your button create a new GameConsole object? I assume you're getting a NullPointerException because your button calls the userTurn() method on a new GameConsole object that doesn't have a User object yet, so user.sumOfHand() for example would throw the exception. Your button should call the userTurn method on the GameConsole object you created in your main, not on a new one. Code Suggestion: JButton newRoundButton= new JButton("Start another round"); newRoundButton.setPreferedSize(new Dimension(150, 50)); newRoundButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.out.println("Hi there for a new round"); game.userTurn(); } }); endGamePanel.add(newRoundButton); This is assuming that whatever class builds your panel knows about your GameConsole object. If this class is the GameConsole object itself, just remove game. If an object of that class is created in your GameConsole object, just pass your GameConsole object to that class with a parameter GameConsole game in that classes constructor and, if needed make it a field in that class. To pass your GameConsole object from that object, pass this.
has comment: http://stackoverflow.com/comment/43310958
has comment: http://stackoverflow.com/comment/43338949
has comment: http://stackoverflow.com/comment/43343542
has comment: http://stackoverflow.com/comment/43310253
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43309936
upvote count: 1
has comment: http://stackoverflow.com/comment/43337966
has comment: http://stackoverflow.com/comment/43311966
answers question: http://stackoverflow.com/q/27434229
downvote count: 0
type: Answer

http://stackoverflow.com/a/27315005
answers question: http://stackoverflow.com/q/27314896
type: Answer
accepted answer of: http://stackoverflow.com/q/27314896
has body: Looks like the problem occurred because adb server was not running. I ran the command $ adb start-server adb server is out of date. killing... * daemon started successfully * And then ensured that the emulator is detected by adb: $ adb devices List of devices attached emulator-5554 device Then I went to Eclipse again, and tried to run the app by using Run As -> Android Application After a few seconds, voila, the emulator showed my app! :-) Problem solved. Hope this helps someone that has the same problem.
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/43172872
type: AnswerComment
has text: The question is about the constants, not the methods. I expect OP to wonder even more why another method is needed to return that constant. You answer that second concern, but do not address OP's question at all.
type: Comment
comment on: http://stackoverflow.com/a/27360399
score: 3

http://stackoverflow.com/comment/43358595
has text: I agree with Simon and just so you know, you should be able to create 30k docs in a few seconds depending on server/network resources and the size of your docs.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27445119
type: Comment

http://stackoverflow.com/comment/43286622
has text: so how does input = buffer.readLine(); work in the read method? it doesn't have a try catch block around it either
comment on: http://stackoverflow.com/a/27422179
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27447706
has comment: http://stackoverflow.com/comment/43334692
tagged with: java
has body: I am trying to make a program that generates 100 integers from 0 to 25 and store them in 3 arrays: one for all the numbers, one for even, one for odd. I am having trouble with adding the variable n to my arrays. My .get is also not working well. Thanks! import java.util.ArrayList; import java.util.Arrays; import java.util.Random; public class randomdemo { public static ArrayList randommethod() { int i = 0; ArrayList myArray = new ArrayList(); ArrayList evenArray = new ArrayList(); ArrayList oddArray = new ArrayList(); while(i&lt;=99) { Random rand = new Random(); int n = rand.nextInt(25) + 0; myArray.add(n); if(myArray.get(i) % 1 == 0) { evenArray.add(n); } else { oddArray.add(n); } i++; } return myArray; return evenArray; return oddArray; } public static void main(String args[]) { randommethod(); } }
has answer: http://stackoverflow.com/a/27447839
answer count: 2
tagged with: random
has title: ArrayList .get and .add with variables Java
has answer: http://stackoverflow.com/a/27447861
favorite count: 0
has comment: http://stackoverflow.com/comment/43334257
tagged with: get
tagged with: arraylist
linked to: http://stackoverflow.com/q/2770321
has comment: http://stackoverflow.com/comment/43334353
has comment: http://stackoverflow.com/comment/43334407
has comment: http://stackoverflow.com/comment/43334281
linked to: http://stackoverflow.com/q/15117132
possible better answer: http://stackoverflow.com/a/27447861
accepted answer: http://stackoverflow.com/a/27447839
has comment: http://stackoverflow.com/comment/43334438
has comment: http://stackoverflow.com/comment/43334423
score: 0
tagged with: addition
upvote count: 1
downvote count: 1
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/43315271
type: Comment
type: QuestionComment
has text: atleast go through the documentation of the JDBC connector you are using. for e.g. here is one :http://dev.mysql.com/doc/connector-j/en/connector-j-usagenotes-connect-drivermanager.html
comment on: http://stackoverflow.com/q/27437391
score: 0

http://stackoverflow.com/comment/43320125
comment on: http://stackoverflow.com/q/27440191
type: Comment
has text: Where is definition of `TableEntryIterator`?
type: QuestionComment
score: 2

http://stackoverflow.com/comment/43213432
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27378949
has text: @JamesPulley, I'm trying to run it using another JRE (v7), not the JDK's JRE (v6). Is there a way to specify a JRE that is not the JDK's JRE?

http://stackoverflow.com/comment/43165656
type: QuestionComment
comment on: http://stackoverflow.com/q/27354020
has text: Please specify where Correct detail where you are stuck
score: 0
type: Comment

http://stackoverflow.com/a/27541345
score: 0
type: Answer
has body: Thanks for your answer but I've see, I can't use this solution, because I need yo check all my data every 1s to count how many time it start, so I have look for Executor and use two global variable, one With an Executer.schedulerThreadPool(5); and newSingleThreadExecutor And they run with ont problem over 11hours or + Its the best solution i've found. Problem solved
answers question: http://stackoverflow.com/q/27411689

overriding
tags question: http://stackoverflow.com/q/27427798
tags question: http://stackoverflow.com/q/27380688
tags question: http://stackoverflow.com/q/27351913
tags question: http://stackoverflow.com/q/27430484
tags question: http://stackoverflow.com/q/27455037
tags question: http://stackoverflow.com/q/27438308
type: Tag
tags question: http://stackoverflow.com/q/27410620
tags question: http://stackoverflow.com/q/27335755
tag name: overriding

http://stackoverflow.com/a/27443943
has body: Anyhow the CellContext used by the ComponentProvider always indicates that the node is expanded. This behavior goes back to the implementation of getTableCellRenderer(...) provided by DefaultTableRenderer: both expanded and leaf properties are set to true: public class DefaultTableRenderer extends AbstractRenderer implements TableCellRenderer { private TableCellContext cellContext; ... @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { // both 'expanded' and 'leaf' properties are set to 'true' here: cellContext.installContext(table, value, row, column, isSelected, hasFocus, true, true); // 'componentController' is an instance of 'ComponentProvider&lt;?&gt;' Component comp = componentController.getRendererComponent(cellContext); cellContext.replaceValue(null); return comp; } ... } It makes sense given those properties are significant in a tree cell context, not a table cell context. If you set a TreeCellRenderer to the JXTreeTable using the very same ComponentProvider then it should work as expected in the first column (tree column): ComponentProvider&lt;?&gt; textProvider = new LabelProvider(valueProvider, JLabel.TRAILING) {...}; ... DefaultTreeRenderer treeRenderer = new DefaultTreeRenderer(textProvider); ... treeTable.setTreeCellRenderer(treeRenderer); Because the CellContext won't be a TableCellContext but a TreeCellContext and it will contain the correct expanded and leaf values: public class DefaultTreeRenderer extends AbstractRenderer implements TreeCellRenderer { private TreeCellContext cellContext; ... @Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { // both 'expanded' and 'leaf' properties are correctly set here: cellContext.installContext(tree, value, row, 0, selected, hasFocus, expanded, leaf); // 'componentController' is an instance of 'ComponentProvi…
has comment: http://stackoverflow.com/comment/43397627
score: 0
answers question: http://stackoverflow.com/q/27421887
has comment: http://stackoverflow.com/comment/43393986
type: Answer

http://stackoverflow.com/comment/43145812
score: 0
type: Comment
type: QuestionComment
has text: @Mitsos Dim What is String? Is it std::string?
comment on: http://stackoverflow.com/q/27345226

http://stackoverflow.com/comment/43153152
type: Comment
comment on: http://stackoverflow.com/a/27349210
score: 0
type: AnswerComment
has text: thanks ,i tried your answer and the only wrong thing that setText method needs String you pass it integers so i edit your solution like that `String value = ((JButton)e.getSource()).getText(); txt.setText(txt.getText() + value);` and guess what .. it works i also find another solution i will add it to next answer i couldn't sleep until i found the answer ,so thanks for help

http://stackoverflow.com/q/27474565
has comment: http://stackoverflow.com/comment/43384424
tagged with: jtextpane
tagged with: swing
possible better answer: http://stackoverflow.com/a/27474627
has answer: http://stackoverflow.com/a/28658622
type: Question
type: AnsweredQuestion
score: 3
has comment: http://stackoverflow.com/comment/43586475
has answer: http://stackoverflow.com/a/27493361
tagged with: java
has comment: http://stackoverflow.com/comment/43383464
has body: I have two JTextPanes with static size and I want to connect them like two pages in text processor. If I write something in the first JTextPane (page) and it will be too long for one JTextPane then it overflow to the second JTextPane (page). I don't want something like this (first pane have been expanded): But I want something like this: There is my testing code: public class Test2 extends JFrame{ JTextPane textPane1; JTextPane textPane2; /** * Inicialization */ public Test2() { textPane1 = getTextPane(); textPane2 = getTextPane(); getContentPane().setLayout(new GridBagLayout()); getContentPane().add(textPane1,getGridBagConstraints(0)); getContentPane().add(textPane2,getGridBagConstraints(1)); } /** * Settings for text panes */ private JTextPane getTextPane(){ JTextPane pane = new JTextPane(); pane.setEditorKit(new WrapEditorKit()); pane.setMaximumSize(new java.awt.Dimension(100, 108)); pane.setMinimumSize(new java.awt.Dimension(100, 108)); pane.setPreferredSize(new java.awt.Dimension(100, 108)); pane.setBorder(new StrokeBorder(new BasicStroke())); return pane; } /** * Setting layout for text panes. */ private GridBagConstraints getGridBagConstraints(int index){ GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = index; gridBagConstraints.anchor = GridBagConstraints.NORTHWEST; return gridBagConstraints; } /** * Main */ public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JFrame frame = new Test2(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.pack(); frame.setVisible(true); } }); } /** * Just class for wrapping text in text panes. */ private static class WrapEditorKit extends StyledEditorKit { ViewFactory defaultFactory = new WrapColumnFactory(); @Override public ViewFactory getViewFactory() { return defaultFactory; } private class WrapColumnFactory implements ViewFactory { @Override public javax.swing.text.View create(E…
has comment: http://stackoverflow.com/comment/43392462
linked to: http://stackoverflow.com/q/22072975
has comment: http://stackoverflow.com/comment/43392478
answer count: 3
has comment: http://stackoverflow.com/comment/43383862
downvote count: 0
accepted answer: http://stackoverflow.com/a/28658622
has title: Two linked JTextPanes
favorite count: 0
has comment: http://stackoverflow.com/comment/43384054
has answer: http://stackoverflow.com/a/27474627
upvote count: 3

http://stackoverflow.com/q/27394251
has body: I need to send concatenated SMS for which i split the message(which is more than 160 bytes) in small parts now i want to put one header in each part.header have 6 octets as follows Field 1 (1 octet): Length of User Data Header, in this case 05. Field 2 (1 octet): Information Element Identifier, equal to 00 (Concatenated short messages, 8-bit reference number) Field 3 (1 octet): Length of the header, excluding the first two fields; equal to 03 Field 4 (1 octet): 00-FF, CSMS reference number, must be same for all the SMS parts in the CSMS Field 5 (1 octet): 00-FF, total number of parts. Field 6 (1 octet): 00-FF, this part's number in the sequence. Example: 05 00 03 CC 02 01 [ message ] 05 00 03 CC 02 02 [ message ] Now the problem is i want to put these 6 octets in 7 septets and which need to decrements the size of an SMS message from 160 to 153 characters.How to convert these 6 octets in 7 septets.is there any coding avilable
tagged with: java
type: Question
tagged with: concatenation
has title: Creating UDH for 7-bit concatenated SMS
downvote count: 0
tagged with: header
tagged with: string
answer count: 1
accepted answer: http://stackoverflow.com/a/27433800
favorite count: 0
upvote count: 2
tagged with: sms
has answer: http://stackoverflow.com/a/27433800
type: AnsweredQuestion
score: 2

http://stackoverflow.com/q/27386883
type: Question
answer count: 2
tagged with: jackson
has answer: http://stackoverflow.com/a/27399462
downvote count: 0
has title: Json response not generated as expected using @JsonCreator andd @JsonProperty
favorite count: 0
type: UnansweredQuestion
tagged with: annotations
upvote count: 1
tagged with: spring
has answer: http://stackoverflow.com/a/27387369
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am using JDK 1.6 , Jackson 2.0.5 , Spring 3.0.3 and using jackson annotations to serialize and deserialize json response. public class MyDate extends java.sql.Date{ private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd/yyyy"); private String dateString; @JsonCreator public MyDate(@JsonProperty("dateString") String date){ super(simpleDateFormat.parse(date).getTime()); dateString = date; } public String getDateString(){ return dateString; } private final setDateString(String date){ // ..... } } I am getting json response message like 1417977000000 , but it should be like 12/08/2014. Do I need to write anything else also ? I tried to follow Jackson wiki page article. EDIT: On basis of discussion with @Sotirios Delimanolis I tried JsonValue annotation on getter method and it worked. @JsonValue public String getDateString(){ return dateString; }

http://stackoverflow.com/comment/43314845
score: 0
type: Comment
type: AnswerComment
has text: If the configuration file is supposed to be specific to one web application and you do have other web applications deployed on the same jvm instance then JNDI is another way of configuring. If not adding it to the WEB-INF/classes/ directory is an another option.
comment on: http://stackoverflow.com/a/27423449

http://stackoverflow.com/comment/43113274
score: 0
type: Comment
has text: `paint()` is an overriden method for my `JLabel`
type: QuestionComment
comment on: http://stackoverflow.com/q/27327078

http://stackoverflow.com/a/27402841
upvote count: 1
has comment: http://stackoverflow.com/comment/43257646
downvote count: 1
has body: For local Address you can use, System.out.println(Inet4Address.getLocalHost().getHostAddress()); For Server Address you use, System.out.println(serversocket.getRemoteSocketAddress().toString());
has comment: http://stackoverflow.com/comment/43262780
answers question: http://stackoverflow.com/q/27401697
score: 0
type: Answer

http://stackoverflow.com/a/27363709
type: Answer
answers question: http://stackoverflow.com/q/27363689
downvote count: 1
type: AcceptedAnswer
upvote count: 5
score: 4
has body: Classic: != doesn't check string equality, but pointer equality. Try while (!myString.equals("done")) {
accepted answer of: http://stackoverflow.com/q/27363689

http://stackoverflow.com/comment/43290448
score: 0
has text: see my edits. i did not test it, but it should solve it for you. Biggest thing is you were not setting temp.link to null.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27412549

http://stackoverflow.com/comment/88806893
has text: how do i get speed without startTime and endtime ?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27515749
type: Comment

http://stackoverflow.com/a/27439172
type: Answer
has body: You need to add equals method in Book class. if both author is same it will return true.
answers question: http://stackoverflow.com/q/27439089
score: 0

http://stackoverflow.com/comment/43196699
has text: Yes I agree that it's broad. But Idon't agree that it's *underspecified*. Do you *really* want me to specify *how many total records*?
type: Comment
comment on: http://stackoverflow.com/q/27372819
type: QuestionComment
score: 0

http://stackoverflow.com/q/27392982
answer count: 4
possible better answer: http://stackoverflow.com/a/27393035
has body: I have the following class: public class SHConfigureContactFragment extends Fragment{ private EditText name; private EditText description; private EditText primaryNumber; private EditText secondaryNumber; private EditText email; private EditText skype; private Byte[] photo; private Boolean isDualPane; private FragmentManager fragmentManager; private SHContactMenuFragment menuFragment; private SHConfigureContactFragment contactFragment; private DatabaseControllerLibrary controller; private Contact contact; private SHPatient patient; private int patientId; public View rootView; public int selectedIndex; public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); if(savedInstanceState != null) { this.selectedIndex = savedInstanceState.getInt("SELECTED_INDEX"); this.contact = (Contact) savedInstanceState.getSerializable("CONTACT"); } } public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putSerializable("CONTACT", contact); } public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); controller = SHController.getInstance(getActivity()); patient = ((SHController) controller).getPatient(); patientId = patient.getId(); } public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){ super.onCreateView(inflater, container, savedInstanceState); rootView = inflater.inflate(R.layout.sh_fragment_contact_edit, container, false); Button button = (Button) rootView.findViewById(R.id.addContactButton); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Do something in response to button click boolean isValid = true; // assigning IDs based on how many contacts are created. no reused IDs son! int id = controller.getContactsCount(); id++; String newName = name.getText().toString().trim(); String newDescription = description.getText().toString().trim(); String newPrimaryNumber = primaryNumber.getText()…
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43233323
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/27393033
type: Question
score: -2
has answer: http://stackoverflow.com/a/27394829
has answer: http://stackoverflow.com/a/27393065
upvote count: 0
has title: NullPointer exception when using getText().toString().trim();
favorite count: 0
has answer: http://stackoverflow.com/a/27393035
tagged with: nullpointerexception
tagged with: android
has comment: http://stackoverflow.com/comment/43233321
accepted answer: http://stackoverflow.com/a/27393065

http://stackoverflow.com/comment/43303717
type: Comment
has text: Thank you so much for this detailed and specific answer. I think this is exactly what I need. I am going to test this out now and see if it works.
type: AnswerComment
comment on: http://stackoverflow.com/a/27431208
score: 0

http://stackoverflow.com/q/27441078
accepted answer: http://stackoverflow.com/a/27441107
type: AnsweredQuestion
upvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43321799
has answer: http://stackoverflow.com/a/27441239
type: Question
linked to: http://stackoverflow.com/q/218384
score: -2
answer count: 2
downvote count: 2
possible better answer: http://stackoverflow.com/a/27441239
favorite count: 0
has title: Android NullPointerException on button click
has body: I am experimenting with shared preferences and I get a NullPointerException error when I click the button bAddList. Here is my MainActivity Class (The only class in the project) package com.teamvdb.checklist; import android.app.Activity; import android.content.SharedPreferences; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class MainActivity extends Activity{ static String filename; SharedPreferences.Editor editor; SharedPreferences someData; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.main); filename ="checkLists"; Button bAddList = (Button) findViewById(R.id.bAddList); final EditText etNewListName = (EditText) findViewById(R.id.etListName); final TextView tvResults = (TextView) findViewById(R.id.result); bAddList.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub String stringData = etNewListName.getText().toString(); SharedPreferences.Editor editor = someData.edit(); editor.putString("sharedString", stringData); editor.commit(); someData = getSharedPreferences(filename,0); String dataReturned = someData.getString("SharedString", "Unable to Load Data"); tvResults.setText(dataReturned); } }); } } Logcat 12-12 20:50:37.818: W/dalvikvm(32683): threadid=1: thread exiting with uncaught exception (group=0x41812da0) 12-12 20:50:37.818: E/AndroidRuntime(32683): FATAL EXCEPTION: main 12-12 20:50:37.818: E/AndroidRuntime(32683): Process: com.teamvdb.checklist, PID: 32683 12-12 20:50:37.818: E/AndroidRuntime(32683): java.lang.NullPointerException 12-12 20:50:37.818: E/AndroidRuntime(32683): at com.teamvdb.checklist.MainActivity$1.onClick(MainActivity.java:32) 12-12 20:50:37.818: E/AndroidRuntime(32683): at android.view.View.performClick(View.java:4637) 12-12 20:50:37.818: E/AndroidRunti…
tagged with: android
duplicate of: http://stackoverflow.com/q/218384
has answer: http://stackoverflow.com/a/27441107

http://stackoverflow.com/q/27336968
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43131179
has answer: http://stackoverflow.com/a/27337611
type: Question
has comment: http://stackoverflow.com/comment/43131719
tagged with: java
has comment: http://stackoverflow.com/comment/43131619
score: 0
has comment: http://stackoverflow.com/comment/43131152
answer count: 1
has title: Heap that implements Comparable in Java
has body: I have an array that is full of Doubles and I want to save those doubles in a heap. The problem is I need to keep record of the index of the array. Double[] array = new Double[n]; //imagine it's filled with doubles Now I have a PriorityQueue: PriorityQueue&lt;Integer&gt; heap = new PriorityQueue&lt;Integer&gt;(); //Integer because it's an heap of indexes I want to add each element of the array to the heap, but I want to keep record of the INDEX. So imagine I add index 0 to the heap: The heap stores 0, but uses array[0] to compare and sort it. Not index 0 itself, that's just like a class index. Stores v but compares v.value When I get a value from the heap: Imagine I do heap.pull(); The heap returns me index 0, and then I will know the value is array[0]. Can I do this with comparable?

http://stackoverflow.com/q/27456149
accepted answer: http://stackoverflow.com/a/27456161
has body: If we can define a method inside "public static void main()" which is also a function why can't we do like this - public void method_1() { //statements public void method_2() { //statements } }
type: AnsweredQuestion
has title: Why Methods can not be defined inside a method definition
has comment: http://stackoverflow.com/comment/43349873
has answer: http://stackoverflow.com/a/27456503
tagged with: java
downvote count: 1
type: Question
score: 0
answer count: 2
upvote count: 1
possible better answer: http://stackoverflow.com/a/27456503
has comment: http://stackoverflow.com/comment/43349840
favorite count: 0
has comment: http://stackoverflow.com/comment/43349819
has answer: http://stackoverflow.com/a/27456161

android-actionbar
type: Tag
tags question: http://stackoverflow.com/q/27363160
tags question: http://stackoverflow.com/q/27345188
tags question: http://stackoverflow.com/q/27375548
tags question: http://stackoverflow.com/q/27389552
tag name: android-actionbar
tags question: http://stackoverflow.com/q/27453403
tags question: http://stackoverflow.com/q/27471583

http://stackoverflow.com/q/27403574
answer count: 1
favorite count: 0
has title: DirectedGraph: addVertex(Vertex<T> v), String cannot be converted to Vertex
has body: I am trying to learn and implement Directed Graph and facing some difficulties in executing the program. // ADD Function public boolean addVertex(Vertex&lt;T&gt; v) { boolean added = false; if (verticies.contains(v) == false) { added = verticies.add(v); return true; } return added; } class Vertex&lt;T&gt; { private String name; private T data; /** * Create a Vertex with name n and given data * * @param n - name of vertex * @param data - data associated with vertex */ public Vertex(String n, T data) { incomingEdges = new java.util.ArrayList&lt;Edge&lt;T&gt;&gt;(); outgoingEdges = new java.util.ArrayList&lt;Edge&lt;T&gt;&gt;(); name = n; this.data = data; } } // Initialization of the Vertices &amp; Edges public GraphImpl() { verticies = new java.util.ArrayList&lt;Vertex&lt;T&gt;&gt;(); edges = new java.util.ArrayList&lt;Edge&lt;T&gt;&gt;(); } Error: When program is executed, I enter string as a input when the addVertex(String) function is called and it gives an error String cannot be converted to Vertex. Error Recd From Java: java.lang.ClassCastException: java.lang.String cannot be converted to DG.Vertex Can someone please explain me, what I am doing wrong. Thank you.
has comment: http://stackoverflow.com/comment/43262701
score: 2
has comment: http://stackoverflow.com/comment/43255569
downvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27411571
type: Question
tagged with: java
upvote count: 2
tagged with: digraphs

http://stackoverflow.com/comment/43141651
type: Comment
has text: so i just tried to get the hight after everything was displayed mannualy(with onClick), but still, the height returned 0
comment on: http://stackoverflow.com/a/27342743
score: 0
type: AnswerComment

http://stackoverflow.com/q/27388103
downvote count: 0
has body: I am making a game. It is a 2D game, and the map is drawn by a double loop like this: for(int i = 0; i &lt; mapArray.length; i++){ for(int j = 0; j &lt; mapArray[1].length; j++){ //if statement for if its on the screen g.drawImage(tiles.get(mapArray[i][j]).getImage(), j * textureSize, i * textureSize, null); } } They are 32x32 images, and I was wondering stitching them all together to create one large image at the beginning would be more efficient in drawing. The resulting image would only be around 1500x1500. I was thinking of making it stitched into one image (Especially since I am planning on making the images smaller which would make the loop need ever more time.) so that it didn't have to run through the double for loop every time it renders (shooting for 60 FPS). But I don't know how to do this, and would it actually improve the performance if I did? Also, I could just stitch them into rows, and only render the rows that are on the screen(to remove the large image problem) So it would still be much less intensive than that crazy loop I've got right now. Edit: And one last thing, if you can provide an example of how to do this without extra libraries that would be optimal. I currently have this code for stitching: Edit: now works. Leaving this here for future readers: public void stitchImages(){ BufferedImage temp = new BufferedImage( &lt;Width&gt; , &lt;height&gt; , BufferedImage.TYPE_INT_RGB); Graphics2D g = (Graphics2D) temp.getGraphics(); for (int b = 0; b &lt; mapArray.length; b++) { for (int a = 0; a &lt; mapArray[b].length; a++) { g.drawImage(tiles.get(mapArray[b][a]).getImage(), (int) mapX + a * textureSize, (int) mapY + b * textureSize, null); } } mapImage = temp; }
favorite count: 0
type: Question
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/43224425
has comment: http://stackoverflow.com/comment/43224549
has answer: http://stackoverflow.com/a/27388283
answer count: 1
has title: How to stitch many small images into one large image?
tagged with: performance
has comment: http://stackoverflow.com/comment/43224353
tagged with: java
tagged with: image-processing
has comment: http://stackoverflow.com/comment/43224321
accepted answer: http://stackoverflow.com/a/27388283
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43224211

http://stackoverflow.com/comment/43132268
comment on: http://stackoverflow.com/a/27337777
type: AnswerComment
has text: Does OP want to sort the data twice ? I mean do we need to add Collections.sort(entries, new Comparator<Entry>() { @Override public int compare(Entry o1, Entry o2) { return o2.num.compareTo(o1.num); } });
score: 0
type: Comment

http://stackoverflow.com/q/27381329
has answer: http://stackoverflow.com/a/27382060
linked to: http://stackoverflow.com/q/26997240
has comment: http://stackoverflow.com/comment/43250961
tagged with: java-8
type: AnsweredQuestion
downvote count: 0
tagged with: java-stream
tagged with: java
has title: Do terminal operations on streams close the source?
has comment: http://stackoverflow.com/comment/106893140
possible better answer: http://stackoverflow.com/a/27382066
type: Question
linked to: http://stackoverflow.com/q/22921623
answer count: 2
score: 26
duplicate of: http://stackoverflow.com/q/26997240
has body: Consider the following code: Path directory = Paths.get(/* some directory */); Files.list(directory).forEach(System.out::println); Does a terminal operation (like forEach) close the underlying file that has been opened? Refer to the relevant parts of the javadoc of Files.list: The returned stream encapsulates a DirectoryStream. If timely disposal of file system resources is required, the try-with-resources construct should be used to ensure that the stream's close method is invoked after the stream operations are completed. If it doesn't call Stream.close(), what would then be the best alternative to call it while producing maintainable code?
accepted answer: http://stackoverflow.com/a/27382060
upvote count: 26
has answer: http://stackoverflow.com/a/27382066
favorite count: 0
has comment: http://stackoverflow.com/comment/43212879

http://stackoverflow.com/comment/43111625
type: AnswerComment
has text: How would I do that? I just tried that but it now only displays the X and nothing else
type: Comment
comment on: http://stackoverflow.com/a/27326284
score: 0

http://stackoverflow.com/comment/105819809
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27421742
has text: Link is dead. You might want to check that.
type: AnswerComment

http://stackoverflow.com/q/27394086
answer count: 3
possible better answer: http://stackoverflow.com/a/27394152
downvote count: 0
has answer: http://stackoverflow.com/a/27394152
accepted answer: http://stackoverflow.com/a/27394133
favorite count: 0
has comment: http://stackoverflow.com/comment/43235575
upvote count: 2
tagged with: android
score: 2
has body: I was creating a android project in which i was creating a Navigation Drawer. While creating i got 1 error which i described below with java code. and below there is my MainActivity.java code package com.example.laga; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.app.Activity; import android.content.res.Configuration; import android.support.v4.app.ActionBarDrawerToggle; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends ActionBarActivity { private String[] drawerListViewItems; private DrawerLayout drawerLayout; private ListView drawerListView; private ActionBarDrawerToggle actionBarDrawerToggle; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // 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)); // 2. App Icon drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); // 2.1 create ActionBarDrawerToggle 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 */ ); // 2.2 Set actionBarDrawerToggle as the DrawerListener drawerLayout.setDrawerListener(actionBarDrawerToggle); // 2.3 ena…
type: AnsweredQuestion
tagged with: java
type: Question
has title: How can i fix the error in java errors?
has answer: http://stackoverflow.com/a/27394133
has comment: http://stackoverflow.com/comment/43235183
has answer: http://stackoverflow.com/a/27394350

http://stackoverflow.com/q/27359112
upvote count: 27
has comment: http://stackoverflow.com/comment/43385207
has answer: http://stackoverflow.com/a/27359178
has comment: http://stackoverflow.com/comment/43472408
downvote count: 0
has title: How to design an execution engine for a sequence of tasks
has answer: http://stackoverflow.com/a/39934245
has answer: http://stackoverflow.com/a/27486550
favorite count: 0
has answer: http://stackoverflow.com/a/27500765
has answer: http://stackoverflow.com/a/27589027
has answer: http://stackoverflow.com/a/27560077
linked to: http://stackoverflow.com/q/63354899
answer count: 10
has answer: http://stackoverflow.com/a/27479820
has comment: http://stackoverflow.com/comment/43385227
has comment: http://stackoverflow.com/comment/43379102
score: 27
has answer: http://stackoverflow.com/a/27470100
has comment: http://stackoverflow.com/comment/43381387
has comment: http://stackoverflow.com/comment/43391421
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/27479587
has body: I am trying to code a problem in Java where I have to execute a bunch of tasks. Problem Execute a job which consists of multiple tasks and those tasks have dependencies among them. A job will have a list of tasks and each such task will further have a list of successor tasks (Each successor task will have its own successor tasks - you can see the recursive nature here). Each successor task can start its execution if - It is configured to be executed on partial execution of its predecessor task. In this case, predecessor task will notify that it has completed partially and my successor tasks can start Successful completion of its predecessor task. Example Job having 2 initial tasks A and B. A has 2 successor tasks M and N. B has 1 successor task P. P has 2 successor tasks Y and Z. M can start on partial completion of its predecessor task A. Z can start on partial completion of its predecessor task P. N, P and Y can start only on completion of their predecessor tasks A, B and P respectively. I have to design the execution of such a workflow/job. In the design we have to acknowledge the partial completion event sent by a predecessor task so that its successor task can be started. How should I go about it? Is there any design pattern which suits this problem in concurrency?
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/27582729
tagged with: concurrency
has comment: http://stackoverflow.com/comment/119218026

http://stackoverflow.com/a/27381683
upvote count: 2
type: AcceptedAnswer
has body: This is because you have included VM option path in netbeans. and Netbeans Automatically calls it whenever it is executed. now when you are trying to run command. i.e. java -jar WebCam.jar there is not path defined in command, thatsy you are getting that error.. try this command: java -Djava.library.path="C:\OpenCV\opencv\build\java\x86" -jar WebCam.jar hope this will help you.!
accepted answer of: http://stackoverflow.com/q/27346312
answers question: http://stackoverflow.com/q/27346312
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/43122290
has text: http://stackoverflow.com/questions/22534356/java-awt-eventqueue-invokelater-explained might be of use
score: 1
type: Comment
comment on: http://stackoverflow.com/q/27332347
type: QuestionComment

http://stackoverflow.com/a/27335509
score: 0
answers question: http://stackoverflow.com/q/27335451
type: Answer
has body: Your finally block in executeQuery closes your statement before you've iterated over the results.

http://stackoverflow.com/comment/43377221
has text: Create a collection of `Person`. Loop.
score: 1
comment on: http://stackoverflow.com/q/27471236
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43263989
score: 0
type: Comment
type: AnswerComment
has text: @JimmyT. According to the [documentation for `RandomAccess`](http://docs.oracle.com/javase/8/docs/api/java/util/RandomAccess.html), "a List implementation should implement this interface if, for typical instances of the class, this loop: `for (int i=0, n=list.size(); i < n; i++) list.get(i);` **runs faster than this loop:** `for (Iterator i=list.iterator(); i.hasNext(); ) i.next();`" (emphasis mine).
comment on: http://stackoverflow.com/a/27409410

http://stackoverflow.com/q/27451338
tagged with: android
has body: I'm trying to solve a problem, how to store Public Transport data efficiently for obtaining and representing it in Android. The simplified use of my class is this: user select the bus number using spinner, then he selects the stop at specified street (also using spinner). And after that he clicks the submit button and the timetable of the bus at specified street shows up in the fragment below the submit button. The main question is: what's the best structure to store Public Transport data? Three dimensional array, HashMap, Map or something else? You can find a live example here: http://marijampolietis.balsas.lt/miesto-autobusu-tvarkarastis/ P.S. Right now, I'm storing both spinners data in strings.xml array
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43341549
has answer: http://stackoverflow.com/a/27451543
tagged with: java
has comment: http://stackoverflow.com/comment/43341325
has title: What's the best structure to store Public Transport data?
type: Question
has comment: http://stackoverflow.com/comment/43341757
answer count: 1
linked to: http://stackoverflow.com/q/13413030
score: 0

philips-hue
tag name: philips-hue
type: Tag
tags question: http://stackoverflow.com/q/27430964

http://stackoverflow.com/comment/62184115
score: 4
has text: To add value, I found the `FileUtils.contentEqualsIgnoreEOL` may offer convenience for less stringent assertions.
type: Comment
comment on: http://stackoverflow.com/a/27379155
type: AnswerComment

http://stackoverflow.com/comment/43391927
type: Comment
comment on: http://stackoverflow.com/a/27446015
type: AnswerComment
has text: Sorry, I'm using version 1.2.
score: 0

http://stackoverflow.com/a/27474540
type: AcceptedAnswer
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/43383606
accepted answer of: http://stackoverflow.com/q/27474505
answers question: http://stackoverflow.com/q/27474505
has body: You can construct a new BeanTitle object, set the field with the setter, and then add it to your list, like this: BeanTitle b = new BeanTitle(); b.setBtitle("Jeff"); bt.add(b);
score: 0
upvote count: 1

http://stackoverflow.com/comment/43149437
has text: My expression is definitely wrong... I tried the vaild syntax and now the program runs but it does not change the color of the 3x3 block in the middle.
score: 0
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27347277

http://stackoverflow.com/q/27377542
has body: I have lots of quests about Java NIO. I have read many articles where the discussion was digged deeper about it. But I really don't know in which aspects the NIO is quicker than IO. Also I have observed that downloading a 100MB file with Java NIO code is at least 10 times faster than downloading with Java IO code. Now my question regarding the fact is: Suppose I am downloading a file is 1KB. In this case, will NIO code still be ten times faster for a 1KB file?
has answer: http://stackoverflow.com/a/27377694
tagged with: nio
has title: Why the NIO code is faster than that of Java IO?
score: 0
has comment: http://stackoverflow.com/comment/43204667
answer count: 1
tagged with: io
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27377694
type: Question

http://stackoverflow.com/q/27359845
type: Question
score: 0
answer count: 1
tagged with: junit
tagged with: build.gradle
type: UnansweredQuestion
has title: How to setup a build in Gradle to not deploy JUnit test cases to JBoss AS 7.1
has answer: http://stackoverflow.com/a/27360627
has body: I have a very very simple JSF2 application that simply shows a hello world page. The matter is that this application has a JUnit test case. When a build the war file to deploy it in JBoss AS 7.1, the test class goes with it, causing some problems to load the application. The build.gradle file is below apply plugin: 'java' apply plugin: 'eclipse-wtp' apply plugin: 'application' apply plugin: 'war' sourceCompatibility = 1.7 targetCompatibility = 1.7 tasks.withType(JavaCompile) { options.encoding = "UTF-8" } // Needed in order to make the test running to work sourceSets.main.output.resourcesDir = sourceSets.main.output.classesDir sourceSets.test.output.classesDir = sourceSets.main.output.classesDir sourceSets.test.output.resourcesDir = sourceSets.test.output.classesDir def hibernateVersion = "4.3.7.Final" def weldVersion = "1.1.27.Final" def unidadesVersion = "1.0.0" def demoiselleVersion = "2.4.1" def arquillianVersion = "1.1.5.Final" repositories { mavenLocal() mavenCentral() } dependencies { runtime 'javax.servlet:javax.servlet-api:3.1.0' runtime 'javax.enterprise:cdi-api:1.0-SP1' runtime 'org.jboss:jandex:1.2.2.Final' testCompile 'junit:junit:4.11' testCompile 'org.jboss.arquillian.junit:arquillian-junit-container:'+arquillianVersion testCompile 'br.gov.frameworkdemoiselle.component:demoiselle-junit:2.3.1' } eclipse { wtp { facet { facet name: "java", version: "1.7" // Java version facet name: "jst.web", version: "3.0" // Dynamic Web Application facet name: "jst.jsf", version: "2.2" // Java Server Faces facet name: "wst.jsdt.web", version: "1.0" // JavaScript } } } task wrapper(type: Wrapper) { gradleVersion = '2.2.1' } In my tests I perform some dependency injection, that's why I have Weld and Jandex included in the test dependencies. I expected that, because the test cases are localed in src/test/java, they would not be included in war file, but it seems I´m wrong about that! What am i missing? How to exclude those files from the war? Update 1 After acting like P…
tagged with: java
tagged with: jboss
tagged with: gradle

http://stackoverflow.com/q/27375231
tagged with: android
has title: Is it proper to do the initialization in the constructor of an activity?
has answer: http://stackoverflow.com/a/27375332
type: AnsweredQuestion
tagged with: oncreate
tagged with: java
has body: I am curious about what can I do in the constructor of an activity. Is it ok to do the initialization in the constructor? Thanks.
has answer: http://stackoverflow.com/a/27375354
accepted answer: http://stackoverflow.com/a/27375354
type: Question
score: -2
possible better answer: http://stackoverflow.com/a/27375332
answer count: 2
downvote count: 3
upvote count: 1
tagged with: android-activity
favorite count: 0
tagged with: constructor

http://stackoverflow.com/comment/99939979
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27419093
has text: My issue is still present. I'm getting null object reference even with this solution.

http://stackoverflow.com/comment/43175873
type: QuestionComment
has text: Letting XStream talk direct to the binary stream also avoids any issues with character encodings (the `PrintWriter` constructor taking a `File` _always_ uses the platform default encoding, whereas the `StaxDriver` will write XML that a subsequent parser treats as UTF-8).
score: 0
comment on: http://stackoverflow.com/q/27361618
type: Comment

http://stackoverflow.com/q/27345055
has comment: http://stackoverflow.com/comment/43145470
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43145541
tagged with: android
has comment: http://stackoverflow.com/comment/43145424
answer count: 0
upvote count: 2
tagged with: java
type: Question
has title: Java: java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.ArrayList
has comment: http://stackoverflow.com/comment/43145593
has comment: http://stackoverflow.com/comment/43145525
score: 2
downvote count: 0
has body: I'm writing a client for vk.com and got an error. Im using fragments and i think it caused by fragments. Process: ru.dennes544.vkapp, PID: 9357 java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.ArrayList com.perm.kate.api.Api.getProfiles(java.util.Collection, java.util.Collection, java.lang.String, java.lang.String, java.lang.String, java.lang.String)' on a null object reference at ru.dennes544.vkapp.Profile$1.run(Profile.java:89) few lines of code: private void loadAccInfo(){ new Thread(){ @Override public void run(){ Collection uid = new ArrayList(); try { uid.add(account.user_id); profiles = api.getProfiles(uid, null, "sex", "Nom", null, null).get(0); } catch (IOException e) { e.printStackTrace(); } catch (JSONException e) { e.printStackTrace(); } catch (KException e) { e.printStackTrace(); } and declaration of getProfiles: public ArrayList&lt;User&gt; getProfiles(Collection&lt;Long&gt; uids, Collection&lt;String&gt; domains, String fields, String name_case, String captcha_key, String captcha_sid) throws IOException, JSONException, KException{ if (uids == null &amp;&amp; domains == null) return null; if ((uids != null &amp;&amp; uids.size() == 0) || (domains != null &amp;&amp; domains.size() == 0)) return null; Params params = new Params("users.get"); if (uids != null &amp;&amp; uids.size() &gt; 0) params.put("user_ids",arrayToString(uids)); if (domains != null &amp;&amp; domains.size() &gt; 0) params.put("user_ids",arrayToString(domains)); params.put("fields",fields); params.put("name_case",name_case); addCaptchaParams(captcha_key, captcha_sid, params); JSONObject root = sendRequest(params); JSONArray array=root.optJSONArray("response"); return User.parseUsers(array); }
has comment: http://stackoverflow.com/comment/43145478
has comment: http://stackoverflow.com/comment/43145571
favorite count: 0

http://stackoverflow.com/comment/43196708
has text: How to ensure threads have been all terminated succesully, Can it be done using thread id's?
comment on: http://stackoverflow.com/q/27372562
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43305994
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27432320
score: 0
has text: I think it's safe to say that the ones you encounter that do not submit a CRLF are the ones that allow it to be configured.

http://stackoverflow.com/comment/43105181
score: 0
type: QuestionComment
has text: "tipus" mark selection... it's like yellow and it doesn't let me read me properly.
type: Comment
comment on: http://stackoverflow.com/q/27321945

http://stackoverflow.com/comment/43101493
has text: [Link to another similar question/answer](http://stackoverflow.com/a/19552923/522444).
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27320827

http://stackoverflow.com/q/27365794
answer count: 1
has comment: http://stackoverflow.com/comment/43183606
upvote count: 1
accepted answer: http://stackoverflow.com/a/27365938
tagged with: jcombobox
favorite count: 0
has title: Dividing by four in combobox
has answer: http://stackoverflow.com/a/27365938
has body: I'm a new programmer doing a date of birth selector for part of my project. I have got everything set up apart from a few things and I am unsure of how to do these things. ArrayList&lt;String&gt; years_tmp = new ArrayList&lt;String&gt;(); years_tmp.add("Year"); for(int years = Calendar.getInstance().get(Calendar.YEAR) ; years&gt;=Calendar.getInstance().get(Calendar.YEAR)-90;years--) { years_tmp.add(years+""); } Y = new JComboBox(years_tmp.toArray()); Above is my part of my code for a JComboBox which lists the previous 90 years and has the word "Years" as the first object. For my code above how would I list the years like it currently does, but to only display years which divide by four exactly (leap years)? Also how do I make it so once the JComboBox list has been opened the selection years can not be selected so when the value is saved in my save file it does not allow the save of the word "Years"?
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
type: Question

http://stackoverflow.com/a/27366795
downvote count: 0
score: 1
has body: I think to reach your desired behavior you need to do a little bit more than just set a url to your editor pane and have a browser with progress bars etc.. Coding a brwoser is a painful and complicate work and JEditorPane only covers a little of all possibilities. However, to cover your needs I think you need to get the content of the page you try to display by your own (using Sockets or httpclient or any other lib). While you receive the bytes from the server you can update the progressbar. After you've received all the bytes you set the content in one step to the pane which should display the content. Edit: Using Sockets you need to do the following (note that this is quick and dirty an without any kind of error handling): // Suppose you want to display http://www.target.com/page Socket s = new Socket("target.com", 80); PrintWriter out = new PrintWriter(s.getOutputStream()); // Tell the server you want to get "/page" out.println("GET /page HTTP/1.1"); out.println("Host: target.com"); out.println(); // The target-Server now send you the content of "/page" // Now you need to know a little about the HTTP-Protocol. // In short: The server sends you a header and a body. // The header and the body is separated using two newlines. // You need to read line by line from the server until the // body starts and interpret the stuff from the header because it // contains the information how many bytes you will receive with the body // ( -&gt; Content-Length: xyz) BufferedReader in = new BufferedReader(new InputStreamReader(s.getInputStream())); // Read the Header and interpret that stuff. doReadHeader(in); // Now, because of the Content-Length Header you know how many bytes you need to read // from the InputStream until all the bytes are receive. Thus you can update your // progressbar while receiving the bytes doReadBody(in); That pretty much is it. After you received all that, you can set the body 1:1 into your EditorPane. But beware the EditorPane just covers little of HTML…
upvote count: 1
has comment: http://stackoverflow.com/comment/43196729
type: Answer
answers question: http://stackoverflow.com/q/27366566

http://stackoverflow.com/comment/43350892
has text: thanks... this worked but now I am facing one more problem. In my web application ..at the time of logout I invalidate the session through session.invalidate()..Now the problem is that when I open web pages of my application in multiple tabs,then when I click logout in one tab..it perfectly logs out but after that when I switch to other tab which was already opened and I refresh that page then again session is created without login.Please help me.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27401839

http://stackoverflow.com/comment/44676653
comment on: http://stackoverflow.com/q/27445163
type: Comment
type: QuestionComment
has text: I tried upload photo by CURL: `curl "https://apps.na.collabserv.com/profiles/photo.do?key=...&lastMod=..." -o log.out -v -k -u user@mail.com:password -X PUT -H "Content-Type: image/jpg" -T 1.jpg` It returns: `The type of the photo file you provided is not supported`. I'm really confused (this file could be successfully uploaded in SC web interface). What I'm doing wrong?
score: 0

http://stackoverflow.com/q/27413840
has title: Using a Data Structure for Rock, Paper, Scissors
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27414069
tagged with: java
has comment: http://stackoverflow.com/comment/43271806
score: -1
upvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/27414069
has body: Due to time constraints when it came to coming up with an idea for an assignment, I decided to choose rock, paper, scissors. I have to implement a rock, paper, scissors program in Java using either queues, stacks, heaps, trees, graphs, or search trees. What do you think would be the best method for this situation? I am leaning towards using queues but I would like to hear some input.
favorite count: 0
has comment: http://stackoverflow.com/comment/43271807
has comment: http://stackoverflow.com/comment/43271869
has comment: http://stackoverflow.com/comment/43271859
has comment: http://stackoverflow.com/comment/43271984
type: AnsweredQuestion

http://stackoverflow.com/comment/43188482
type: Comment
has text: @Luis: There are plenty of JSON reading and writing APIs available, in Android (e.g., `org.json`) and third-party (e.g., GSON, Jackson). Use one to convert your model data to and from JSON.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27367766

http://stackoverflow.com/q/27464073
tagged with: android
has title: RecyclerView takes up all screenspace
possible better answer: http://stackoverflow.com/a/33849954
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/33849954
upvote count: 3
answer count: 2
accepted answer: http://stackoverflow.com/a/27464384
tagged with: android-recyclerview
has comment: http://stackoverflow.com/comment/43364331
tagged with: android-layout
has body: So I'm having some trouble with a RecyclerView in a layout file Here it is: &lt;android.support.v7.widget.RecyclerView android:id="@+id/chat_listview" android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingRight="@dimen/abc_action_bar_default_padding_material" android:paddingLeft="@dimen/abc_action_bar_default_padding_material" /&gt; &lt;LinearLayout android:layout_below="@id/chat_listview" android:layout_width="match_parent" android:layout_height="@dimen/bottom_bar_height" android:orientation="horizontal" &gt; &lt;EditText android:id="@+id/chat_input_edittext" android:layout_weight="7" android:layout_width="0dp" android:layout_height="match_parent" android:inputType="textAutoCorrect" /&gt; &lt;Button android:id="@+id/chat_send_button" android:layout_weight="1" android:layout_width="0dp" android:layout_height="match_parent" android:background="@drawable/ic_action_send_now" /&gt; &lt;/LinearLayout&gt; The RecyclerView is visible and scrollable but the LinearLayout and the Views inside are not visible... I tried quite a few things but nothing has worked so far. Can any of you please point me into the right direction? Many thanks in advance!
tagged with: java
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/27464384
favorite count: 0
type: Question
score: 3

spring-data-neo4j
tags question: http://stackoverflow.com/q/27334225
type: Tag
tags question: http://stackoverflow.com/q/27435958
tag name: spring-data-neo4j
tags question: http://stackoverflow.com/q/27331116
tags question: http://stackoverflow.com/q/27341342

http://stackoverflow.com/q/27363537
has title: How do I store spring security users in a hibernate database?
tagged with: java
upvote count: 1
type: Question
answer count: 1
downvote count: 0
tagged with: spring-security
favorite count: 0
has answer: http://stackoverflow.com/a/27382191
has body: I have spring security setup with https://github.com/davidahines/spacechip/tree/spring_security Right now it looks at the user in the xml file, this is not optimal, I want to look in my database for the user. How do I do that? Here is my security.xml file: https://github.com/davidahines/spacechip/blob/spring_security/src/main/webapp/WEB-INF/security.xml I think maybe what I need to do is make a hibernate bean for users? Do I need to make one for roles as well? How do I tell it to look at my hibernate connection instead of the xml file? I am basically looking to do something like this: http://www.studytrails.com/frameworks/spring/spring-security-using-db.jsp But with hibernate.
type: UnansweredQuestion
score: 1

http://stackoverflow.com/a/27466173
answers question: http://stackoverflow.com/q/27466097
type: Answer
has body: You can use DateTime.strptime require 'date' puts DateTime.strptime('Tue May 31 17:46:55 +0800 2011', "%a %b %d %H:%M:%S %z %Y")
score: 0

http://stackoverflow.com/a/27427494
has body: firstly check mobile or tab has soft buttons if has then make full screen by programaticaly after that create custum button bar like tab bar at bottom and put buttons as you like thats better if u dont have any other idea getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
answers question: http://stackoverflow.com/q/27427056
has comment: http://stackoverflow.com/comment/43298600
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/43296556
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43298512

http://stackoverflow.com/a/27465104
has body: Method return value needs to be double to save floating numbers double avgSal(List&lt;Bank&gt; list) { double Avg = 0; for(int i=0;i&lt;list.size();i++) { Avg += list.get(i).getSalery(); } return Avg/list.size(); }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27465071

http://stackoverflow.com/comment/43206593
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27378618
has text: What about storing the clicked cell somewhere and accessing the property in the catch part?
score: 3

http://stackoverflow.com/a/27417970
downvote count: 0
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43279499
has body: For your condition to be true, a must be true, and in addition, at least one of the conditions on b or c must be true. Therefore, if a==true and c==254, you will get false, since c is not within any of the ranges you allow, and, as you said, b is not available (which I'm assuming means it doesn't have one of the 3 values you allow).
has comment: http://stackoverflow.com/comment/43279475
score: 1
answers question: http://stackoverflow.com/q/27417931

http://stackoverflow.com/comment/43303437
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27427499
has text: Does your project use any plug-ins like the Extension Library? If so, then you have to copy the files from the features directory of the plug-in to the features directory in C:\notes\data\domino\workspace\applications\eclipse (change C:\notes\data for your system). Do the same for the plugins directory.

http://stackoverflow.com/comment/43306923
has text: @berak, any suggestions on work around?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27432256

http://stackoverflow.com/comment/43124607
type: Comment
comment on: http://stackoverflow.com/a/27333617
type: AnswerComment
score: 0
has text: You're right about the algorithm, and I took care of it. I also added the parent-property to the BinaryNode class. Thanks alot !

checked-exceptions
tags question: http://stackoverflow.com/q/27473519
tag name: checked-exceptions
type: Tag

http://stackoverflow.com/comment/70565827
has text: Possible duplicate of [OpenCV Constants.CaptureProperty](http://stackoverflow.com/questions/21066875/opencv-constants-captureproperty)
type: QuestionComment
comment on: http://stackoverflow.com/q/27375514
type: Comment
score: 0

windows-server-2008-r2
tag name: windows-server-2008-r2
tags question: http://stackoverflow.com/q/27452344
type: Tag

http://stackoverflow.com/comment/43344366
type: Comment
has text: Thanks, but it doesn't help. I want a BiMap for ease of use, but it needs to be mutable. If I maintain a different collection type (or types, e.g. two maps) then I don't need a BiMap at all.
comment on: http://stackoverflow.com/a/27452757
score: 1
type: AnswerComment

http://stackoverflow.com/a/27354390
upvote count: 1
has comment: http://stackoverflow.com/comment/43163654
downvote count: 0
type: Answer
has body: As a quickfix, this works : try { File inputFileNAme = new File("d:/Secret.file"); FileInputStream fileInputStream = new FileInputStream(inputFileNAme); FileOutputStream fileOutputStream = new FileOutputStream(outputFilePath); SecretKey secretKey = getKey(keyString); Cipher cipher = Cipher.getInstance(algorithm); cipher.init(Cipher.DECRYPT_MODE, secretKey); ObjectInputStream objectInputStream = new ObjectInputStream (new CipherInputStream(fileInputStream, cipher)); System.out.println(objectInputStream.available()); fileOutputStream.write((byte[]) objectInputStream.readObject()); fileOutputStream.flush(); fileOutputStream.close(); fileInputStream.close(); objectInputStream.close(); } catch (Exception e) { e.printStackTrace(); } What I did is remove the ".available() while loop" and remove the cast to Integer that was wrong. I agree with EJP answer, especially regarding the use of .available(). You may also use http://www.jasypt.org/ that provides a more simple API to crytpo stuff.
has comment: http://stackoverflow.com/comment/43161950
score: 1
answers question: http://stackoverflow.com/q/27353260

http://stackoverflow.com/a/27447980
score: 1
has body: Change the version of java compiler to Java 1.7 Window -> Preferences -> Compiler Restart Eclipse It works for me :)
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27369772
type: Answer

http://stackoverflow.com/comment/43184255
comment on: http://stackoverflow.com/q/27361482
has text: Code and error messages that form part of a question must be included in the question itself. Otherwise it has no permanent value here.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43310282
comment on: http://stackoverflow.com/q/27434176
type: Comment
type: QuestionComment
has text: @SemihEker thanks, I already did. That's a different problem. I think in that one they're running a server. I'm not, I'm just trying to grab html from a website.
score: 0

http://stackoverflow.com/q/27398295
has title: Which wait is more preferred in selenium Webdriver using Java? (Implicit or Explicit)
favorite count: 0
has answer: http://stackoverflow.com/a/27400270
tagged with: selenium-webdriver
type: AnsweredQuestion
upvote count: 2
score: 1
has answer: http://stackoverflow.com/a/70430611
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/70430611
has body: I am aware of the differences between them and how they actually behaves during execution. My Question is which one is more preferred in Automation using Selenium? I am using Selenium Webdriver with Java and Automating my Test-cases in TestNG framework.For some Browser the test fails because Webelement is not clickable so i doubt I have re-implement the wait time for such Web-elements. Please suggest me some alternative.
tagged with: java
accepted answer: http://stackoverflow.com/a/27400270
answer count: 2
tagged with: wait

http://stackoverflow.com/a/27371146
downvote count: 2
type: Answer
has body: Do you mean the compare really string-to-string or content-to-content? if you are comparing string-to-string, you should use int difference=aStr.compareTo(bStr); if your are comparing content-to-content, you should use GSON to convert the JSON into a POJO and implement the equalsTo method in that POJO. e.g.: public class City implements Comparable&lt;City&gt;{ public String name; public int population; public int compareTo(City b){ return name.compareTo(b.name)+population-b.population; } } Gson g=new Gson(); City a=g.fromJson(jsonA, City.class); City b=g.fromJson(jsonB, City.class); int difference=a.compareTo(b);
upvote count: 0
score: -2
answers question: http://stackoverflow.com/q/27371134

http://stackoverflow.com/q/27360106
tagged with: android
has answer: http://stackoverflow.com/a/27361588
type: UnansweredQuestion
tagged with: java
type: Question
has title: Implement Stop click of MediaStore Intent on video capture
answer count: 1
has body: How can I trigger a method when I click on Stop button while recording video in MediaStore. Intent takeVideoIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE); startActivityForResult(takeVideoIntent, VIDEO_CAPTURE); I am starting the capture video with this code. I just don't know is it posible to implement the Stop button and in the implementation to close the MediaStore and start an Activity. Here is the Stop Button :-P Cheers mates
score: 0

http://stackoverflow.com/comment/43093858
type: QuestionComment
has text: I just realized that this only happens when I call showDialog(), not when I use showOpenDialog(). I would still like to know how I can resolve the path as described above.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27315720

http://stackoverflow.com/q/27458227
tagged with: android-studio
has title: org.apache.commons.collections.ArrayStack has already been added to output. Please remove duplicate copies
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/27078075
answer count: 2
has answer: http://stackoverflow.com/a/27458263
downvote count: 0
favorite count: 0
tagged with: android
has body: I am still using Android Studio 0.8.9 on my Macbook Air. On my iMac i installed Android Studio 1.0. As 1.0 only supports 'com.android.tools.build:gradle:1.0.0' i had to change my build.gradles as mentioned here. Gradle DSL method not found: 'runProguard' 0.8.9 uses 'com.android.tools.build:gradle:0.12.2' apply plugin: 'com.android.application' android { compileSdkVersion 20 buildToolsVersion "20.0.0" defaultConfig { applicationId "com.example...." minSdkVersion 19 targetSdkVersion 20 versionCode 1 versionName "0.87" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } packagingOptions { exclude 'META-INF/LICENSE.txt' exclude 'LICENSE.txt' exclude 'META-INF/NOTICE.txt' } dexOptions { preDexLibraries = false } } repositories { mavenCentral() flatDir { dirs 'libs' } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) wearApp project(':wear') compile 'com.android.support:support-v4:20.0.+' compile 'com.google.android.gms:play-services-wearable:+' compile 'com.spotify.sdk:spotifysdk:1.0.0-beta6@aar' compile('se.michaelthelin.spotify:spotify-web-api-java:1.4.20') } With the 0.8.9 beta on my MacBook Air my App builds fine. On my iMac i get this error. org.apache.commons.collections.ArrayStack has already been added to output. Please remove duplicate copies. UPDATE The problems seems to be that commons-collections is added to the external libraries and commons-beanutils which also includes a commons-collections. compile('se.michaelthelin.spotify:spotify-web-api-java:1.4.20') { exclude group: "commons-beanutils", module: "commons-beanutils" } if i exclude the commons-beanutils the build process is fine, but the app crashes, as it needs the commons-beanutils. same if i exclude the commons-collections. furthermore i tried to manually remove the folder common-collections from the commons-beanutils jar, but this also does not work..
has answer: http://stackoverflow.com/a/27464289

http://stackoverflow.com/comment/43171998
type: AnswerComment
has text: The element is already visible,the property @master Slave is concerned about is just a style property **style="display: none;**.also it works fine manually.I even tried to make the button enable explicitly, but that didn't help.
comment on: http://stackoverflow.com/a/27359383
type: Comment
score: 0

http://stackoverflow.com/a/27385082
has comment: http://stackoverflow.com/comment/43254232
has comment: http://stackoverflow.com/comment/43251766
downvote count: 1
has comment: http://stackoverflow.com/comment/43254521
answers question: http://stackoverflow.com/q/27371151
has body: With my limited understanding on image processing, I feel the approach ( especially haar classifiers ) in the accepted answer might not be the best option you have. Read up on following Optical flow based processing - That will help you identify motion. Background subtraction - Ground color is usually green and player clothes also have color. Contours - They let you identify shapes. Hough Line transform - There will be lines in your video stream. Edge detection I assume one of intentions of doing this project is to learn image processing and just not to get the result. Training a haar xml for identifying a batsman/bowler with +ve/-ve image samples is more like repetitive job than a real learning process. More over, you will need to spend lots of time collecting samples, and then retraining xmls on failure etc. Also, haar classifiers are for object detection are not for motion detection as mentioned in question. Aishack website has some references projects with image processing ideas. Wait for more responses to this question from experts.
type: Answer
score: 2
upvote count: 3

http://stackoverflow.com/q/27394900
score: 1
tagged with: java
upvote count: 1
type: Question
has body: I am trying to connect a LDAP server modelled as IPv6 adress, but getting NumberFormatException. Below is my Code: environment.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory"); environment.put(Context.PROVIDER_URL, "ldap://" + "[2001:1b70:4294:ff0f:0000:0000:0000:0104]" + ":" + "7423"); try { ldapContext = new InitialDirContext(environment); } catch (NamingException e) { } Your help is much appriciated.
tagged with: ipv6
has comment: http://stackoverflow.com/comment/43236881
tagged with: ldap
has title: NumberFormatException when connecting LDAP server with IPv6
has comment: http://stackoverflow.com/comment/43236556
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43236827
answer count: 0

http://stackoverflow.com/comment/43110496
type: AnswerComment
comment on: http://stackoverflow.com/a/27325105
type: Comment
score: 0
has text: containsKey(word), not contains(word)

http://stackoverflow.com/comment/43265993
has text: I'm afraid, you're asking exactly what [I did here](http://stackoverflow.com/q/11445822/581205) and the answer is "impossible".
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27407697
score: 2

http://stackoverflow.com/comment/43516133
has text: if there is no solution then is there is any other charts like morris are availabe to put above json data on bar chart?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27455597

http://stackoverflow.com/q/27421988
tagged with: mysql
type: Question
upvote count: 4
has comment: http://stackoverflow.com/comment/43286307
answer count: 2
downvote count: 0
score: 4
linked to: http://stackoverflow.com/q/5106474
accepted answer: http://stackoverflow.com/a/27422287
tagged with: sql
has title: query to check the timestamp
has answer: http://stackoverflow.com/a/27422079
has body: In my java project I want to list the values of a table programtable. There are four fields programid, programname, startdate and enddate in table. I want to list the details of programs done in today. The startdate and enddate are in database datatype as TIMESTAMP. Help me to find the query to get the details of programs done on today. I add my code to this. I use this method. But its not work, String todayDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); todayDatem=todayDate+" 00:00:00"; todayDaten=todayDate+" 23:59:59"; Timestamp timestamp1 = Timestamp.valueOf(todayDatem); Timestamp timestamp2 = Timestamp.valueOf(todayDaten); System.out.println("timestamp1:"+timestamp1+timestamp2); String sql3 = "select * form programtable where startdate between '”+timestamp1+”' and '”+timestamp2+”'"; JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource); List&lt;programmodel&gt; pgm = jdbcTemplate.query(sql3, ParameterizedBeanPropertyRowMapper.newInstance(programmodel .class));
favorite count: 0
possible better answer: http://stackoverflow.com/a/27422079
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43286298
tagged with: java
has answer: http://stackoverflow.com/a/27422287

http://stackoverflow.com/a/27346580
type: Answer
score: 2
upvote count: 2
has body: You tried to use an array as if it was a value it holds. I suggest you to read about arrays before tackling that assingment, the Oracle tutorial is a good place to start. After understanding arrays properly, you will learn that you need to specify and index to access the array values, like phone[0] (this will get the first value on the phone array). That assignment asks you to basically iterate through the array and apply the formula to each element.
downvote count: 0
answers question: http://stackoverflow.com/q/27346418

http://stackoverflow.com/q/27458177
has answer: http://stackoverflow.com/a/33388343
tagged with: java
tagged with: swt
has title: SWT dependency artifact missing?
type: Question
has body: I want to use swt in my project and used this page as a starting point: https://code.google.com/p/swt-repo/ I added the repository and dependency but my pom.xml has an error saying: Missing artifact org.eclipse.swt:org.eclipse.swt.win32.win32.x86:jar:4.4 What could be the problem? My whole pom.xml: 4.0.0 group artifact 0.0.1-SNAPSHOT jar artifact http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> org.eclipse.swt org.eclipse.swt.win32.win32.x86 4.4 swt-repo https://swt-repo.googlecode.com/svn/repo/
tagged with: eclipse
downvote count: 0
answer count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: maven
score: 2
upvote count: 2

http://stackoverflow.com/a/27411571
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: The problem is that you don't have a function addVertex(String). Your function is addVertex(Vertex), so you need to create a new Vertex object and add that to the Graph. The key is that a vertex requires both a name and data. Sample Code: DirectedGraph&lt;String&gt; directedGraph = new DirectedGraph&lt;String&gt;(); // Create a vertex object with both a name and data Vertex&lt;String&gt; sampleVertex = new Vertex&lt;String&gt;("name", "data"): directedGraph.addVertex(sampleVertex); If this still doesn't solve your problem, please post an example that includes the Edge class and the main method that is attempting to call addVertex().
answers question: http://stackoverflow.com/q/27403574
has comment: http://stackoverflow.com/comment/43269551
has comment: http://stackoverflow.com/comment/43272515

http://stackoverflow.com/a/27477320
has comment: http://stackoverflow.com/comment/43606115
score: 1
has body: This is an excellent question and a very popular feature request from our customers. As of today, there is no AWS API to validate an AWS Access Key / Secret Key based signatures for your custom web services. However, everything AWS does is based on customer feedback and your feedback helps to setup our development priorities. We are hearing that requirement a lot.
answers question: http://stackoverflow.com/q/27472559
downvote count: 0
has comment: http://stackoverflow.com/comment/43649594
type: Answer
upvote count: 1

http://stackoverflow.com/comment/43161483
comment on: http://stackoverflow.com/a/27354178
score: 0
type: AnswerComment
has text: That all is known, we dont have an update for Note devices yet and my application is made for Note devices too, I checked about the bug in official Samsung forums but there is no response. Its bad how things have been kept and its a pain for the Developer.
type: Comment

http://stackoverflow.com/comment/43159621
has text: Thanks All, My need is save the key and values without duplication, and the objects which saved up-to 10 objects per method call, but the calling will be frequently 1 per second, so I want to use the way which consume less for memory.
score: 0
comment on: http://stackoverflow.com/q/27352760
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43232802
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27392714
has text: @HovercraftFullOfEels ok. just saying. i didnt even read the whole post -_-
score: 0

http://stackoverflow.com/comment/43233988
has text: @LMeyer - add thread dump
score: 0
comment on: http://stackoverflow.com/q/27373703
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27365863
score: 1
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/27365983
type: Question
linked to: http://stackoverflow.com/q/9857073
has body: I have a loop that can loop dozens of times for a debt payoff calculator. One of the many things this loop does is call a method called getSpecialPayment private double getSpecialPayment(long debt_id, int month) { int thisMonth = Calendar.getInstance().get(Calendar.MONTH) + 1; Calendar cal = Calendar.getInstance(); cal.set(Calendar.MONTH, month + thisMonth); SimpleDateFormat df = new SimpleDateFormat("MMM yyyy", Locale.ENGLISH); String sMonth = df.format(cal.getTime()); // Line 884 that fails below String check_for_special = "SELECT payment FROM special_payments WHERE id = " + debt_id + " and month = '" + sMonth + "' LIMIT 1;"; if (!database.isOpen()) { open(); } Cursor c = database.rawQuery(check_for_special, null); if (c.getCount() == 0) { c.close(); return 0; } else { c.moveToFirst(); double amount = c.getDouble(c.getColumnIndex("payment")); c.close(); return amount; } } I am getting this OutOfMemory stacktrace on the line that build the String (the query) check_for_special. java.lang.RuntimeException: An error occured while executing doInBackground() at android.os.AsyncTask$3.done(AsyncTask.java:300) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355) at java.util.concurrent.FutureTask.setException(FutureTask.java:222) at java.util.concurrent.FutureTask.run(FutureTask.java:242) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587) at java.lang.Thread.run(Thread.java:841) Caused by: java.lang.OutOfMemoryError at java.lang.AbstractStringBuilder.enlargeBuffer(AbstractStringBuilder.java:94) at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:145) at java.lang.StringBuilder.append(StringBuilder.java:216) at com.---.---.DebtDataSource.getSpecialPayment(DebtDataSource.java:884) at com.---.---.DebtDataSource.payoffDebt(DebtDataSource.java:469) at com.---.---…
answer count: 1
downvote count: 0
has title: Out of Memory Error Failing on String
favorite count: 0
has answer: http://stackoverflow.com/a/27365983
tagged with: out-of-memory
tagged with: android
type: AnsweredQuestion

http://stackoverflow.com/comment/43269606
has text: Can you maybe clarify your question? Do you want to have a button that toggles fullscreen behaviour or just maximize the stage or what?
type: QuestionComment
comment on: http://stackoverflow.com/q/27412530
score: 0
type: Comment

http://stackoverflow.com/a/27356753
answers question: http://stackoverflow.com/q/27351172
score: 0
has body: you should use next() instead of nextLine()
type: Answer

http://stackoverflow.com/a/27377516
type: Answer
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27373567
has body: You are comparing different value. I have to compare user entered id with database id Change your code while (rs.next()) { id = rs.getString("userid"); if (userid.equalsIgnoreCase(id)) { status = true; } else { status=false; } }
accepted answer of: http://stackoverflow.com/q/27373567

http://stackoverflow.com/a/27393675
has comment: http://stackoverflow.com/comment/43234619
has comment: http://stackoverflow.com/comment/43234991
has comment: http://stackoverflow.com/comment/43234587
has comment: http://stackoverflow.com/comment/43234819
has comment: http://stackoverflow.com/comment/43234710
has comment: http://stackoverflow.com/comment/43234856
upvote count: 0
has comment: http://stackoverflow.com/comment/43234872
has comment: http://stackoverflow.com/comment/43234554
has comment: http://stackoverflow.com/comment/43234516
type: Answer
answers question: http://stackoverflow.com/q/27393508
has body: Actually 2 objects. str1 and str2 hold object references. While str3, str4 and str5 do not hold string objects but are string literals. In your example,str1 and str2 point to different objects in the Java String Pool. These strings, if mutated, will still point to same memory locations where they pointed before getting mutated. Though these string object cannot be mutated directly by using the = operator, as strings in java are immutable, but stringbuffer objects can be made using the string object and then that string buffer object can be mutated with the help of methods in java.lang.StringBuffer class. But if str3, str4 and/or str5 are mutated, ie. if you do this somewhere later in the code: str3="narendra modi"; A new memory location will be reserved in the java heap and not the java string pool, with the string "narendra modi" stored in it and str3 will point to it. While str4 and str5 will still be pointing to location where the string "nitesh" is stored. Citation added: string buffers CAN be mutated... https://icl.googleusercontent.com/?lite_url=https://docs.oracle.com/javase/7/docs/api/java/lang/StringBuffer.html&amp;ei=25w3utEc&amp;lc=en-IN
has comment: http://stackoverflow.com/comment/43235010
downvote count: 2
has comment: http://stackoverflow.com/comment/43234595
has comment: http://stackoverflow.com/comment/43235075
has comment: http://stackoverflow.com/comment/43235147
has comment: http://stackoverflow.com/comment/43234623
has comment: http://stackoverflow.com/comment/43234892
score: -2

http://stackoverflow.com/q/27378951
has body: I have an Android Application project in Eclipse, and for nth time I have this annoying error. I create a new blank project which references android-support-v7-appcompat library. The JAR files of this library are located at android-support-v7-appcompat\libs. However Eclipse insists, that they are in android-support-v7-appcompat\bin, and the result is as follows: https://i.sstatic.net/Ho7qN.png What the hell is going on here? The support library is installed, there is nothing else that this project is referencing, all should be fine. Any ideas?
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/43210217
has comment: http://stackoverflow.com/comment/43207772
has answer: http://stackoverflow.com/a/27379158
tagged with: android
tagged with: dependencies
tagged with: buildpath
has title: Eclipse points to the wrong path in dependencies
accepted answer: http://stackoverflow.com/a/27379158
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27379069
tagged with: java
has answer: http://stackoverflow.com/a/27379069
tagged with: eclipse

http://stackoverflow.com/q/27318536
has title: Java interfaces, generic and not knowing what I'm doing
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43096637
downvote count: 1
type: Question
tagged with: compiler-warnings
score: -1
has body: (Disclaimer: I'm an long time programmer, only I'm not that used at Java.) Hi all. I've just finished adding a new functionality to my Android app, everything work quite well, but I'm not sure what I've done :-D and Eclipse give me 3 warnings. And I hate having unresolved warnings :-) The code, first: public interface IClass&lt;T&gt; { public ArrayList&lt;T&gt; getSomething(); [a few other public methods, not relying on T] } public class Class1 implements IClass&lt;String&gt;{ public ArrayList&lt;String&gt; getSomething(){ [code] } [the other public methods] } public class Class2 implements IClass&lt;long&gt;{ public ArrayList&lt;long&gt; getSomething(){ [code] } [the other public methods] } Then I've got a third class, call it ConsumerClass: declare a variable of type IClass, with an if on a specific condition instantiate it to new Class1() or new Class2(), in the rest of the code it works on it as a generic IClass where needed and, in the only one spot it calls getSomething(), does a cast. As I said, everything work as expected. "Problem" is that Eclipse gives me 3 warning and, not really being so good at Java, I'd like to understand them and if what I did is correct, because after all I coded the thing...well, by instinct. Warnings are: IClass is a raw type. References to generic type IClass should be parameterized Type safety: Unchecked cast from ArrayList to ArrayList Type safety: Unchecked cast from ArrayList to ArrayList First it's total darkness to me. Last two I can understand, only I don't know how to check the result of a call without doing it. I mean: ArrayList&lt;String&gt; res = (ArrayList&lt;String&gt;) IClass_Instance.getSomething(); How can I check the type of IClass_Instance.getSomething() without calling it? Thx all :-)
has comment: http://stackoverflow.com/comment/43096704
has comment: http://stackoverflow.com/comment/43098980
has comment: http://stackoverflow.com/comment/43096820
upvote count: 0
answer count: 1
tagged with: generics
favorite count: 0
type: UnansweredQuestion
tagged with: interface
has answer: http://stackoverflow.com/a/27319391
has comment: http://stackoverflow.com/comment/43096561

http://stackoverflow.com/a/27460905
type: Answer
has body: That would be a huge amount of overhead. There's no reason why each request needs its own service bean if you make your code properly thread-safe, which usually just means not keeping any per-request state on the bean.
has comment: http://stackoverflow.com/comment/43358237
downvote count: 0
score: 6
answers question: http://stackoverflow.com/q/27460872
upvote count: 6
has comment: http://stackoverflow.com/comment/43358416

http://stackoverflow.com/comment/43217521
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27384432
has text: Have you used setOnClickListener or onClick in xml? Can you put the full code?

http://stackoverflow.com/comment/43480177
comment on: http://stackoverflow.com/a/27452431
type: AnswerComment
has text: i returning to you because I tried different solutions and yours seems to be the one closer to solving my problem thank you for your help
score: 0
type: Comment

http://stackoverflow.com/a/27436026
downvote count: 1
has body: Is it possible that an exception may be occurring somewhere else in the code, maybe even in the underlying framework? The values appear to be the same as they where when you checked them at the if section, since they've not changed, I suspect there may be a buried exception, that your not seeing, that's getting handled/cleared by the underlying framework.
score: -1
upvote count: 0
answers question: http://stackoverflow.com/q/27435313
type: Answer
has comment: http://stackoverflow.com/comment/43312986
has comment: http://stackoverflow.com/comment/43313905

http://stackoverflow.com/comment/43229803
type: QuestionComment
comment on: http://stackoverflow.com/q/27377971
score: 0
has text: Please learn common Java nomenclature (naming conventions - e.g. `EachWordUpperCaseClass`, `firstWordLowerCaseMethod()`, `firstWordLowerCaseAttribute` unless it is a `CONSTANT`) and use it consistently.
type: Comment

http://stackoverflow.com/comment/43274343
type: Comment
type: QuestionComment
has text: Is the line `work = new Thread(w);` actually running? Maybe you should log that `MalformedURLException`, just so that you know it's happened.
comment on: http://stackoverflow.com/q/27415122
score: 1

http://stackoverflow.com/a/27453000
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27452966
type: Answer
has body: Do (crit.nextInt(100)) and then use an if to check if the random is 50, for example.
downvote count: 0

http://stackoverflow.com/comment/43540229
comment on: http://stackoverflow.com/a/27475673
type: AnswerComment
score: 0
type: Comment
has text: You must have removed the no-args constructor `ItemRecord()`.

xml-namespaces
tags question: http://stackoverflow.com/q/27373807
tags question: http://stackoverflow.com/q/27372898
tag name: xml-namespaces
type: Tag

http://stackoverflow.com/q/27375557
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/30640637
favorite count: 0
has answer: http://stackoverflow.com/a/28221824
type: Question
has answer: http://stackoverflow.com/a/65686037
has title: Hystrix command fails with "timed-out and no fallback available"
tagged with: hystrix
has answer: http://stackoverflow.com/a/27376028
has answer: http://stackoverflow.com/a/33962251
downvote count: 1
score: 35
tagged with: java
has body: I've noticed that some of the commands in my application fail with Caused by: ! com.netflix.hystrix.exception.HystrixRuntimeException: GetAPICommand timed-out and no fallback available. out: ! at com.netflix.hystrix.HystrixCommand.getFallbackOrThrowException(HystrixCommand.java:1631) out: ! at com.netflix.hystrix.HystrixCommand.access$2000(HystrixCommand.java:97) out: ! at com.netflix.hystrix.HystrixCommand$TimeoutObservable$1$1.tick(HystrixCommand.java:1025) out: ! at com.netflix.hystrix.HystrixCommand$1.performBlockingGetWithTimeout(HystrixCommand.java:621) out: ! at com.netflix.hystrix.HystrixCommand$1.get(HystrixCommand.java:516) out: ! at com.netflix.hystrix.HystrixCommand.execute(HystrixCommand.java:425) out: Caused by: ! java.util.concurrent.TimeoutException: null out: !... 11 common frames omitted This is my Hystrix configuration override: hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=210000 hystrix.threadpool.default.coreSize=50 hystrix.threadpool.default.maxQueueSize=100 hystrix.threadpool.default.queueSizeRejectionThreshold=50 What kind of timeout is this? Is it a read/connection timeout to the external application? How do I go about debugging this?
answer count: 5
tagged with: java.util.concurrent
upvote count: 36

http://stackoverflow.com/comment/43339633
has text: If I have the @SuppressWarnings("deprecation") there Android Studio does not flag it. If I remove it, Android Studio does correctly show that there is a deprecated method.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27449887

http://stackoverflow.com/comment/43273083
score: 1
comment on: http://stackoverflow.com/q/27391959
has text: Sorry, wrong link,http://stackoverflow.com/questions/416266/sorted-collection-in-java should help
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27323029
has comment: http://stackoverflow.com/comment/43105396
has comment: http://stackoverflow.com/comment/43105374
has comment: http://stackoverflow.com/comment/43105304
answers question: http://stackoverflow.com/q/27322907
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43105281
has comment: http://stackoverflow.com/comment/43105353
type: Answer
upvote count: 1
has body: nextInt() (or most other nextXYZ methods, for that matter), throw an InputMismatchException if they encounter input that doesn't match their call (e.g., a letter in a nextInt call). So one option would be to simply catch it: int highnum; try { highnum = userin.nextInt(); } catch (InputMismatchException e) { System.out.println ("Wrong input encountered"); }

frame
tags question: http://stackoverflow.com/q/27355365
type: Tag
tag name: frame

http://stackoverflow.com/comment/43224574
score: 1
has text: Typically, if you're at this level I'd be questing your approach(15+ years I've never needed to do this), but since you've provided no context it's impossible to know. VALUE_PROPERTY is used by the option dialog to detect when the user presses a button, the property event is raised in response so that the api can make decisions about what it should do (typically closing the dialog)
comment on: http://stackoverflow.com/q/27387706
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43484180
type: Comment
has text: Oracle states that swing has a mechanism to support double buffering and that it is turned on by default … but if it would be on you won't have the scroll bar that slow down.
score: 0
comment on: http://stackoverflow.com/q/27455059
type: QuestionComment

http://stackoverflow.com/comment/43344747
type: AnswerComment
has text: no problem, feel free to accept the answer ;) and ask anything you want about openGL, because I enjoy working with it :)
type: Comment
comment on: http://stackoverflow.com/a/27453032
score: 0

http://stackoverflow.com/comment/43349364
comment on: http://stackoverflow.com/q/27455571
has text: Subin - I did perform the above test, while a lot other current user's are accessing the web portal, still i am able to track all my activity based on jsession and threadid mapping
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43379158
score: 1
comment on: http://stackoverflow.com/q/27472293
type: Comment
type: QuestionComment
has text: Welcome to Stack Overflow. Please give a detailed description of the problem - "it seems not to work" is *not* a detailed description.

http://stackoverflow.com/a/69143211
upvote count: 1
answers question: http://stackoverflow.com/q/27375192
downvote count: 0
type: Answer
has body: With org.apache.commons.compress.utils.IOUtils you can just "copy" from one file or stream (e.g. your base64InputStream) to the output stream: response.setContentType([your file mime type]); IOUtils.copy(base64InputStream, response.getOutputStream()); response.setStatus(HttpServletResponse.SC_OK); You'll find that class here https://mvnrepository.com/artifact/org.apache.commons/commons-compress A similar class (also named IOUtils) is also in Apache Commons IO (https://mvnrepository.com/artifact/commons-io/commons-io).
score: 1

http://stackoverflow.com/comment/131353283
type: AnswerComment
type: Comment
has text: second alternative did the trick (first one still getting access denied), thanks
comment on: http://stackoverflow.com/a/27380949
score: 0

http://stackoverflow.com/comment/43351336
has text: Avoid using `null` layouts, pixel perfect layouts are an illusion within modern ui design. There are too many factors which affect the individual size of components, none of which you can control. Swing was designed to work with layout managers at the core, discarding these will lead to no end of issues and problems that you will spend more and more time trying to rectify
score: 0
comment on: http://stackoverflow.com/q/27457052
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27360141
has answer: http://stackoverflow.com/a/27360203
tagged with: java
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/27360225
downvote count: 0
has title: How to get the absolute path location for this OutputStream?
score: 4
answer count: 4
has answer: http://stackoverflow.com/a/65906185
favorite count: 0
has answer: http://stackoverflow.com/a/27360238
has body: byte bWrite [] = {11,21,3,40,5}; OutputStream os = new FileOutputStream("test.txt"); System.out.println("Created successfully"+os.getAbsolutePath()); This is my code.I have to get the location for "test.txt".please check it out if it is some other way to implement...?
type: UnansweredQuestion

http://stackoverflow.com/comment/43190797
type: Comment
has text: Look for numbers in the input and repeat the last character. How far did you get implementing that?
comment on: http://stackoverflow.com/q/27369482
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43326333
score: 0
has text: I am able to copy context.xml from app/META.INF to Tomcat conf/catalina/localhost/appname.xml but still not able to hit the URL with the path
type: Comment
comment on: http://stackoverflow.com/a/27419548
type: AnswerComment

http://stackoverflow.com/a/38398683
answers question: http://stackoverflow.com/q/27399242
has body: I found i way of doing it myself, it's quite simple as i answered in this other question: There is a very simple way of doing this, you don't need to modify your model class with SimpleBooleanProperty or whatever, just follow these steps: 1 - Suppose you have a "Person" object with a isUnemployed method: public class Person { private String name; private Boolean unemployed; public String getName(){return this.name;} public void setName(String name){this.name = name;} public Boolean isUnemployed(){return this.unemployed;} public void setUnemployed(Boolean unemployed){this.unemployed = unemployed;} } 2 - Create the callback class import javafx.beans.property.SimpleObjectProperty; import javafx.beans.value.ObservableValue; import javafx.scene.control.CheckBox; import javafx.scene.control.TableColumn; import javafx.util.Callback; public class PersonUnemployedValueFactory implements Callback, ObservableValue> { @Override public ObservableValue call(TableColumn.CellDataFeatures param) { Person person = param.getValue(); CheckBox checkBox = new CheckBox(); checkBox.selectedProperty().setValue(person.isUnemployed()); checkBox.selectedProperty().addListener((ov, old_val, new_val) -> { person.setUnemployed(new_val); }); return new SimpleObjectProperty(checkBox); } } 3 - Bind the callback to the table column If you use FXML, put the callback class inside your column: &lt;TableView fx:id="personList" prefHeight="200.0" prefWidth="200.0"&gt; &lt;columns&gt; &lt;TableColumn prefWidth="196.0" text="Unemployed"&gt; &lt;cellValueFactory&gt; &lt;PersonUnemployedValueFactory/&gt; &lt;!--This is how the magic happens--&gt; &lt;/cellValueFactory&gt; &lt;/TableColumn&gt; ... &lt;/columns&gt; &lt;/TableView&gt; Don't forget to import the class in your FXML: &lt;?import org.yourcompany.yourapp.util.PersonUnemployedValueFactory?&gt; Without FXML, do it like this: TableColumn&lt;Person, CheckBox&gt; column = (TableColumn&lt;Person, CheckBox&gt;) personTable.getColumns().get(0); column.setCel…
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/100040409
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27399242

http://stackoverflow.com/q/27379046
score: 7
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/64850029
has answer: http://stackoverflow.com/a/27379136
has answer: http://stackoverflow.com/a/64850029
has comment: http://stackoverflow.com/comment/43207902
downvote count: 0
answer count: 3
tagged with: regex
favorite count: 0
has body: I have a string s and a regex. I would like to replace each match of the regex in s with a replacement string. The replacement string might contain one or more backslashes. To perform the replacement, I'm using Matcher's appendReplacement method. The problem with appendReplacement is that it ignores all the backlashes it encounters in the replacement string. So if I try replacing the substring "match" in the string "one match" with the replacement string "a\\b", then appendReplacement results in "one ab" instead of "one a\\b"*: Matcher matcher = Pattern.compile("match").matcher("one match"); StringBuffer sb = new StringBuffer(); matcher.find(); matcher.appendReplacement(sb, "a\\b"); System.out.println(sb); // one ab I have taken a look at appendReplacement's code, and found out that it skips any encountered backslash: if (nextChar == '\\') { cursor++ nextChar = replacement.charAt(cursor); ... } How can I replace each match with a replacement string that contains backslashes? (*) - Note that there's a single backslash in "a\\b", not two. The backslash is just escaped.
has answer: http://stackoverflow.com/a/27379148
has title: Matcher's appendReplacement method ignores the replacement's backslashes
has comment: http://stackoverflow.com/comment/43207510
upvote count: 7
has comment: http://stackoverflow.com/comment/43207879
accepted answer: http://stackoverflow.com/a/27379148
type: AnsweredQuestion

http://stackoverflow.com/q/27356794
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/47218889
tagged with: spring
tagged with: java
tagged with: hibernate
score: 9
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/31309659
upvote count: 9
downvote count: 0
has title: OptimisticLockException in pessimistic locking
answer count: 2
has answer: http://stackoverflow.com/a/30074639
has body: I am using Spring with Hibernate. I am running jUnit test like this: String number = invoiceNumberService.nextInvoiceNumber(); and invoiceNumberService method is: InvoiceNumber invoiceNumber = invoiceNumberRepository.findOne(1L); it is using simple spring data repository method, and it's working well. But when I override this method to use locking: @Lock(LockModeType.PESSIMISTIC_READ) @Override InvoiceNumber findOne(Long id); I am getting "javax.persistence.OptimisticLockException: Row was updated or deleted by another transaction" I can't understand why its optimistic lock exception, while I am using pessimistic locking? And where is this part when another transaction is changing this entity? I have already dig a lot similar questions and I am quite desperate about this. Thanks for any help Solution: The problem was in my init function in test class: @Before public void init() { InvoiceNumber invoiceNumber = new InvoiceNumber(1); em.persist(invoiceNumber); em.flush(); } There was lack of em.flush(); Which saves the data into database, so findOne() can now retreive it

http://stackoverflow.com/comment/43180402
comment on: http://stackoverflow.com/q/27364260
score: 1
type: QuestionComment
has text: your public ArrayList<PersonalAccount> personalAccounts; should be outside of this class, then create accounts to add to the list
type: Comment

http://stackoverflow.com/q/27447912
has title: BufferedWriter is not writing text to text file
accepted answer: http://stackoverflow.com/a/27448004
possible better answer: http://stackoverflow.com/a/27454031
score: 0
has comment: http://stackoverflow.com/comment/43334769
has answer: http://stackoverflow.com/a/27454031
has comment: http://stackoverflow.com/comment/43334679
has comment: http://stackoverflow.com/comment/43335276
type: AnsweredQuestion
tagged with: bufferedwriter
has answer: http://stackoverflow.com/a/27448004
has comment: http://stackoverflow.com/comment/43334824
tagged with: java
type: Question
has body: I have a BufferedWriter which is being used to write to a file which has just been created in the given directory, however, for some reason it is not writing the text that it reads from another file, here is my code: private static final String tempFileDir = System.getProperty("user.dir") + "/TempATM.txt"; File tempFile = new File(tempFileDir); //Create temporary file to write new info to File toRenameTo = new File("VirtualATM.txt"); //filename to rename temp file to if (!tempFile.exists() &amp;&amp; !tempFile.isDirectory()) { tempFile.createNewFile(); //Create temp file if it doesn't already exist. } FileOutputStream fos = new FileOutputStream(tempFile, true); //For writing new balance Writer bw = new BufferedWriter(new OutputStreamWriter(fos, "UTF8"));//For writing new balance String newLineRead = null; FileReader fileReader = new FileReader("VirtualATM.txt");//for reading from file BufferedReader newBufferedReader = new BufferedReader(fileReader);//for reading from file while((newLineRead = newBufferedReader.readLine()) != null){ if(!newLineRead.contains(cardNumberStr)){ bw.append(newLineRead); //If the line does not contain user entered card number, write line to new file. ((BufferedWriter) bw).newLine(); }else if(newLineRead.contains(cardNumberStr)){ bw.append(newAccountDetails); //Write updated account details if the line read contains users account number ((BufferedWriter) bw).newLine(); } } File toDeleteFile = new File("dirToWriteFile"); //File path to delete the file. if(!toDeleteFile.delete()){ JOptionPane.showMessageDialog(null, "FATAL ERROR! Could not delete VirtualATM.txt", "Error", JOptionPane.ERROR_MESSAGE); // for if there is an error when deleting file } if(!file.renameTo(toRenameTo)){ JOptionPane.showMessageDialog(null, "FATAL ERROR! Could not rename the file to VirtualATM.txt", "Error", JOptionPane.ERROR_MESSAGE);//for if there is an error renaming file } Edit: I am also having trouble deleting and renaming the text file, could any suggest what ma…
answer count: 2
tagged with: bufferedreader

http://stackoverflow.com/comment/43317711
score: 0
type: Comment
type: QuestionComment
has text: I think "a","b", etc. can be not ordered. so it would be good to check also orders, like str.indexOf("a") < str.indexOf("b") && str.indexOf("b") < str.indexOf("c") and etc
comment on: http://stackoverflow.com/q/27438883

http://stackoverflow.com/a/27451339
type: Answer
has body: I have changed the structure of read file method and problem solved. Thank you for all your input guys.
answers question: http://stackoverflow.com/q/27393913
accepted answer of: http://stackoverflow.com/q/27393913
score: 0
type: AcceptedAnswer

http://stackoverflow.com/a/27362276
has body: Do sb.insert(0, '\uFEFF'); resp.getWriter().write(sb.toString()); This inserts a BOM character, a zero-width space, to mark the text as Unicode. It is redundant, even ugly. But in this way Excel &amp; Notepad won't mistake the encoding for the platform encoding. Caveat: Now cell A1 cannot contain a number.
accepted answer of: http://stackoverflow.com/q/27362159
answers question: http://stackoverflow.com/q/27362159
upvote count: 4
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 4

http://stackoverflow.com/q/27378085
score: 0
answer count: 1
has body: I am unsure on how to give the user an option to add / delete a name from the existing text file. The current code works fine and reads in names from the text file. Could someone give me a hand on this? import java.io.File; import java.util.Scanner; public class AddOrDeleteNames { public static void main(String[] args) throws Exception { String[] names = new String[100]; Scanner scan = new Scanner(new File("names.txt")); int index = 0; while (scan.hasNext()){ names[index]=(scan.nextLine()); index++; } for(int i = 0; i &lt; index; i++){ System.out.println(names[i]); } scan.close(); } }
has comment: http://stackoverflow.com/comment/43205562
has comment: http://stackoverflow.com/comment/43205628
accepted answer: http://stackoverflow.com/a/27378283
has comment: http://stackoverflow.com/comment/43205622
has title: How do I add / delete a line from a text file?
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27378283
type: Question

http://stackoverflow.com/comment/43275116
comment on: http://stackoverflow.com/a/27394414
type: Comment
has text: I tried something like this: Height = getWidth()* Math.tan(Math.toRadians(angle)); Path2D triangle = new Path2D.Double(); triangle.moveTo(0, Height); triangle.lineTo(0,getHeight()); triangle.lineTo(getWidth() , getHeight()); triangle.closePath(); But it doesn't work well
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43122323
type: QuestionComment
comment on: http://stackoverflow.com/q/27332239
score: 0
has text: Before conversion im sure that latitude is correct (i show that in TextView)
type: Comment

http://stackoverflow.com/a/27348326
type: Answer
has body: 1) Map counts 2) count = 0 3) counts.get(c) &lt;= 1
answers question: http://stackoverflow.com/q/27348287
has comment: http://stackoverflow.com/comment/43151341
has comment: http://stackoverflow.com/comment/43151465
score: 0

http://stackoverflow.com/q/27465512
answer count: 1
downvote count: 0
duplicate of: http://stackoverflow.com/q/6219597
favorite count: 0
tagged with: blocking
has title: Blocking the main thread
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/27465522
score: 1
tagged with: java
tagged with: multithreading
linked to: http://stackoverflow.com/q/6219597
upvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43367098
has body: I am not understanding why my main UI thread is getting blocked. I have button which calls function doSomething(). randomButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { doSomething(); } }); } // My private helper funtion private void doSomething() { Thread t1 = new Thread() { @Override public void run() { long startTime = SystemClock.uptimeMillis(); Log.e(TAG, "Start Time = "+startTime); while((SystemClock.uptimeMillis()-startTime)&lt;6000){// Loop for 6 seconds Log.e(TAG, "Diff ="+(SystemClock.uptimeMillis()-startTime)); } } }; t1.run(); } The problem is when I press the button, it remains pressed for how much ever time my loop run (here 6 secs). I want it in a such a way that user can still use his UI elements even though the loop keeps running. Thats the reason I created a new Thread. Am I doing something wrong ? Thanks
tagged with: ui-thread

http://stackoverflow.com/a/27444358
has body: Something like this should work while(rs.next()){ //create JLabels here with the contact names and insert it into a JPanel JLabel contact = new JLabel(rs.getString(0) + " " + rs.getString(1)); contactlist.add(contact); } Depending on fields you return with * in the query, index used in rs.getString(&lt;column index&gt;) should be adjusted.
type: AcceptedAnswer
score: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27444293
answers question: http://stackoverflow.com/q/27444293

http://stackoverflow.com/comment/43364179
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27463997
has text: Well, there is my problem, this will alway give an even grid. and would never draw something like 13.
score: 0

http://stackoverflow.com/a/27436507
answers question: http://stackoverflow.com/q/27436349
score: 0
has body: You are mixing things up, First things first, the difference between Classes and Objects. A class is a blueprint for an object, so an example of a class is Car. The blueprint of such an object however knows nothing about the state of a particular instance of that class, lets assume that you drive 100 km/u, then you have an instance of Car that stores that it is going at 100 km/u. Blueprints are classes, Objects are instances. So, public class Car makes an blueprint for cars, and new Car() makes a specific instance of that blueprint in which you can store runtime information. Now there is a way to tell Java that things belong to the blueprint, static. If a variable is static it is attached to the blueprint. So to keep up with the analogy of cars, a static variable for a car can be its wheelbase, thats something that is defined at compiletime (or in the car analogy at create time). Back to your problem, you are mixing up classes and objects, what you want to do is have a BattleshipWindow of which instances exist. Of this BattleshipWindow an instance can be created with new, and then its properties can be changed. Not exactly the answer you want probably, but I hope you now understand the difference between classes and objects, that will help you solve your problem.
type: Answer

http://stackoverflow.com/comment/43100369
has text: thanks for the quick answers :) but removing the cast is not possible, because the method expects a E parameter and not an object. and if i include all enum constants, i have to exclude specific ones later, so that wont work too :(
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27318939

http://stackoverflow.com/q/27337628
downvote count: 1
type: Question
tagged with: max
score: 0
answer count: 3
has title: Java: Get maximum value of variables
has answer: http://stackoverflow.com/a/27337643
favorite count: 0
type: UnansweredQuestion
upvote count: 1
has body: I am trying to find the largest values of these three variables (aCounter, bCounter, cCounter) that has been calculated. Java does not like how I am putting them into the string. Thanks in advance guys! double aCounter=0; double bCounter=0; double cCounter=0; { code to count occurrences of each character in text file } String lines = aCounter + bCounter + cCounter; String [] array = lines.split (" "); //splits with a space int largestInt = Integer.MIN_VALUE; for (String numberString : array ) { int number = Integer.parseInt(numberString); if (number &gt; largestInt) { largestInt = number; } } bw.write ( largestInt );
has answer: http://stackoverflow.com/a/27337665
tagged with: java
has answer: http://stackoverflow.com/a/27337658

http://stackoverflow.com/q/27416065
accepted answer: http://stackoverflow.com/a/27426313
has title: Query by Date in Java JPA
has comment: http://stackoverflow.com/comment/43300122
has comment: http://stackoverflow.com/comment/43278783
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43276836
has body: How is it possible to query for DateTime in MySQL in JPA? The variable before is a Date() object in milliseconds. I would do something like the following: @Override @Transactional(readOnly = true) public List&lt;Entry&gt; findAllBefore(Long before, Integer nEntries) { CriteriaBuilder builder = this.getEntityManager().getCriteriaBuilder(); CriteriaQuery&lt;Entry&gt; criteriaQuery = builder.createQuery(Entry.class); Root root = criteriaQuery.from(Entry.class); criteriaQuery.select( root ); // seems not to work criteriaQuery.where( builder.lessThan( root.get( "start" ) , before ) ); TypedQuery&lt;Entry&gt; typedQuery = this.getEntityManager() .createQuery(criteriaQuery) .setMaxResults(nEntries) return typedQuery.getResultList(); } I want to have all Entries from the corresponding table where the DateTime column "start" is before the value in the variable 'before'.
has comment: http://stackoverflow.com/comment/43279162
tagged with: java
has comment: http://stackoverflow.com/comment/43281182
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/27426313
has comment: http://stackoverflow.com/comment/43279486
has comment: http://stackoverflow.com/comment/43277905
score: 0
tagged with: jpa
answer count: 1

http://stackoverflow.com/comment/43357873
score: 0
type: Comment
has text: Interesting, I messed with that a bit and updated my question. So is this really as far is it goes? and nothing really happens if I haven't explicitly defined an `UncaughtExceptionHandler`?
comment on: http://stackoverflow.com/a/27460584
type: AnswerComment

http://stackoverflow.com/comment/43369943
comment on: http://stackoverflow.com/a/27466860
type: Comment
has text: That's wrong. Example: `NumberFormatException`. It's a `RuntimeException` and if the origin of input is coming from the user I'd rather `catch` it than having bogus user input crash the program. Another example: `OutOfMemoryError`. If I read the size of an image and now am using the size to allocate the array, I'd rather catch `OutOfMemoryError` and tell my user that the VM needs more memory than simply crash the program - besides, the program might happily continue after `OutOfMemoryError` in such a situation.
score: 0
type: AnswerComment

http://stackoverflow.com/a/27451665
type: Answer
answers question: http://stackoverflow.com/q/27446985
score: 0
has body: One solution would be to create a type which extends JPanel, and exposes a public property, which when called returns the value stored in the JTextField. Something like: public class TextFieldPanel extends JPanel { private JTextField myTextField; public TextFieldPanel() { //layout init code here } public String getText() { return myTextField.getText(); } } Then just use this class instead of a regular JPanel. Then when your button is clicked, iterate over each of the objects in your collection, and call getText() on them to get your values.

http://stackoverflow.com/a/27376552
accepted answer of: http://stackoverflow.com/q/27376254
type: Answer
answers question: http://stackoverflow.com/q/27376254
score: 3
has body: JFrame redirects the setLayout() to content pane. That's source snippet public void setLayout(LayoutManager manager) { if(isRootPaneCheckingEnabled()) { getContentPane().setLayout(manager); } else { super.setLayout(manager); } }
upvote count: 3
has comment: http://stackoverflow.com/comment/43203045
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43296246
type: Comment
comment on: http://stackoverflow.com/a/27401036
has text: i want 10 to be on the second button.....and it follow in that order for the rest
type: AnswerComment
score: 0

http://stackoverflow.com/q/27359930
tagged with: servlets
tagged with: browser
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/72296664
has answer: http://stackoverflow.com/a/63153122
has body: it may seems dublicate but i tried old posts about this problem and still can not solve... with Eclipse Juno and Tomcat 7 , i develop dynamic web application in Eclipse . i have 2 Java Servlet under some packages , in first one i set some attributes to request and forward it to second Servlet with RequestDispacter and print this attribute in second Servlet with out.println.... when i change request or session attribute and forward to second one . page is not updated . i restart tomcat or restart eclipse nothing changed.. i publish tomcat with Ctrl + Alt + P everytime but nothing changed ... i try external browser (Firefox and Internet Explorer) and delete caches but nothing changed .. in Tomcat Server "Auto publish when resources changed" is enabled but nothing changed. i try to Eclipse Luna and Tomcat 8 but it is has same problem . i did everything again but , still page is not updated !! how to make it updated when change something in code.. i am in stuck now , any advice would be great ...
tagged with: tomcat
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27360104
score: 3
has answer: http://stackoverflow.com/a/27360030
upvote count: 3
tagged with: java
tagged with: eclipse
type: Question
has title: Jsp file and Java Servlet is not updated after changes in Eclipse

http://stackoverflow.com/a/27414920
has body: There is nothing wrong with the code you posted, just add a main method, and you will see: public static void main(String[] args) { for (int i = 0; i &lt; 10; i++) { int[] ints = new RandomClass().generateRandomArray(10); System.out.println("RandomClass::main: ints = " + Arrays.toString(ints)); } } It prints very different random numbers. The problem is somewhere else.
type: AcceptedAnswer
downvote count: 0
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/27414799
accepted answer of: http://stackoverflow.com/q/27414799

http://stackoverflow.com/comment/43304149
has text: The application works good. No crashes etc, but the entry in the database keeps unchanged. It has to be 132, but it is not happening.
type: Comment
comment on: http://stackoverflow.com/a/27431018
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43320080
score: 1
has text: What do you mean by "catching" the return value? It would be useful if you'd explain why you *are* returning the original argument though. Note that your example code won't compile, as you're trying to pass an uninitialized variable (`a1`) into the method.
type: Comment
comment on: http://stackoverflow.com/q/27440098
type: QuestionComment

http://stackoverflow.com/q/27332658
tagged with: mysql
type: Question
tagged with: jakarta-ee
score: 3
has title: Referencing a datasource with JNDI name in persistence.xml
tagged with: java
tagged with: persistence.xml
upvote count: 3
has body: So I use Wildfly 8.2.0.Final I created my MySQL datasource successfully. Proof: from the admin console , i do "Test connection" and it gives Successfully connected to database MyAppDS. the datasource definition in standalone-full.xml : jdbc:mysql://localhost:3306/myapp com.mysql.jdbc.Driver mysql root false false false <blocking-timeout-millis>0</blocking-timeout-millis> 0 0 0 0 <allocation-retry-wait-millis>0</allocation-retry-wait-millis> <share-prepared-statements>false</share-prepared-statements> com.mysql.jdbc.Driver My persistence.xml <?xml version="1.0" encoding="UTF-8"?> java:/jdbc/MyAppDS org.myapp.entity.Place org.myapp.entity.User org.myapp.entity.MyCall <exclude-unlisted-classes>false</exclude-unlisted-classes> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/> The server log before deploying the application shows 15:07:24,550 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) JBAS010400: Bound data source [java:/jdbc/MyAppDS] And when I debug my application shows the following, the following line appears 15:09:13,175 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "myapp-1.0.war")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.\"myapp-1.0\".\"myapp-1.0\".DefaultDataSource is missing [jboss.naming.context.java.jboss.datasources.ExampleDS]"]} 15:09:13,222 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018559: Deployed "myapp-1.0.war" (runtime-name : "myapp-1.0.war") 15:09:13,237 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) JBAS014774: Service status report JBAS014775: New missing/unsatisfied dependencies: service jboss.naming.context.java.jboss.datasources.ExampleDS (missing) dependents: [service jboss.naming.context.java.module."myapp-1.0"."myapp-1.0".DefaultDataSource] 15:09:21,177 E…
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27465863
type: UnansweredQuestion
downvote count: 0
tagged with: wildfly

http://stackoverflow.com/q/27371659
favorite count: 0
has comment: http://stackoverflow.com/comment/43195548
has comment: http://stackoverflow.com/comment/43194670
tagged with: android
type: AnsweredQuestion
tagged with: java
tagged with: mysql
has body: i m trying to make app that can communicate with mysql (localhost) Only problem is Eclipse is showing JSONParser Error After trying to find solution for error i found this Tutorial jackson library tho http://jackson.codehaus.org/ i could not found any solution after 2 days digging into android code JSONParser jParser = new JSONParser(); ERROR: Multiple markers at this line - JSONParser cannot be resolved to a type - JSONParser cannot be resolved to a type and this line of code has same error showing JSONObject json = jParser.makeHttpRequest(url_all_products, "GET", params); Please help me so i can continue my app help will highly appreciate! thanks
type: Question
has title: JSONParser showing error in android app
has answer: http://stackoverflow.com/a/27371748
score: 0
accepted answer: http://stackoverflow.com/a/27371748
upvote count: 1
answer count: 1
downvote count: 1

http://stackoverflow.com/q/27445665
has answer: http://stackoverflow.com/a/27445744
type: Question
has comment: http://stackoverflow.com/comment/43330433
score: 3
has answer: http://stackoverflow.com/a/27445853
tagged with: http://stackoverflow.com/tag/c
possible better answer: http://stackoverflow.com/a/27445744
upvote count: 3
has answer: http://stackoverflow.com/a/27445931
tagged with: random
has comment: http://stackoverflow.com/comment/43330315
linked to: http://stackoverflow.com/q/363681
has comment: http://stackoverflow.com/comment/43330345
favorite count: 0
linked to: http://stackoverflow.com/q/4945698
has body: As I am rewriting application which uses randoms quite often from C to Java, and I would like to ask if there is any critical difference between rand() % 256; // C code and this import java.util.Random; ... Random rand = new Random(); rand.nextInt(256); Does anyone know if it works the same way or, as I already wrote, there is some critical difference?
has comment: http://stackoverflow.com/comment/43330268
answer count: 4
has title: Is there any difference between random in C and random in Java?
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43330414
downvote count: 0
has answer: http://stackoverflow.com/a/27445753
tagged with: java
accepted answer: http://stackoverflow.com/a/27445753

http://stackoverflow.com/comment/43237802
has text: I am getting the following exception while run the above code com.amazonaws.AmazonClientException: Unable to calculate a request signature: null Caused by: java.lang.NullPointerException at javax.xml.bind.DatatypeConverter.printBase64Binary(Unknown Source)
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27380282

http://stackoverflow.com/a/27389430
type: Answer
has body: Assuming no special characters in the 00-2F range: int max = max_length_of_file_name + Math.log10(max_leading_number); return leftPadWith0ToMaxLength(o1.getName(), max).compareTo(leftPadWith0ToMaxLength(o2.getName(), max)); Code for leftPadWith0ToMaxLength, max_length_of_file_name, max_leading_number left as exercise.
answers question: http://stackoverflow.com/q/27389018
score: 0

http://stackoverflow.com/a/27624941
score: 0
type: Answer
has body: Sometimes you have to reinstall eclipse after it crashes. That's why it is a good idea they made it portable. But you can try to go back from the about eclipse uninstall component. But in my experience if you blew the ini and all that maybe the fastest way is to reinstall especially when there are so many dependencies like in adt. You can also install regular eclipse and android plugin you don't have to use only adt. And maybe eclipse is more stable like that Another thing you need to recompile the project probably
answers question: http://stackoverflow.com/q/27457841
upvote count: 1
downvote count: 1

http://stackoverflow.com/comment/43160684
type: QuestionComment
comment on: http://stackoverflow.com/q/27352794
score: 0
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/66382/discussion-between-aditya-ekbote-and-vishnu).
type: Comment

http://stackoverflow.com/comment/43319617
has text: possible duplicate of [Groovy String Concatenation](http://stackoverflow.com/questions/1010698/groovy-string-concatenation)
score: 0
comment on: http://stackoverflow.com/q/27439860
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43319377
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27431576
has text: For better speed yet, try setting `ImageIO.useCache(false)`. Also, I think you should update the question with the `IOException` mentioned in the comments to one of the answers below. This is most probably the cause. Maybe you are hitting a limit to how many open files your process can have or similar?
score: 0

http://stackoverflow.com/comment/43351407
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27457052
has text: FYI: AWT is pretty dated and went out of general use in the early 2000's. You might consider looking into Swing or JavaFX for alternatives
score: 0

http://stackoverflow.com/a/27405045
has comment: http://stackoverflow.com/comment/43255751
has body: Please read the documentation first. See that big box on the top of this page, with the title Avoid reading files currently being written by another application https://camel.apache.org/components/latest/file-component.html
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27404981
answers question: http://stackoverflow.com/q/27404981
type: Answer

http://stackoverflow.com/q/27376283
has answer: http://stackoverflow.com/a/27376466
has answer: http://stackoverflow.com/a/51940617
has answer: http://stackoverflow.com/a/27376341
possible better answer: http://stackoverflow.com/a/27376466
has answer: http://stackoverflow.com/a/27376367
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27376467
has body: In my android application, I set title name of an activity in AndroidManifest.xaml like below: &lt;activity android:name=".LoginSuccess" android:label="Home" &gt; // this is title name &lt;/activity&gt; And activity title name is Home and I wan to get this actitvity title name in my actitvity's java page, I am trying like below: protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_sample); android.support.v7.app.ActionBar actionBar = getSupportActionBar(); pageTitle = actionBar.getTitle().toString(); } But I am getting below exception at this line pageTitle = actionBar.getTitle().toString(); : java.lang.NullPointerException Kindly suggest me, what can I do to resolve this issue, waiting for reply. Thanks.
tagged with: java
has answer: http://stackoverflow.com/a/27376404
has comment: http://stackoverflow.com/comment/43202267
has title: How to get activity title name through programmatically java android
upvote count: 4
downvote count: 0
answer count: 6
score: 4
favorite count: 0
accepted answer: http://stackoverflow.com/a/27376467
tagged with: android
has comment: http://stackoverflow.com/comment/43202268

http://stackoverflow.com/q/27441313
tagged with: http://stackoverflow.com/tag/html
has comment: http://stackoverflow.com/comment/43324466
has comment: http://stackoverflow.com/comment/43323478
tagged with: http://stackoverflow.com/tag/xml
score: 0
tagged with: java
tagged with: saxon
tagged with: xslt
type: Question
has comment: http://stackoverflow.com/comment/43324563
has answer: http://stackoverflow.com/a/27555345
has title: Java Saxon lib error when extracting data from html 4.0 file
has body: I have diff report in html format of two directories( with xml files) I need to extra the desired data from this report. I wrote a simple xslt and tried this: java -jar saxon9he.jar -xsl:diff.xsl -s:Diff\ Report.html This ends with SXXP0003: Error reported by XML parser: The declaration for the entity "HTML.Version" must end with '&gt;'. Transformation failed: Run-time errors were reported Html file header: &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;html&gt;&lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; .... XSLT:(very basic it does nothing) &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:html="http://www.w3.org/1999/xhtml" version="2.0" exclude-result-prefixes="html"&gt; &lt;xsl:output method="xml" indent="yes" /&gt; &lt;xsl:template match="/"&gt; &lt;translations&gt; &lt;xsl:apply-templates /&gt; &lt;/translations&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; The question is , is it possible to parse html 4.0 documents with this lib ? Or I have to add some namespaced or modify the source document to fix this error ?
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/comment/43297388
score: 1
has text: You can set system properties via : -D-M-Dsome.key=value. see http://www.mulesoft.org/documentation/display/current/Configuring+Properties The problem with Mule context is just that you are are coupling your component to Mule internals.
comment on: http://stackoverflow.com/a/27422311
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43265962
has text: If you're not going to use setters in the DAO callers, then just don't call them there. I still don't find a good point on creating an interface just for getters.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27410581
score: 0

http://stackoverflow.com/comment/56490764
score: 0
type: AnswerComment
type: Comment
has text: I’m using Sean Corfield’s Leiningen plug-in to compile Frege code and to be able to call Frege code from Clojure. But when I try to call a Frege function that expects a list of integers (say with `(X/foo [1,2,3])`) I get the error `ClassCastException clojure.lang.PersistentVector cannot be cast to frege.runtime.Lazy`. @Ingo, can the answer above somehow be put to use here as well?
comment on: http://stackoverflow.com/a/27353378

http://stackoverflow.com/comment/43239078
has text: @G.S Yeah, I'm working exactly with tomcat. Does that plugin suit the only for tomcat?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27396288
score: 0

http://stackoverflow.com/a/27403599
has comment: http://stackoverflow.com/comment/43253439
type: Answer
answers question: http://stackoverflow.com/q/27403218
has body: what you are trying to do here is a ETL process. Its better to use some framework which does that like kettle for example. If you are having a distributed data then better using hadoop mapreduce jobs would help.
score: 0

http://stackoverflow.com/q/27438013
possible better answer: http://stackoverflow.com/a/27451839
score: 2
type: AnsweredQuestion
has title: How can I split the Apache camel AWS-S3 messages
tagged with: amazon-s3
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/27451839
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27539441
accepted answer: http://stackoverflow.com/a/27539441
has body: I have an requirement to move the files from one S3 bucket to another S3 bucket, during this process I need to split the file (that is an image file). So, this is how I am doing camelContext.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from(sourcePoint.getS3SourcePoint()).split().method(new SheetImageSplitterImpl(), "split").to(destinationPoint.getS3DestinationPoint()); } }); camelContext.start(); Inside SheetImageSplitter's split() method, I am trying to implement the logic to split the image file. The exchange body returns me a body of type S3Object.inputStream. I do not find any help to convert the S3ObjectInputStream to image files public List&lt;Message&gt; split(Exchange exchange) { System.out.println(exchange.getIn().getBody()); } Is there way, So that I can process the image files Note : I am using Java DSL
tagged with: apache-camel
tagged with: amazon-web-services
upvote count: 2
favorite count: 0

http://stackoverflow.com/comment/43219519
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27385328
has text: Fair enough. I don't know of a better way than `codePointAt` and iterating manually, basically... sorry not to have been able to give you a more canonical approach, but it sounds like you're already along the right lines.
type: QuestionComment

http://stackoverflow.com/q/27432978
has body: We have working on simple definitions and concepts of Distributed Systems in computer networks which are Replications and Transparency. so I need to implement RMI client that connects to RMI proxy,then the proxy redirects the client connection to one of n-servers and choose to connect to one of these server based on some value between proxy and server. so here we have n-servers replications and the client apply the transparency concepts that the client cannot connects directly to servers and from client perspective he can see only one server(proxy server). Here is simple diagram for what i want to design using RMI only in java... So, as i have some experience in RMI i implement client and server using RMI but here Does i need to implement the Proxy server as server to serve the client and as client for the n-servers or what .....???? how to put the first step in implementing proxy using RMI....
score: 0
answer count: 1
tagged with: proxy
has title: Implement Java proxy server using RMI
has answer: http://stackoverflow.com/a/27433615
type: UnansweredQuestion
tagged with: rmi
tagged with: java
type: Question

http://stackoverflow.com/a/27381397
has comment: http://stackoverflow.com/comment/43216030
has comment: http://stackoverflow.com/comment/43235433
has comment: http://stackoverflow.com/comment/43236765
answers question: http://stackoverflow.com/q/27374445
type: Answer
score: 0
has body: The first (single post activity) problem can be easily solved by adding the like to the category list set of data (ArrayList.get(i).addLike or whatever you use to add likes) and then call adapter.notifyDatasetChanged(); Which will make your second list update it self with the new content (that you've just changed) So now the problem is the first list. as far as I understand we have 2 lists that contains an identical item, that (at least I wanna believe since it's post kind of element) has it's own unique ID, perhaps try to loop thru the first list searching for that element? for example if the 2nd list (category?) is now showing a post in single post activity and its ID is 5. When changing the likes amount try something like this: //First we change the second list item which is the first one on the backstack &amp; we know it's position on the list CategoryList.get(currentPost).addLike(); //Then we loop the first list to find the same post from the second list on it for(int i = 0; i &lt; MainList.size(); i++) { if(MainList.get(i).getID == CategoryList.get(currentPost).getID) { //Add the like on the first list MainList.get(i).addLike(); break; } } //Call update on the adapters MainListAdapter.notifyDatasetChanged(); SecondListAdapter.notifyDatasetChanged();

http://stackoverflow.com/q/27418944
has comment: http://stackoverflow.com/comment/43283689
score: 0
has comment: http://stackoverflow.com/comment/43283317
has title: how to get all tables and Their's columns of a specific schema using Java?
tagged with: java
tagged with: database
type: UnansweredQuestion
has body: I have a database schema that its name is "Navid" there is many tables in this schema. definitely each table, has some columns. what I need is a java class that: Connect to my database. Have a method that loop on all tables 2-1. Have an inner loop to define all columns of the table. Make create table query statement .(I want to create the same table in another database). Execute that query. I write some code but I do not know what to do next. public class automateExport { static String value; public static void main(String[] args) throws SQLException, ClassNotFoundException { // ResultSet rs = null; String table_name; String column_name; String tableName = null; StringBuilder sb = new StringBuilder(1024); Connection DB2 = getConnection(); String sql = "SELECT TABSCHEMA,TABNAME,COLNAME FROM SYSCAT.COLUMNS WHERE TABSCHEMA NOT LIKE 'SYS%'"; PreparedStatement mainStmt = DB2.prepareStatement(sql); ResultSet rs = mainStmt.executeQuery(); ResultSetMetaData rsmd = rs.getMetaData(); int columnCount = rsmd.getColumnCount(); /* while(rs.next()){ table_name = rs.getString(2); // for(int i = 1; i &lt;= 1; i ++){ column_name = rs.getString(3); System.out.println("SSS::::: " + table_name + " " + column_name ); // } */ for (int i = 1; i &lt;= rows; i++) { while (rs.next()) { table_name = rs.getString(2); if (i &gt; 1) { sb.append(", "); } column_name = rs.getString(3); String columnType = rsmd.getColumnTypeName(i); sb.append(" ").append(column_name).append(" ").append(columnType); int precision = rsmd.getPrecision(i); if (precision != 0) { sb.append("( ").append(precision).append(" )"); } } // for columns sb.append(" ) "); String sql2 = sb.toString(); PreparedStatement m = DB2.prepareStatement(sql); m.executeQuery(); System.out.println(sb.toString()); } } private static Connection getConnection() throws ClassNotFoundException, SQLException { Class.forName("COM.ibm.db2os390.sqlj.jdbc.DB2SQLJDriver"); Connection connection = DriverManager.getConnection("jdbc:db2://localhost:50000/nav…
answer count: 0
type: Question

http://stackoverflow.com/comment/43165769
comment on: http://stackoverflow.com/a/27356421
type: AnswerComment
score: 0
type: Comment
has text: Can you tell in which function i need to create the menu manager for the sub menu @greg-449

http://stackoverflow.com/comment/43232024
type: Comment
comment on: http://stackoverflow.com/a/27392239
has text: That's fine, is it not directly possible to append ctrl+A character at the time string creation without declaring character like this
type: AnswerComment
score: 0

http://stackoverflow.com/a/27387523
type: Answer
has body: You can't read a file from bottom to top. Instead, read the file (top to bottom) keeping the last (up to) 6 items read. When you hit the end if the file, test if you you have 6 items or not and act accordingly. Use a LinkedList object, which allows removal of the element of the list via removeFist(). You could just store all items and use only the last 6, but that may mean using a lot of memory if the file is very large.
answers question: http://stackoverflow.com/q/27386626
score: 0

http://stackoverflow.com/q/27439740
has comment: http://stackoverflow.com/comment/43319690
has comment: http://stackoverflow.com/comment/43320123
has comment: http://stackoverflow.com/comment/43319729
has comment: http://stackoverflow.com/comment/43319837
type: AnsweredQuestion
has body: i have set up a DialogFragment which works perfectly. I only have a problem that it keeps crashing on the second onclick. It says the the parent already has a child and i must call removeView() on the child's parent first. Any hints/explanations about whats going on here? Code : final EditText input = new EditText(getActivity()); testView = (TextView)mRootView.findViewById(R.id.testView); testView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { AlertDialog.Builder alert = new AlertDialog.Builder(getActivity()); alert.setTitle("Doe Mee "); alert.setView(input); final String value; alert.setPositiveButton("Submit", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { String value = String.valueOf(input.getText()); Toast.makeText(getActivity().getApplicationContext(), "Do" + value, Toast.LENGTH_LONG).show(); } }); alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { } }); alert.show(); } }); Error : java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. at android.view.ViewGroup.addViewInner(ViewGroup.java:3771) at android.view.ViewGroup.addView(ViewGroup.java:3624) at android.view.ViewGroup.addView(ViewGroup.java:3600) at com.android.internal.app.AlertController.setupView(AlertController.java:414) at com.android.internal.app.AlertController.installContent(AlertController.java:242) at android.app.AlertDialog.onCreate(AlertDialog.java:337) at android.app.Dialog.dispatchOnCreate(Dialog.java:364) at android.app.Dialog.show(Dialog.java:265) at android.app.AlertDialog$Builder.show(AlertDialog.java:951) at nl.boydroid.loyalty4g.app.LoginFragment$6.onClick(LoginFragment.java:277) at android.view.View.performClick(View.java:4637) at android.view.View$PerformClick.run(View.java:19422) at android.os.Handler.handleCallback(Han…
tagged with: java
has comment: http://stackoverflow.com/comment/43319627
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27440598
has comment: http://stackoverflow.com/comment/43320000
has comment: http://stackoverflow.com/comment/43319386
has comment: http://stackoverflow.com/comment/43319500
accepted answer: http://stackoverflow.com/a/27440598
tagged with: android
has title: AlertDialog crashes 2d onclick (Android/Java)
has comment: http://stackoverflow.com/comment/43320152
score: 0
possible better answer: http://stackoverflow.com/a/27440732
has comment: http://stackoverflow.com/comment/43319748
has answer: http://stackoverflow.com/a/27440732

http://stackoverflow.com/q/27373302
has body: I am selecting two files using html5 tag ` &lt;input type="file" class="labelclass" id="files" style="border: 1px solid #7F9DB9;font-size: 22px " multiple="multiple"&gt; &lt;input type="button" style="background-image: url(app/images/upload.jpg); width:257px; height:58px;border-radius:20px;" onclick="startRead()"&gt; ajax call to send files function startRead() { $.ajax({ url: 'url?sessionid='+sessionid+'&amp;modelNo='+ $("#modelno").val()+'&amp;packageName='+$("#packagename").val()+'&amp;version='+$("#version").val()+'', data:{"file1":document.getElementById('files').files[0],"file2":document.getElementById('files').files[1]}, contentType: 'application/exe', beforeSend: function (xhr) { xhr.setRequestHeader('Content-Disposition', document.getElementById('files').files[0].name); }, processData: false, type: 'POST', success: function(data){ alert(data); } ,error:function(data) {alert(data); } }); } I want to retrieve inputstream of both files on the server Server side code is in java or groovy Please help me to retrieve inputsream using bot happroaches
score: 0
tagged with: groovy
answer count: 1
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has title: How do retrieve inputstream of two files selected via
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27373408

http://stackoverflow.com/comment/43161843
type: Comment
type: QuestionComment
score: 0
has text: Yes it holds words per minute and the errors
comment on: http://stackoverflow.com/q/27354321

http://stackoverflow.com/comment/43205798
has text: I think at least create a Process class and use an array of Process. Even you are addressing to beginners they have to learn thinking basing on Object Oriented concept.
type: Comment
comment on: http://stackoverflow.com/a/27362493
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43115146
score: 0
has text: @Vizkos How do we know `sum()` needs a 1D array? The method he posted is `average()`. The exception says nothing about `sum()`.
comment on: http://stackoverflow.com/q/27328156
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27426327
score: 6
has answer: http://stackoverflow.com/a/27429430
upvote count: 6
type: AnsweredQuestion
has title: Maintain sub type information while serializing java objects using Jackson, without using wrapper class
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
accepted answer: http://stackoverflow.com/a/27429430
downvote count: 0
tagged with: jackson
answer count: 1
has body: I am trying to convert between a JSON file and an abstract class with two subclasses in Java using Jackson. Ideally, I would like to use a JSON as the following: Json document without wrapper [ { "type" : "lion", "name" : "Simba", "endangered" : true, "action" : "running" }, { "type" : "elephant", "name" : "Dumbo", "endangered" : false, "table" : [ 1.0, 2.0, 3.0 ] } ] I have annotated the Animal abstract class as shown on http://www.studytrails.com/java/json/java-jackson-Serialization-polymorphism.jsp @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = As.PROPERTY, property = "type") @JsonSubTypes({ @Type(value = Lion.class, name = "lion"), @Type(value = Elephant.class, name = "elephant") }) public abstract class Animal { String name; boolean endangered; //Skipped constructor/getters/setters } I can successfully read/write it using a wrapper object, but the produced JSON file will include an additional animals object. JSON document with wrapper { "animals" : [ { "type" : "lion", "name" : "Simba", "endangered" : true, "action" : "running" }, { "type" : "elephant", "name" : "Dumbo", "endangered" : false, "table" : [ 1.0, 2.0, 3.0 ] } ] } When I use a plain Java list, I can successfully read from the Json document without wrapper but if I try to write it, the output file will be as follows: output.json [ { "name" : "Simba", "endangered" : true, "action" : "running" }, { "name" : "Dumbo", "endangered" : false, "table" : [ 1.0, 2.0, 3.0 ] } ] Java code // Test reading using raw list JavaType listType = mapper.getTypeFactory() .constructCollectionType(List.class, Animal.class); List&lt;Animal&gt; jsonList = mapper.readValue(new FileInputStream( "demo.json"), listType); jsonDocument = new File(outputFile); // Test writing using raw list mapper.writerWithDefaultPrettyPrinter().writeValue(jsonDocument, jsonList); Any ideas how I can include the type information when serializing the objects into JSON? The complete Eclipse project can be found on: https://github.com/nkatsar/js…
tagged with: polymorphism
favorite count: 0
tagged with: serialization

http://stackoverflow.com/comment/43353892
type: Comment
has text: Thank you very much your answer is also very useful but I chose the other one because he answered first. Thank you again.
type: AnswerComment
comment on: http://stackoverflow.com/a/27456837
score: 0

http://stackoverflow.com/comment/43155200
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27345778
has text: A row number is needed in situations, for example, [this](http://stackoverflow.com/a/1804983) link, if clicked, directly points to an answer available in the **fourth page**. When a user passes an `id` (primary key value) by clicking a link, the row is required to be highlighted which is possible only if the row number corresponding to that row is returned - same as that SO answer is highlighted by **automatically selecting the corresponding page**.

http://stackoverflow.com/comment/43147914
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27346471
type: Comment
has text: very good point, but could you add this as a comment instead of an answer?

http://stackoverflow.com/comment/43190289
type: AnswerComment
comment on: http://stackoverflow.com/a/27344884
has text: Thanks Michal, was really handy ... following through
type: Comment
score: 0

multithreading
tags question: http://stackoverflow.com/q/27373362
tags question: http://stackoverflow.com/q/27398650
tags question: http://stackoverflow.com/q/27448676
tags question: http://stackoverflow.com/q/27443541
tags question: http://stackoverflow.com/q/27425705
tags question: http://stackoverflow.com/q/27415236
tags question: http://stackoverflow.com/q/27314412
tags question: http://stackoverflow.com/q/27374637
tags question: http://stackoverflow.com/q/27351636
tags question: http://stackoverflow.com/q/27431576
type: Tag
tags question: http://stackoverflow.com/q/27448063
tags question: http://stackoverflow.com/q/27342460
tags question: http://stackoverflow.com/q/27361353
tags question: http://stackoverflow.com/q/27420657
tags question: http://stackoverflow.com/q/27461325
tags question: http://stackoverflow.com/q/27355932
tags question: http://stackoverflow.com/q/27402472
tags question: http://stackoverflow.com/q/27416364
tags question: http://stackoverflow.com/q/27445045
tags question: http://stackoverflow.com/q/27409708
tags question: http://stackoverflow.com/q/27413116
tags question: http://stackoverflow.com/q/27377595
tags question: http://stackoverflow.com/q/27362112
tags question: http://stackoverflow.com/q/27473367
tags question: http://stackoverflow.com/q/27458902
tags question: http://stackoverflow.com/q/27340655
tags question: http://stackoverflow.com/q/27405985
tags question: http://stackoverflow.com/q/27444036
tags question: http://stackoverflow.com/q/27392383
tags question: http://stackoverflow.com/q/27463506
tags question: http://stackoverflow.com/q/27440599
tags question: http://stackoverflow.com/q/27450865
tags question: http://stackoverflow.com/q/27377351
tags question: http://stackoverflow.com/q/27442402
tags question: http://stackoverflow.com/q/27449985
tags question: http://stackoverflow.com/q/27448617
tags question: http://stackoverflow.com/q/27355646
tags question: http://stackoverflow.com/q/27357495
tags question: http://stackoverflow.com/q/27325997
tags question: http://stackoverflow.com/q/27332507
tags question: http://stackoverflow.com/q/27378444
tags question: http://stackoverflow.com/q/27406948
tags question: http://stackoverflow.com/q/27411856
tags question: http://stackoverflow.com/q/27447668
tags question: http://stackoverflow.com/q/27422319
tags question: http://stackoverflow.com/q/27392600
tags question: http://stackoverflow.com/q/27334005
tags question: http://stackoverflow.com/q/27459875
tags question: http://stackoverflow.com/q/27423563
tags question: http://stackoverflow.com/q/27330347
tags question: http://stackoverflow.com/q/27470282
tags question: http://stackoverflow.com/q/27424845
tags question: http://stackoverflow.com/q/27343743
tags question: http://stackoverflow.com/q/27455013
tags question: http://stackoverflow.com/q/27460872
tags question: http://stackoverflow.com/q/27359112
tags question: http://stackoverflow.com/q/27407740
tags question: http://stackoverflow.com/q/27355554
tags question: http://stackoverflow.com/q/27344161
tags question: http://stackoverflow.com/q/27462260
tags question: http://stackoverflow.com/q/27337075
tags question: http://stackoverflow.com/q/27438591
tags question: http://stackoverflow.com/q/27463919
tags question: http://stackoverflow.com/q/27400583
tags question: http://stackoverflow.com/q/27403110
tags question: http://stackoverflow.com/q/27332934
tags question: http://stackoverflow.com/q/27392389
tags question: http://stackoverflow.com/q/27460751
tags question: http://stackoverflow.com/q/27347042
tags question: http://stackoverflow.com/q/27325248
tags question: http://stackoverflow.com/q/27330259
tags question: http://stackoverflow.com/q/27469761
tags question: http://stackoverflow.com/q/27334704
tags question: http://stackoverflow.com/q/27421009
tags question: http://stackoverflow.com/q/27319446
tags question: http://stackoverflow.com/q/27330436
tags question: http://stackoverflow.com/q/27465512
tags question: http://stackoverflow.com/q/27402772
tags question: http://stackoverflow.com/q/27332481

http://stackoverflow.com/comment/43158506
score: 0
has text: What do you mean by combined RGB value?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27347018

http://stackoverflow.com/a/27453593
has comment: http://stackoverflow.com/comment/43345544
has comment: http://stackoverflow.com/comment/43345687
accepted answer of: http://stackoverflow.com/q/27453577
score: 0
type: AcceptedAnswer
has body: You need a constructor with a parameter as you use it in: AverageFINAL object = new AverageFINAL(data); Try this: public class AverageFINAL { private int[] data; public AverageFINAL(int[] dataParam) { data = dataParam; } etc.
has comment: http://stackoverflow.com/comment/43345561
type: Answer
has comment: http://stackoverflow.com/comment/43345945
has comment: http://stackoverflow.com/comment/43345736
answers question: http://stackoverflow.com/q/27453577
has comment: http://stackoverflow.com/comment/43345644

http://stackoverflow.com/q/27411475
tagged with: twitter-bootstrap
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html
has title: giving each file a proper html5 tag based on MIME type to be displayed in an html+bootstrap template
tagged with: css
score: 3
has answer: http://stackoverflow.com/a/28973874
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/44219645
has body: I created a web server in java that basically list all the files on a device. I want to create a cool, responsive UI using bootstrap to display those files on the client's browser; however, I know that just creating an link to each file won't get me anywhere. Here is some code before I continue: for (File f : files.toArray(new File[files.size()])) { filesAsLinks += "" + f.getPath() + "" + " "; } I am thinking to create a Handler that is responsible for giving the file that it receives a proper html5 tag. For example: Handler.handle (String path) { Path source = new Path(source); String contentType = Files.probeContentType(source); // last two lines to get the content type of a file if (contentType.startsWith("video")) { return "video width=\"320\" height=\"240\" controls> " + " "; } } Would that be the relatively right thing to do before even thinking about making a template with bootstrap, or should I make the template first? So far I have been replacing the generated links String with a simple html template that contains some placeholders like "ContentGoesHere" in the following template: " "+ " "+ " Max Server "+ " "+ " "+ " "+ " "+ " "+ " HTTP Server "+ " "+ " "+ " "+ " "+ " "+ " Menu "+ " Files "+ " Messages "+ " Contacts "+ " Settings "+ " Info"+ " "+ " "+ " ContentGoesHere"+ " "+ " "+ " "+ " "+ " " "+ " "+ " "+ " "+ " "; The final result string (template+content) is written to the client's socket output stream and sent to the client.
type: Question
downvote count: 0
answer count: 1
favorite count: 0

http://stackoverflow.com/a/27485237
has body: I managed to resolve the issue. For some reason using the xpath to retrieve all the p tags was not working so instead I used the div id that was one level higher up (parent of the div class=padder): private static final String CUSTOMER_DETAILS = "yourDetails"; this allowed me to retrieve all the elements containing text until the closing div Your details MR Test Test Selly Road London GBR TR02XZ then I used this method to construct the address: // return all text in a list and build into a string public String returnAddress(By element) { String[] addressSplit = driver.findElement(element).getText().split("\n"); StringBuilder str = new StringBuilder(); for (int addressLength = 2; addressLength <= addressSplit.length - 1; addressLength++) { str.append(addressSplit[addressLength] + "\n"); } return str.toString().trim(); } // this calls the method above public String customerAddressIsPresent() { return returnAddress(By.id(CUSTOMER_DETAILS)); }
score: 0
answers question: http://stackoverflow.com/q/27363908
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27363908
type: Answer

http://stackoverflow.com/q/27454749
possible better answer: http://stackoverflow.com/a/27463326
tagged with: geometry
has answer: http://stackoverflow.com/a/27463326
tagged with: collision
type: AnsweredQuestion
has body: I'm trying to implement a collision detection algorithm (limit-cycle method) in a society of insects (roaches) with one obstacle (for the moment), for this the obstacle (in red) is encircled with a circle of influence (in green), here I shall calculate the coordinates of each roach once an intersection is detected between the 'roach' and the 'circle of influence' and immediately once there is an intersection the roach stops it's movement, in my code, some roaches seem to stop moving before even there is any intersection! And I can't see why.. I have provided the main code and the intersection method, I can't see where does the problem comes from.. I hope someone can spot what I couldn't.. [App shot:] https://www.dropbox.com/s/z0rtf8vxe37617u/Colliding%20Roaches.png?dl=0 So here's the main code: public void run() { Roach r = null; //Roach is a class while(true){ for (int i = 0; i &lt; roachs.size(); i++){ r = (Roach) roachs.get(i); if (r.toMove) r.move(); //---------------------- COLLISION AVOIDANCE ---------------------------------------- if(doesIntersects(r, cercleInfluence)){ //System.out.println("Intersection detected."); r.toMove = false; } //----------------------------------------------------------------------------------- } repaint(); try{ Thread.sleep(10); } catch(InterruptedException exc){} } } And here is the code of doesIntersects method: public boolean doesIntersects(Roach r, Ellipse2D.Double sh) { Area circ1, circ2, shape; circ1 = new Area(r.getBounds()); circ2 = new Area(sh); shape=circ1; shape.intersect(circ2); return (!shape.isEmpty());// isEmpty =&gt; no intersection! } Thanks all! EDIT: here is the code of the getBounds method from the class Roach: public Ellipse2D.Double getBounds() { return new Ellipse2D.Double(coordinates.x, coordinates.y, 10., 10. ); }
tagged with: detection
tagged with: java
has answer: http://stackoverflow.com/a/27462896
type: Question
has comment: http://stackoverflow.com/comment/43354687
score: 0
answer count: 2
has title: How accurate is "intersect" method?
accepted answer: http://stackoverflow.com/a/27462896

http://stackoverflow.com/q/27409768
answer count: 1
tagged with: macos
favorite count: 0
has comment: http://stackoverflow.com/comment/43263885
upvote count: 2
has title: OSX: ant in Eclipse doesn't find mvn - but works in terminal
tagged with: maven
has body: i just tried to execute mvn from an ant task vor the first time. It doesn't work. I tried to fix this problem by this .profile file in ~: export JAVA_HOME=$(/usr/libexec/java_home) export M2_HOME=/usr/local/Cellar/maven/3.2.3/ PATH=$PATH:$JAVA_HOME/bin:$M2_HOME/bin export PATH but still i get this error: BUILD FAILED /.../build.xml:13: Execute failed: java.io.IOException: Cannot run program "mvn": error=2, No such file or directory i can run java and maven from the terminal, mvn --version: Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-11T22:58:10+02:00) Maven home: /usr/local/Cellar/maven/3.2.3/libexec Java version: 1.8.0_25, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre Default locale: de_DE, platform encoding: UTF-8 OS name: "mac os x", version: "10.9.5", arch: "x86_64", family: "mac" ------------ echo $JAVA_HOME /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home ------------ echo $M2_HOME /usr/local/Cellar/maven/3.2.3/
has answer: http://stackoverflow.com/a/28045067
has comment: http://stackoverflow.com/comment/43263995
type: AnsweredQuestion
score: 2
linked to: http://stackoverflow.com/q/7581156
tagged with: java
tagged with: eclipse
linked to: http://stackoverflow.com/q/25385934
type: Question
tagged with: ant
downvote count: 0
accepted answer: http://stackoverflow.com/a/28045067
has comment: http://stackoverflow.com/comment/43263890
has comment: http://stackoverflow.com/comment/43263997

http://stackoverflow.com/comment/43179229
type: Comment
has text: Well, according to the edit page, your answer was already updated.
score: 0
comment on: http://stackoverflow.com/a/27363452
type: AnswerComment

http://stackoverflow.com/q/27335371
has title: How Do I Convert Test Scores into an array?
tagged with: file
has answer: http://stackoverflow.com/a/27335446
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43128486
tagged with: arrays
has comment: http://stackoverflow.com/comment/43146432
has comment: http://stackoverflow.com/comment/43127860
score: 0
has body: I am tasked with creating a program that reads a .txt file of numbers, determines the size of the array, reopens the .txt file, and fills the array with the file's contents. I'm looking for a solution that only uses "import java.util.* ; import java.io.* ;" to read the file and build the array with no other types of imports. That is to say, keep it simple for me. I don't know enough Java to make use of anything fancy. I'm not supposed to use a fixed size for the array. The size has to be determined by the number of numbers in the file. I may be able to use an Arraylist somehow, but I don't have the skill to guarantee success. Most of the issue here is that I have very little skill. That's why I need the solution to be as dumbed down as possible. The full details of the assignment: A local high school is giving a standardized test to all of its students. There are 50 questions on the test and the school would like you to gather some statistics on how the students performed. Scores can range anywhere from 0 to 50. All the scores are stored in a file (scores.txt) that you will need to download. Input the data from the file and store the data into an array. To do this, you will have to have your program open the data file, count the number of elements in the file, close the file, initialize your array, reopen the file and load the data into the array. Then calculate and output the following statistics: average score, the mode of the scores, and the highest/lowest score. In addition, output a list of the scores and the number of students that received each score. (Hint: you may need to use additional arrays to store information.) Your program should be written using methods and should be well documented internally and externally. Your output should be displayed using Message boxes. The contents of my main method so far: int size, index = 0; int[] testscores; String input, output; input = JOptionPane.showInputDialog("Insert filename including extension."); File scores = n…
tagged with: io
has comment: http://stackoverflow.com/comment/43145254
has comment: http://stackoverflow.com/comment/43145439
has comment: http://stackoverflow.com/comment/43145908
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43145732
has answer: http://stackoverflow.com/a/27335443
has comment: http://stackoverflow.com/comment/43145308
has comment: http://stackoverflow.com/comment/43145808
has comment: http://stackoverflow.com/comment/43145956
tagged with: java

http://stackoverflow.com/q/27400907
type: Question
tagged with: gwt
accepted answer: http://stackoverflow.com/a/27421109
answer count: 1
tagged with: gwt-validation
has answer: http://stackoverflow.com/a/27421109
linked to: http://stackoverflow.com/q/9789870
has title: Gwt Client Validation with editor and request factory
tagged with: gwt-editors
type: AnsweredQuestion
has body: I had a problems with GWT Client Validation used with RequestFactory and Editors. The edit code is : LocalityRequest localityContext = //create Request Locality locality = //Locality Entity Proxy loaded from the server driver.edit(locality, localityContext); //Edit the proxy request = localityContext.updateLocality(locality); And the save code is : this.localityContext = (LocalityRequest) driver.flush(); //Flush the request Set&lt;ConstraintViolation&lt;LocalityProxy&gt;&gt; violations = validator.validate(this.locality); //Local validate the object if (!violations.isEmpty()) { Set&lt;ConstraintViolation&lt;?&gt;&gt; sets = new HashSet&lt;ConstraintViolation&lt;?&gt;&gt;(violations); driver.setConstraintViolations(sets); editLocalityView.setErrors(sets); //give errors to the editors return; } localityContext.fire(); //else send the request My problems is that the local validation always validate on the loaded version and not the edited by user version. How can we get the flushed object saved in the request ? thanks
score: 0
tagged with: java
tagged with: requestfactory

http://stackoverflow.com/q/27468925
favorite count: 0
possible better answer: http://stackoverflow.com/a/27468991
upvote count: 3
has body: I have confuse of execution the next code : label: for (int i = 0; i &lt; 100; i++) { if (i % 2 == 0) continue; if (i == 99) { continue label; } System.out.println("i = " + i); } I was hope that this cycle is infinite. But no. When value is 99 - programm was exit. I try to play with continue and break operators but still haven't expected result. I just try understand why this cycle is not infinite and what i gonna do to make it? Output : i = 1 i = 3 ...... i = 93 i = 95 i = 97 Process finished with exit code 0
has answer: http://stackoverflow.com/a/27468952
has title: Unnecessary label on continue/break
type: AnsweredQuestion
score: 3
tagged with: java
tagged with: loops
has answer: http://stackoverflow.com/a/27468962
type: Question
accepted answer: http://stackoverflow.com/a/27468952
has answer: http://stackoverflow.com/a/27468964
downvote count: 0
has answer: http://stackoverflow.com/a/27468991
has comment: http://stackoverflow.com/comment/43373122
answer count: 4

http://stackoverflow.com/comment/43161241
comment on: http://stackoverflow.com/q/27353954
type: Comment
type: QuestionComment
score: 0
has text: Why don't I get any errors if I remove the try-catch? you mean during runtime or compile time?

ndef
tags question: http://stackoverflow.com/q/27361775
tag name: ndef
type: Tag
tags question: http://stackoverflow.com/q/27403288

http://stackoverflow.com/comment/43104890
has text: You should provide web.xml to be complete and what you mean by error (check in console - server returned error or browser did not want to connect at all). Guys, show minimum effort please!
comment on: http://stackoverflow.com/q/27322818
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27334637
has body: I've having a tough time getting a basic jsp file to render in my browser. I had it working fine, but then I tried to make a header.jsp and a footer.jsp file to include in my student.jsp file. When I abstracted this out is when I began to have issues. I am very new to Spring MVC, so patience is appreciated :) The error I get when I go to: localhost:8080/myprojectStudentCourses/student From the console is: Dec 06, 2014 12:52:37 PM org.springframework.web.servlet.PageNotFound noHandlerFound WARNING: No mapping found for HTTP request with URI [/myprojectStudentCourses/WEB-INF/jsp/student.jsp] in DispatcherServlet with name 'myprojectStudentCourses' myproject-servlet.xml <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <context:component-scan base-package="com.myproject" /> <property name="prefix" value="/WEB-INF/jsp/" /> <property name="suffix" value=".jsp" /> </beans> web.xml <?xml version="1.0" encoding="UTF-8"?> myproject Student Courses myprojectStudentCourses org.springframework.web.servlet.DispatcherServlet 1 myprojectStudentCourses /* myprojectStudentCourses *.jsp student.jsp <%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%> <%@include file="header.jsp" %> <form:form method="POST" action="/myprojectStudentCourses/addStudent"> <form:label path="name">Name</form:label> <form:input path="name" /> <form:label path="age">Age</form:label> <form:input path="age" /> <form:label path="id">id</form:label> <form:input path="id" /> </form:form> <%@include file="footer.jsp" %> Controller package com.myproject; import org.springframework.stereotype.Controller; import org.springframework.…
duplicate of: http://stackoverflow.com/q/41577234
tagged with: spring
has comment: http://stackoverflow.com/comment/43126384
type: UnansweredQuestion
type: Question
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/27334743
has title: Spring: No mapping found for HTTP request with URI
has comment: http://stackoverflow.com/comment/43126363
has comment: http://stackoverflow.com/comment/43126426
tagged with: java
tagged with: servlets
score: 0
linked to: http://stackoverflow.com/q/41577234
answer count: 1
tagged with: jsp

http://stackoverflow.com/q/27415805
tagged with: sqlite
possible better answer: http://stackoverflow.com/a/27415924
tagged with: android
has answer: http://stackoverflow.com/a/27415924
has comment: http://stackoverflow.com/comment/43275549
has title: Android SQLite CREATE TABLE Syntax Error
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27415884
tagged with: java
type: Question
tagged with: syntax-error
answer count: 2
has body: I'm getting the following error when I execute SQL in my app: android.database.sqlite.SQLiteException: near "(": syntax error (code 1): , while compiling: CREATE TABLE IF NOT EXISTS data (id int auto_increment primary key, data_type int default 0, data float not null, time timestamp default now()); Code causing error: @Override public void onCreate(SQLiteDatabase db){ db.execSQL("CREATE TABLE IF NOT EXISTS " + DATA_TABLE + " (id int auto_increment primary key, data_type int default 0, data float not null, time timestamp default now());"); } LogCat 12-11 00:13:55.431 22335-22335/com.shockdoc.ama.shockdoc E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.shockdoc.ama.shockdoc, PID: 22335 android.database.sqlite.SQLiteException: near "(": syntax error (code 1): , while compiling: CREATE TABLE IF NOT EXISTS data (_id int auto_increment primary key, data_type int default 0, data float not null, time timestamp default now()); at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1113) at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:690) at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588) at android.database.sqlite.SQLiteProgram.&lt;init&gt;(SQLiteProgram.java:58) at android.database.sqlite.SQLiteStatement.&lt;init&gt;(SQLiteStatement.java:31) at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1788) at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1719) at com.shockdoc.ama.shockdoc.DB.onCreate(DB.java:57) at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:252) at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:164) at com.shockdoc.ama.shockdoc.DB.saveStat(DB.java:31) at com.shockdoc.ama.shockdoc.MainActivity.onSensorChanged(MainActivity.java:99) at android.hardware.SystemSensorManager$SensorEventQu…
has answer: http://stackoverflow.com/a/27415884
score: 0

gmt
tags question: http://stackoverflow.com/q/27379130
tag name: gmt
type: Tag

http://stackoverflow.com/comment/43189547
has text: What errors are you getting? Have you debugged your code? What is your question?
type: QuestionComment
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27368856

http://stackoverflow.com/q/27404471
score: 6
type: Question
has body: dependency for my test program is org.fusesource.sigar and I have also added sigar-1.6.4.jar in my classpath. I understand that adding sigar-amd64-winnt.dll to my classpath might help, the question is where do I find this file? I have searched and even tried to download it without any success. Your assistance will be greatly appreciated in this regard org.hyperic.sigar.SigarException: no sigar-amd64-winnt.dll in java.library.path at org.hyperic.sigar.Sigar.loadLibrary(Sigar.java:172) at org.hyperic.sigar.Sigar.&lt;clinit&gt;(Sigar.java:100) at org.hyperic.sigar.win32.Win32.&lt;clinit&gt;(Win32.java:29) at com.mycompany.testadobeinstalled.TestAdobe.main(TestAdobe.java:28) Exception in thread "main" java.lang.UnsatisfiedLinkError: org.hyperic.sigar.win32.RegistryKey.RegOpenKey(JLjava/lang/String;)J at org.hyperic.sigar.win32.RegistryKey.RegOpenKey(Native Method) at org.hyperic.sigar.win32.RegistryKey.openSubKey(RegistryKey.java:221) at com.mycompany.testadobeinstalled.TestAdobe.main(TestAdobe.java:28)
tagged with: java
upvote count: 6
has answer: http://stackoverflow.com/a/28640684
answer count: 2
has answer: http://stackoverflow.com/a/57974375
favorite count: 0
type: UnansweredQuestion
tagged with: windows
has title: org.hyperic.sigar.SigarException: no sigar-amd64-winnt.dll in java.library.path
downvote count: 0

http://stackoverflow.com/comment/43276906
type: QuestionComment
has text: I am making a service call from index.html (for example) which creates the txt file using the above code, now, I want the output.txt file to be in the same folder as my index.html page
comment on: http://stackoverflow.com/q/27416650
score: 0
type: Comment

http://stackoverflow.com/q/27449347
tagged with: user-interface
has comment: http://stackoverflow.com/comment/43341151
answer count: 0
favorite count: 0
has title: Can a RadioButton replace the title in a TitledBorder in Swing?
type: Question
has comment: http://stackoverflow.com/comment/43337654
has comment: http://stackoverflow.com/comment/43339959
tagged with: java
has comment: http://stackoverflow.com/comment/43339531
tagged with: swing
downvote count: 1
has comment: http://stackoverflow.com/comment/43337454
has comment: http://stackoverflow.com/comment/43339768
has body: Is it possible to create a TitledBorder with a RadioButton instead of the "title" string? It would be just like a standard TitledBorder, but rather than having a string represent the box encompassed by the border, I'd like to use a radio button instead. For instance, in the example above, I'd like have a radio button in place of the string, "Titled Border".
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43339742
has comment: http://stackoverflow.com/comment/43337409
upvote count: 4
has comment: http://stackoverflow.com/comment/43341440
tagged with: radio-button
score: 3

http://stackoverflow.com/q/27451497
type: Question
has answer: http://stackoverflow.com/a/27452026
answer count: 2
has body: I have file where every line represents vertice. (format for example- 1.0 0.0 vertice A) My task is to create method public void read(InputStream is) throws IOException Which would save X and Y values of vertices and then label of it "vertice A". I have no idea how to parse it properly: public void read(InputStream is) throws IOException { try { Reader r = new InputStreamReader(is); BufferedReader br = new BufferedReader(r); while(br.readLine()!=null){ //something } } catch(IOException ex){ ex.printStackTrace(); } } also I need to create method public void read(File file) throws IOException which makes exactly the same but with file instead of stream. Can you tell me difference between these two methods?
possible better answer: http://stackoverflow.com/a/27451554
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/27451554
accepted answer: http://stackoverflow.com/a/27452026
favorite count: 0
has title: Read data from file using Java
tagged with: input
upvote count: 1
type: AnsweredQuestion
tagged with: java
tagged with: file

codahale-metrics
tag name: codahale-metrics
tags question: http://stackoverflow.com/q/27431327
type: Tag

http://stackoverflow.com/q/27416327
favorite count: 0
score: 50
has answer: http://stackoverflow.com/a/77010753
possible better answer: http://stackoverflow.com/a/59118383
has answer: http://stackoverflow.com/a/70555275
has body: .yml file cassandra: keyspaceApp:junit solr: keyspaceApp:xyz Bean @Component @ConfigurationProperties(prefix="cassandra") public class CassandraClientNew { @Value("${keyspaceApp:@null}") private String keyspaceApp; Main method file @EnableAutoConfiguration @ComponentScan @PropertySource("application.yml") public class CommonDataApplication { public static void main(String[] args) { ConfigurableApplicationContext context = new SpringApplicationBuilder(CommonDataApplication.class) .web(false).headless(true).main(CommonDataApplication.class).run(args); } } TestCase @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = CommonDataApplication.class) @IntegrationTest @EnableConfigurationProperties public class CassandraClientTest { @Autowired CassandraClientNew cassandraClientNew; @Test public void test(){ cassandraClientNew.getSession(); System.out.println(" **** done ****"); } } Instead of setting junit as the keyspaceApp it sets xyz. Looks like prefix="cassandra" not working
has answer: http://stackoverflow.com/a/59118383
tagged with: spring
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/70207449
has title: @ConfigurationProperties prefix not working
has answer: http://stackoverflow.com/a/27749036
type: Question
tagged with: spring-boot
has answer: http://stackoverflow.com/a/27417079
has comment: http://stackoverflow.com/comment/43317440
accepted answer: http://stackoverflow.com/a/27749036
upvote count: 50
downvote count: 0
answer count: 7
has answer: http://stackoverflow.com/a/72296913

http://stackoverflow.com/comment/43332747
has text: "Always" is such a big word. :)
score: 0
comment on: http://stackoverflow.com/q/27438412
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27439463
tagged with: jsp
tagged with: jquery
has comment: http://stackoverflow.com/comment/43324974
has comment: http://stackoverflow.com/comment/43319101
answer count: 1
has comment: http://stackoverflow.com/comment/43320110
has body: My requirement is I have one data table on the JSP page in which one column is student and values are link there. If user click on link then pop up should open and provide the student details. In popup I need to maintain look and feel like my other pages ( css etc ) so this means I cannot open normal default windows popup. When I am loading the jsp using load function of jQuery. Jsp is calling only once so when my trying to fetching the dynamic content next time then previous value is showing on popup $jScript("#DetailPopUpContainer").load('../admin/DetailPopUp', function() { $jScript(this).dialog({ autoOpen: true, //height:540, width:680, //loadUrl: 'http://xyz/admin/popup', position: [250, 150], modal: true, cache: false }); Please help.
has comment: http://stackoverflow.com/comment/43320401
score: 0
has comment: http://stackoverflow.com/comment/43319341
has answer: http://stackoverflow.com/a/27439890
has title: JSP pop up showing previous / old values
tagged with: jakarta-ee
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27439890
has comment: http://stackoverflow.com/comment/43320255
tagged with: java
type: Question

http://stackoverflow.com/a/27318698
answers question: http://stackoverflow.com/q/27318354
type: Answer
upvote count: 2
score: 2
has body: You are just creating a instance of GUImain in you Main class. You should either make it visible or run the main method of GUImain. Try adding the line, frame.setVisible(true); to the end of the constructor of GUImain. And you can remove window.frame.setVisible(true); from the main method. This will fix the problem. But this is not a good way of doing this.
accepted answer of: http://stackoverflow.com/q/27318354
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27333831
answers question: http://stackoverflow.com/q/27333582
has body: I had this problem with using a project on Windows and Linux. Go to Window->Preferences->Java->Build Path->Classpath Variables Click "New", pick a name, like MY_PROJECT, and point to the project folder. When you include jar files, you do it a different way. Project Properties->Java Build Path->Libraries (where you add jar files) To add, click "Add Variable" Select the MY_PROJECT variable you made and click "Extend". Find the resource and add it to your project. Now when anyone wants to use your project, they just have to do step 1 and 2. and point the MY_PROJECT classpath variable to where ever the folder is. It can be anywhere. As long as the structure inside is the same, everything works. This is how I share .project files with GIT. You can clone the project anywhere but everything works.
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27333582

http://stackoverflow.com/comment/43269105
score: 2
type: Comment
type: QuestionComment
has text: It's a **very bad idea** to pass arguments to be displayed in the next view as part of the query string. I recommend you using forwarding instead.
comment on: http://stackoverflow.com/q/27412367

http://stackoverflow.com/a/27347880
has comment: http://stackoverflow.com/comment/43150628
downvote count: 0
type: Answer
has body: Either you damage something in the persistent JS context which then violates the optimizer's assumptions, or this is a flat-out bug. That stack trace shows that your code went to invoke a method and the code path within the scripting runtime managed to reach a spot where an optimized version of the function is about to be applied to arguments which do not match its assumptions (its argument type filters) so it fails with this exception. That code path should never be followed in a consistent runtime, regardless of your JS code.
answers question: http://stackoverflow.com/q/27347644
upvote count: 1
score: 1

http://stackoverflow.com/comment/43209613
score: 0
type: Comment
has text: @PreethiJain Then you need to get all the rows for T1=value, then compare each column value with your other values for each row.
comment on: http://stackoverflow.com/a/27379877
type: AnswerComment

http://stackoverflow.com/comment/43165458
comment on: http://stackoverflow.com/a/27332325
has text: I think this might help you http://sandipchitale.blogspot.ie/2010/05/linearlayout-gravity-and-layoutgravity.html
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27374242
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Double quotes (\") are required if your path contains whitespaces: list.add("\"C:\\Program Files (x86)\\TightVNC\\tvnserver.exe\" -controlservice -connect 172.20.242.187");
upvote count: 2
answers question: http://stackoverflow.com/q/27374195
has comment: http://stackoverflow.com/comment/43198905
score: 2
accepted answer of: http://stackoverflow.com/q/27374195

http://stackoverflow.com/a/27456257
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27406143
type: Answer
answers question: http://stackoverflow.com/q/27406143
has body: (I figured it out, it was my ignorance of how maven handles src/main/resources and the manifest file) Maven creates a proper MANIFEST.MF file inside META-INF/ and uses it as the default convention path for a manifest, there is no need to create another one inside the src/main/resources folder, the default should be in the root. If you remove the MANIFEST from src/main/resources (which would be copied to WEB-INF/classes/META-INF/MANIFEST.MF) you will have only one and will be able to access the META-INF/MANIFEST.MF from the application using: request.getServletContext().getResourceAsStream( "/META-INF/MANIFEST.MF" );

http://stackoverflow.com/a/27419843
score: 2
has body: If you are interested in using Mocks to test the code, that means that you are going for unit-testing rather than integration-tests. Unit-testing a controller usually implies validation of incoming RequestParams / PathParams, assuring that the service is called or if the response is as it should. So in your case, a simple unit-test would imply using Mockito or PowerMock to mock the TestService and verify that the calls to it are made accordingly and that which is returned by the service is ok. Check out Mockito's reference page http://docs.mockito.googlecode.com/hg/org/mockito/Mockito.html it has some great examples.
downvote count: 0
answers question: http://stackoverflow.com/q/27419645
type: Answer
upvote count: 2

http://stackoverflow.com/q/27413999
has title: Hibernate not saving into mapping table in ManyToMany
has comment: http://stackoverflow.com/comment/43273075
has answer: http://stackoverflow.com/a/27416895
type: UnansweredQuestion
tagged with: spring
linked to: http://stackoverflow.com/q/12552714
tagged with: spring-mvc
has body: I'm fairly new to hibernate and I'm trying to save data into a Student table and joining table which holds a composite key of the student and a related student skills table. I'm using spring MVC and a farm to populate this data. I feel I am incorrectly mapping either in the form or in hibernate but I'm unsure where I've gone wrong. Form: First name: Last name: Date of birth: Mobile num: Select skills: Java C++ C# .NET Python Ruby Country: City: Street: Postal code: Student class: @Entity public class Student { @Id @GeneratedValue private int studentID; private String studentFname; @Size(min=5, max=8) @Pattern(regexp="[a-z]*") private String studentLname; @Embedded private Address studentAddress; @Past private Date studentDOB; private Long studentMobile; @ManyToMany(cascade = CascadeType.ALL) private Set<StudentActivities> studentActivities = new HashSet<StudentActivities>(); } StudentActivities class: @Entity @Table(name="student_skills") public class StudentActivities { @Id @GeneratedValue private int skill_id; private String skill_name; } Here is how I'm saving it in a controller class: @RequestMapping(value = "/submitAdmissionForm", method = RequestMethod.POST) public ModelAndView submitAdmissionForm(@Valid @ModelAttribute("student1") Student student1, BindingResult result) { ModelAndView model; if(result.hasErrors()) model = new ModelAndView("AdmissionForm"); else { SessionFactory sessionFactory = new AnnotationConfiguration().configure().buildSessionFactory(); Session session = sessionFactory.openSession(); session.beginTransaction(); session.save(student1); session.getTransaction().commit(); session.close(); sessionFactory.close(); model = new ModelAndView("AdmissionSuccess"); } return model; } So it currently saves all the data into the student table but not into my 'Student_student_skills' table. The 'student_skills' table already has data in it so I'm not entirely sure if it's even worth having the StudentActivities class since I'm not actually wanting to i…
has comment: http://stackoverflow.com/comment/43272939
tagged with: java
tagged with: hibernate
type: Question
answer count: 1
score: 0

http://stackoverflow.com/comment/43358000
comment on: http://stackoverflow.com/a/27447597
has text: @almasshaikh why should i change it into != ? i think i want to find the node which isn't null that's why i use == or did i miss something or i got it wrong?please explain..thanks
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27461385
type: Question
upvote count: 4
has answer: http://stackoverflow.com/a/27472174
answer count: 2
tagged with: continuous-integration
downvote count: 0
score: 4
has answer: http://stackoverflow.com/a/27474168
has body: I'm working on setting up a build on jenkins. The distribution is Centos 7 x64, Using sbt 0.13.7 and Play framework 2.3.6(if that has any relevance). Java 8 is installed properly: bash-4.2$ java -version java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode) SBT has, what I assume, a proper config to compile to Java 8. javacOptions ++= Seq("-source", "1.8", "-target", "1.8", "-Xlint") And still I get this error during sbt compile [info] Compiling 13 Scala sources and 18 Java sources to /var/lib/jenkins/workspace/super-webapp/target/scala-2.10/classes... [error] javac: invalid source release: 1.8 [error] Usage: javac &lt;options&gt; &lt;source files&gt; I'm no linux expert, so is there anything I need to be aware environment related to get this working?
favorite count: 0
tagged with: jenkins
type: UnansweredQuestion
tagged with: sbt
tagged with: java
has title: Invalid source release: 1.8 on jenkins in SBT

http://stackoverflow.com/comment/43339531
has text: No, borders aren't interactive. What's the [actual goal](http://meta.stackexchange.com/q/66377)?
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27449347

jersey
tags question: http://stackoverflow.com/q/27392224
tags question: http://stackoverflow.com/q/27422793
tags question: http://stackoverflow.com/q/27356918
tags question: http://stackoverflow.com/q/27431979
tags question: http://stackoverflow.com/q/27370685
tags question: http://stackoverflow.com/q/27437447
tags question: http://stackoverflow.com/q/27354019
tags question: http://stackoverflow.com/q/27341788
tags question: http://stackoverflow.com/q/27340202
tags question: http://stackoverflow.com/q/27389629
tags question: http://stackoverflow.com/q/27472303
tags question: http://stackoverflow.com/q/27357394
tags question: http://stackoverflow.com/q/27341572
tags question: http://stackoverflow.com/q/27317608
tag name: jersey
tags question: http://stackoverflow.com/q/27437566
tags question: http://stackoverflow.com/q/27384859
tags question: http://stackoverflow.com/q/27354648
tags question: http://stackoverflow.com/q/27430052
tags question: http://stackoverflow.com/q/27467330
tags question: http://stackoverflow.com/q/27361590
tags question: http://stackoverflow.com/q/27402466
tags question: http://stackoverflow.com/q/27409808
tags question: http://stackoverflow.com/q/27469880
tags question: http://stackoverflow.com/q/27427429
type: Tag
tags question: http://stackoverflow.com/q/27471292

http://stackoverflow.com/comment/43349381
type: QuestionComment
comment on: http://stackoverflow.com/q/27455733
score: 0
has text: Can you show the definition/allocation of `points`? This might well be correct, but it's impossible to tell without seeing the actual size. For example, `points` could be 5 vertices with 4 components each, with each component 4 bytes (float). So 5 * 4 * 4 would be the correct size in bytes.
type: Comment

http://stackoverflow.com/q/27463802
answer count: 1
favorite count: 0
tagged with: android
has title: libGDX: Removing Iterator after specific time
downvote count: 0
type: UnansweredQuestion
tagged with: libgdx
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27473349
type: Question
has body: Following https://github.com/libgdx/libgdx/wiki/Extending%20the%20Simple%20Game How can I make it so that the iter.remove(); will happen every second more or less? I mean, from the moment a new iter appear the program will count a second more or less and call iter.remove();. Here is the code from the link that use the Iterator: Iterator&lt;Rectangle&gt; iter = raindrops.iterator(); while (iter.hasNext()) { Rectangle raindrop = iter.next(); raindrop.y -= 200 * Gdx.graphics.getDeltaTime(); if (raindrop.y + 64 &lt; 0) iter.remove(); if (raindrop.overlaps(bucket)) { dropsGathered++; dropSound.play(); iter.remove(); } } By the way, can I use the same solution to create a seconds stopper? At the moment I created a stopper to my game, 60 seconds game time. For the stopper to work I basically created an int stopper = 60; and as long that the game run the number will decrement by 1. Problem is it decrement too fast! Timer method: decreaseTime(int minus){ // timer is equal to 60 timer -= minus; }
upvote count: 1

http://stackoverflow.com/a/27339727
upvote count: 5
type: Answer
has body: If the problem is indeed a System.exit() call in the third-party class, you should be able to work around it by following the recommendation in this answer, which provides the following code: private static class ExitTrappedException extends SecurityException { } private static void forbidSystemExitCall() { final SecurityManager securityManager = new SecurityManager() { public void checkPermission( Permission permission ) { if( "exitVM".equals( permission.getName() ) ) { throw new ExitTrappedException() ; } } } ; System.setSecurityManager( securityManager ) ; } private static void enableSystemExitCall() { System.setSecurityManager( null ) ; } However, for your purposes it would likely be a better approach to simply spawn a separate Java process for the third-party application and wait for it to terminate. That way you don't have to worry about the third-party code causing side-effects in your JVM instance, or about trying to guess at how to get rid of the side-effects.
score: 5
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27339684
answers question: http://stackoverflow.com/q/27339684
downvote count: 0

http://stackoverflow.com/q/27320210
has comment: http://stackoverflow.com/comment/43099750
has title: Is there a more terse way to accomplish this?
has body: Is there a more terse way to accomplish this? private boolean fieldLockExists(String tableName, String fieldName, Integer id) { List&lt;MpFieldLocks&gt; fieldLocks = getFieldLocks(tableName, id); boolean exists = false; for (MpFieldLocks fieldLock: fieldLocks) { if (Objects.equals(fieldLock.getFieldName(), fieldName)) { exists = true; break; } } return exists; } I know I could return from within the for loop to make it shorter. I'm looking for a more fundamental change, if possible. In C# I might use LINQ. In Java, I'm not sure.
has answer: http://stackoverflow.com/a/27320323
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43099705
tagged with: java
has comment: http://stackoverflow.com/comment/43099638
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43099674
score: 0
has answer: http://stackoverflow.com/a/27320277

http://stackoverflow.com/comment/43255446
score: 0
comment on: http://stackoverflow.com/a/27405303
has text: It's a shorthand for `double[] dim`, saves you from instantiating an array when you call the method. Hopefully I didn't put any syntax errors in the code, I wrote it here directly.
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27431385
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
score: 1
tagged with: java
upvote count: 1
type: Question
has title: Adding HTML Link to Spring RedirectAttribute Messages
has answer: http://stackoverflow.com/a/27431699
has body: We would like to add a html clickable link to an informational message (Spring RediractAttribute/Flash Message) after an end user successfully submits a form on our website. So, the end would see the following (flash) messages: Success Object updated. Information Remember to Edit Attribute. Where Edit Attribute would be a clickable link in the end user's browser. What we are having a difficult time reconciling is where does the code go to create the link html text? We don't feel as though there should be any html in our messages.properties file and we do not feel as though there should be any html generation in our controller. Here is our controller code: public ModelAndView processSubmit(@Valid ObjectCommand command, BindingResult bindingResult, RedirectAttributes redirectAttributes, HttpServletRequest request) { if (bindingResult.hasErrors()) { return new ModelAndView("/form.html"); } else { // Command Object successfully send to service to update database as needed. // First Flash Message (the success message from above). redirectAttributes.addFlashAttribute("successMessage", "Object updated."); // Second Flash Message (The informational message from above urging the user to go update something else too. String informationMessage = this.getInformationMessage(request, object); redirectAttributes.addFlashAttribute("infoMessage", informationMessage); return new ModelAndView("redirect:/object.html"); } } private String getInformationMessage(Request request, Object object) { // THIS CODE HERE, FEELS SLIMY. String editUrl = "Remember to Edit Attribute"; } Then here is our jsp tag code to display both the information messages: <%@tag body-content="empty"%> <%@ include file="/WEB-INF/views/html/common/include.jsp" %> <%@ attribute name="message" required="true" type="java.lang.String" %> <c:if test="${not empty message}"> Information: ${message} </c:if> Any friendly advice on how to get the clickable link in our information message would be greatly appreciated.
tagged with: spring-messaging
tagged with: flash-message
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/43368969
comment on: http://stackoverflow.com/a/27465463
score: 0
type: AnswerComment
type: Comment
has text: If somebody works less than 40 hours, he get paid regular" Pay = Hours * Rate);

http://stackoverflow.com/a/27383195
score: 7
has body: How can I then parse that date to LocalDateTime? You can't - LocalDateTime represents a date and time that does not have an associated timezone at all. If you have a timestamp that is anchored to a timezone (UTC in this case) then you should be using DateTime instead of LocalDateTime.
accepted answer of: http://stackoverflow.com/q/27383103
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27383103
type: Answer
has comment: http://stackoverflow.com/comment/43215104
upvote count: 7

http://stackoverflow.com/comment/43245775
has text: this is the sample to show how "static" works. you have only one bankValault. so you always get same value
comment on: http://stackoverflow.com/q/27400300
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43228245
type: Comment
has text: @frenchDolphin provide the relevant code to replicate the problem. Otherwise, nobody could help you.
type: AnswerComment
comment on: http://stackoverflow.com/a/27389938
score: 0

http://stackoverflow.com/a/27414594
upvote count: 1
downvote count: 0
has body: Unless quotas are enabled, you can go upto the max of what is available on your filesystem. du -s reports the disk usage for the entire directory. I prefer the "du -sh /home/xxxx" which should report it in Mbytes, Kbytes etc., df -k (I prefer df -h) says how much free space is available on the entire disk (or volume) on which the filesystem is present. Note that this may include the home directories of all users. If quotas are enabled, then you can use quota -v to see what your quotas are on each filesystem. Looks like what you are trying to do is: take the 3 fields from the first file print out the lines from the second file with a ",Y" ending if it (the 3 fields in the second file) is also found in the first file. or print out the lines from the second file with a ",N" ending if it (the 3 fields in the second file) is not present in the first file. I wonder if you are using the same name for the output file as your input file. You do not say what the value of the outFile variable is in your pb. If you are trying to read and write from the same file, then the output will indeed be indeterminable. If you are trying to get all common lines from files file1, file2, file3, file4, then i would use something like: ProcessBuilder pb = new ProcessBuilder("bash", "-c", " awk -f awkfile " + " file2 " + file1); p = pb.start(); p.waitFor(); p.destroy(); // rename the outFile to something different. eg. outfile2. File of= new File("outFile"); File of2= new File("outFile2"); of.renameTo(of2); pb = new ProcessBuilder("bash", "-c", " awk -f awkfile " + " file3 " + "outFile2"); p = pb.start(); p.waitFor(); p.destroy(); // rename the outFile to something different. eg. outfile2. again. of= new File("outFile"); of2= new File("outFile2"); of.renameTo(of2); pb = new ProcessBuilder("bash", "-c", " awk -f awkfile " + " file4 " + "outFile2"); p = pb.start(); p.waitFor(); p.destroy();
type: Answer
score: 1
answers question: http://stackoverflow.com/q/27414163

http://stackoverflow.com/comment/43135836
has text: @user2456977 see my response - I've added an ~easy way to do it. Just create an array, then look through the buttons.
comment on: http://stackoverflow.com/a/27339659
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/52008704
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/31289731
has text: I'm in a fragment and the problem is to turn it off, turn on is ok
type: Comment

http://stackoverflow.com/comment/43216071
score: 0
type: Comment
type: QuestionComment
has text: sorry, i updated the question
comment on: http://stackoverflow.com/q/27383550

http://stackoverflow.com/comment/43195943
has text: I used this "java SalesRep arg0 arg1 arg2 arg3 arg4" for NetBeans. Is it right?
comment on: http://stackoverflow.com/a/27372371
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27411780
has title: Forwarding Client Authentication From LoginServer To GameServer Securely
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/27415746
tagged with: client
has body: The simple architecture and summary of dilemma: Entry Point: Client successfully authenticates itself to a singleton LoginServer (via TCP the connection supplies valid username+password). LoginServer is the only Server with access to the salted login database. LoginServer intelligently selects a single GameServer from a list of GameServer(s) to assign this Client. After being assigned to a GameServer, Client will send I/O requests to said GameServer exclusively, which will be processed internally by nature of game design. Dilemma: GameServer contains no data of Client and is unaware of the "handshake" that took place between LoginServer and Client. GameServer is incapable of putting the piece of authentication from LoginServer to the appropriately mapped Client ... because what does it have to work with? Potential Solution: After successfully authenticating with LoginServer, Client is given a unique token to validate itself with GameServer(s). Side note: I'm assuming using anything IP-based is a security concern due to potential IP spoofing.
linked to: http://stackoverflow.com/q/5435068
type: UnansweredQuestion
tagged with: authentication
type: Question
tagged with: network-programming
tagged with: server
tagged with: java
linked to: http://stackoverflow.com/q/3804209
linked to: http://stackoverflow.com/q/328

http://stackoverflow.com/a/27416409
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27415852
has body: Try with this... Declare as Global Variable Map&lt;String, String&gt; myLatLongHashMap = new HashMap&lt;String, String&gt;(); int k = 0; Assign Hashmap values myLatLongHashMap.put("lat" + k, latvalue); myLatLongHashMap.put("long" + k, longvalue); myLatLongHashMap.put("TAG_Speed" + k, TAG_Speed_value+""); k++; Retrieve Hashmap values if (myLatLongHashMap.size() &gt; 0) { for (int i = 0; i &lt; myLatLongHashMap.size() / 3; i++) { // retrieve your lat, long value.. Double lat = Double.valueOf(myLatLongHashMap.get("lat" + i)); Double longg = Double.valueOf(myLatLongHashMap.get("long" + i)); String speed = myLatLongHashMap.get("TAG_Speed" + i); } }
downvote count: 0
type: Answer

http://stackoverflow.com/comment/43148140
comment on: http://stackoverflow.com/a/27346083
score: 0
type: Comment
type: AnswerComment
has text: I think your way is much, better and I'll look into doing it your way when I make some improvements, for now its working with the reset. Thanks.

http://stackoverflow.com/a/27342743
has body: I too have had troubles like this before. If all else fails, extend FrameLayout in your own class and get the height/width values in the onMeasure method. Example: @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int height = MeasureSpec.getSize(heightMeasureSpec); } Easy to put it in you XML layout too with something like: &lt;com.yourdomain.yourappname.FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" &gt; ...
has comment: http://stackoverflow.com/comment/43141368
has comment: http://stackoverflow.com/comment/43141767
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43141651
has comment: http://stackoverflow.com/comment/43141419
has comment: http://stackoverflow.com/comment/43141509
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27342571
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27342571
has comment: http://stackoverflow.com/comment/43141189
type: Answer

http://stackoverflow.com/a/27392004
type: Answer
answers question: http://stackoverflow.com/q/27391960
score: 0
has body: If you want to store, for example, 10 items, you could do it one of two (or many other) ways.... Store the items sequentially in memory, like a normal array. The advantage is it's very quick to reach any offset (multiply the data size by the offset), but the size is not flexible. If you then want 11 items, it's not simple to place it at the end (that memory may be something else important). Store them in different parts of memory, but have each item know where to find the next (and sometimes the previous). This means you don't need to know a size up front, but it means reaching any offset means the chain of links must be followed. This is known as a linked list.

http://stackoverflow.com/q/27424673
type: Question
score: 0
answer count: 1
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/27424989
has body: I have a TabPane which contains two Tabs and is set up in FXML. On initialization I dynamically add an AnchorPane to one of the Tabs. I then set a ListView as a child of the AnchorPane: AnchorPane questionPane = new AnchorPane(); questionPane.setId("questionPane"); ListView questionList = new ListView(); questionPane.getChildren().add(questionList); This works perfectly fine. For debugging purposes I gave the AnchorPane an orange background (via CSS) and when I now resize the window, the AnchorPane get's resized as expected. But as soon as I add the following line to the code, the AnchorPane can only grow and doesn't shrink anymore, resulting in outsizing my window: questionList.prefWidthProperty().bind(questionPane.widthProperty()); Can anyone please explain, why this line breaks the resizing of the AnchorPane?
has title: Binding prefWidthProperty of ListView to widthProperty of containing AnchorPane breaks resizing of AnchorPane
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27424989
tagged with: fxml

http://stackoverflow.com/comment/43148719
comment on: http://stackoverflow.com/q/27346888
has text: Ah, misread the problem statement, I thought the last code was the one that worked.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27467542
downvote count: 0
answers question: http://stackoverflow.com/q/27467236
score: 4
type: Answer
upvote count: 4
has body: But isn't ArrayList only capable of holding one type of value? How can my array hold an integer, a string and a float? No, it's definitely not. Before Generics were introduced ArrayList was capable of holding any value type and different types at the same time. And what may be funny after generics were introduced it's still the same. Why? Because generics are only compile time and are removed at runtime - see Type Erasure. And because groovy as is JVM language it behaves as in your example.

http://stackoverflow.com/comment/43301461
type: Comment
comment on: http://stackoverflow.com/a/27421705
has text: Thanks for your explanation. "But, t1.start(); creates a new Thread and returns." this statement clears my doubt actually. If calling start method just "spawns a new thread and returns" then things fall to logic but else I assume that only once t1.start() completes, JVM will execute t2.start() and in that case it does not seem to be multi threading.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43370101
comment on: http://stackoverflow.com/a/27466860
type: Comment
has text: The best thing to do is to bail out. It is OK to catch the OOME and try to produce a helpful error message. But you *should* then bail out!
score: 0
type: AnswerComment

http://stackoverflow.com/q/27347189
score: 0
answer count: 1
tagged with: combobox
has title: Remove Duplicated Items JComboBox
has body: what is best way to check for duplicate items in JComboBox and remove them? This is not really answered in Java anywhere from what i have researched. Basically when i refresh my JComboBox with the observer pattern it duplicates items, on update. I have tried going down the route of removing all of the items and putting them back in but this causes issues when amending item info(it would take a long time to explain in full). public void setCustomers() { for (Customer curr : Main.getNewCustomerList().getCustomers()) { customerCombo.addItem(curr); } } public void setDetails() { Customer selected = (Customer) customerCombo.getSelectedItem(); if(selected != null) { forenameText.setText(selected.getForename()); surnameText.setText(selected.getSurname()); costperkgText.setText(String.valueOf(selected.getDeliveryCost())); line1Text.setText(String.valueOf(selected.getColAddress().getAddressLine1())); line2Text.setText(String.valueOf(selected.getColAddress().getAddressLine2())); cityText.setText(String.valueOf(selected.getColAddress().getCity())); postcodeText.setText(String.valueOf(selected.getColAddress().getPostcode())); } else { ClearText(); } } public void ammendDetails() { Customer selected = (Customer) customerCombo.getSelectedItem(); if(selected != null) { selected.setForename(forenameText.getText()); selected.setSurname(surnameText.getText()); System.out.print(costperkgText.getText()); selected.setDeliveryCost(Double.valueOf(costperkgText.getText())); Address newAddress = new Address(line1Text.getText(), line2Text.getText(), cityText.getText(), postcodeText.getText()); selected.setColAddress(newAddress); } else { ClearText(); } } public void ClearText() { forenameText.setText(""); surnameText.setText(""); costperkgText.setText(""); line1Text.setText(""); line2Text.setText(""); cityText.setText(""); postcodeText.setText(""); } @Override public void update() { setCustomers(); }
type: UnansweredQuestion
tagged with: swing
tagged with: java
tagged with: duplicates
tagged with: observer-pattern
type: Question
has answer: http://stackoverflow.com/a/27347305

http://stackoverflow.com/comment/43350158
type: QuestionComment
comment on: http://stackoverflow.com/q/27453400
has text: @PeterNiederwieser please post as an answer to give you the points. I'll check about it tomorrow morning. Greetings
score: 0
type: Comment

increment
tags question: http://stackoverflow.com/q/27451435
type: Tag
tag name: increment
tags question: http://stackoverflow.com/q/27345987
tags question: http://stackoverflow.com/q/27411856

http://stackoverflow.com/a/27403345
has body: public static void main(String[] args) { int num = 85; int limit = 5; int index = 0; int extra = 0; int finalArrayIndex = 0; int[] innerArray = null; int[] input = new int[num]; boolean isEnd = false; if (num % limit &gt; 0) { extra = 1; } int[][] finalArray = new int[(num / limit) + extra][limit]; for (int i = 0; i &lt; input.length; i = i + (limit)) { innerArray = new int[limit]; for (int j = 0; j &lt; limit; j++) { innerArray[j] = input[index++]; if (index &gt;= input.length) { isEnd = true; break; } } finalArray[finalArrayIndex++] = innerArray; if (isEnd) { break; } } // just for test for (int k = 0; k &lt; finalArray.length; k++) { for (int l = 0; l &lt; finalArray[k].length; l++) { System.out.println("finalArray[" + k + "]" + "[" + l + "] : " + finalArray[k][l]); } } } This is dynamic solution, you can change value of num and limit variables. I hope this will help you :) Java Fiddle link : http://ideone.com/jI8IOb
answers question: http://stackoverflow.com/q/27401933
score: 0
type: Answer

http://stackoverflow.com/comment/43208111
type: Comment
type: AnswerComment
has text: Ok I see the problem. In the class ExecutionContext is where I must define the serialVersionUID. Thanks you.
score: 0
comment on: http://stackoverflow.com/a/27375303

http://stackoverflow.com/a/27433938
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27433696
has comment: http://stackoverflow.com/comment/43325437
answers question: http://stackoverflow.com/q/27433696
type: Answer
score: 2
downvote count: 0
has body: The main issue is that your Guitar interface hides exactly the details that your factory needs to use to choose the appropriate GuitarTuningService implementation. One way to approach the problem would be to implement the Visitor pattern, a.k.a. double dispatch. The Guitar interface would get the following method: public void accept(GuitarVisitor visitor); Each Guitar implementation would, separately, implement the method the same way: public void accept(GuitarVisitor visitor) { visitor.visit(this); } The GuitarVisitor interface would look like this: public interface GuitarVisitor { public void visit(Fender guitar); public void visit(Gibson guitar); // other Guitar types as necessary } An implementation of GuitarVisitor performs the appropriate guitar-type specific behavior in each method. For example, the GuitarTuningServiceFactory could use an inner GuitarVisitor implementation to select the appropriate GuitarTuningService for each provided guitar. You cannot avoid a cast (though you can avoid type-safety warnings by performing it via Class.cast()), but you can safely perform it just once at the beginning of each tune() method, recording the downcast reference. The main drawback of the Visitor pattern is that it locks in the possible types of the specific visited classes. You can add a catch-all method to partially mitigate that (public void visit(Guitar guitar)).
has comment: http://stackoverflow.com/comment/43309736
has comment: http://stackoverflow.com/comment/43333071
upvote count: 2
has comment: http://stackoverflow.com/comment/43329459

http://stackoverflow.com/comment/43343037
type: Comment
has text: Now I have to copy that code and make it read in strings instead of Integers. Do you know how i could do that? I keep getting this error:
type: AnswerComment
comment on: http://stackoverflow.com/a/27452006
score: 0

http://stackoverflow.com/q/27353954
has answer: http://stackoverflow.com/a/27354147
linked to: http://stackoverflow.com/q/6546193
has comment: http://stackoverflow.com/comment/43161238
tagged with: java
has title: Scheduled task never throws exceptions
tagged with: runtimeexception
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43161300
tagged with: runnable
accepted answer: http://stackoverflow.com/a/27354147
type: Question
has body: This question can be seen as a whole in here. Though the linked post explains this issue, you should not think of it as a duplicate: it asks a different question and has an accepted answer for this different question. Though the question can be read in the other post, I'll explain it here as well: I'm developing a snake-like game that can be played with AIs, and is intended for that purpose. All such AIs should extend an abstract class called SnakeLogic. All such AIs should also reside in their standalone .jar archives in a specific folder, from where the main program can find them and list them using classloaders. The user can then choose one of his/her AIs from a list, should all stars fall in line, and play a game with this AI. Now, I have a method in my main program that gets the next move from the AI like so: public void startGame(int speed) { gameInterface.showWindow(); Runnable moveCmd = () -&gt; { try { for (Player player : snakeGame.getPlayers()) { if (player.isDead()) { continue; } String move = player.getLogicHandler().getMove(); Direction direction = Direction.directionFromString(move); snakeGame.makeMove(player, direction); } gameInterface.getFrame().repaint(); snakeGame.wait(speed); if (snakeGame.gameOver()) { stopGame(); } } catch (Exception ex) { ex.printStackTrace(); stopGame(); } }; /* moveSchedule is an instance of ScheduledExecutorService */ moveSchedule.scheduleAtFixedRate(moveCmd, 1000, speed, TimeUnit.MILLISECONDS); } I'm not going to get too involved with the code above. I'd like to draw your attention to the try-catch statement, however. As you can see I print the stacktrace and end the game, should an exception occur somewhere during the execution of the moveCmd runnable. If I don't print the stacktrace like this, or if I remove the try-catch entirely, I never get any errors in the case of a runtime exception during the execution of that block. Why? Is it because it's wrapped inside a runnable? Note also that the line snakeGame.makeMove(pla…
has comment: http://stackoverflow.com/comment/43161241
linked to: http://stackoverflow.com/q/27353558
score: 0
tagged with: error-handling
tagged with: stack-trace
answer count: 1
has comment: http://stackoverflow.com/comment/43161288

http://stackoverflow.com/q/27321970
answer count: 2
has body: Right now I have a Spring based RESTful web-app. I'm very new to REST and so I followed some tutorials online. I built my web.xml, my rest-servlet.xml that uses the component-scan tag and loads up my RestController class which uses the @RestController annotation. (All of the code is posted below) My issue is that none of these tutorials show me how to inject beans into my controller via an ApplicationContext.xml. I've found ways to inject using annotations, but I really want to use xml configuration. In my example below I have three database clients that I want to be wired in with the RestController when it starts up. Any suggestions on how to load the ApplicationContext.xml on startup so that my RestController servlet receives the correct instances of the database clients? web.xml rest org.springframework.web.servlet.DispatcherServlet 1 rest /* rest-servlet.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd"> <context:component-scan base-package="com.helloworld.example" /> <mvc:annotation-driven /> RestController.java package com.helloworld.example; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/service/greeting") public class…
has title: Injecting properties into Spring Rest Controller via XML
downvote count: 0
tagged with: applicationcontext
has answer: http://stackoverflow.com/a/27322064
favorite count: 0
tagged with: rest
tagged with: spring
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
score: 2
has answer: http://stackoverflow.com/a/27322701
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/27322064
possible better answer: http://stackoverflow.com/a/27322701
type: Question

http://stackoverflow.com/comment/43308819
comment on: http://stackoverflow.com/q/27433837
score: 0
type: Comment
type: QuestionComment
has text: You're probably trying to call this method on FragmentTransaction class which won't work since it's not a static method. You should call it on an instance of FragmentTransaction. Posting the code will help to figure out the problem.

http://stackoverflow.com/comment/43192821
comment on: http://stackoverflow.com/q/27346355
has text: suggestion: check if your opencv is built with ffmpeg support.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27325024
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27326648
has title: FileWritingMessageHandler (int-file:outbound-channel-adapter) is slow for single-file storing multiple-messages use case
tagged with: spring
accepted answer: http://stackoverflow.com/a/27326648
score: 2
type: AnsweredQuestion
tagged with: spring-integration
upvote count: 2
tagged with: java
tagged with: log4j2
type: Question
has body: I'm using Spring 4.1.2 with Spring Integration 4.1.0. I have a use case where I'd like to produce a single file that will contain a row for each message that flowed to a channel. Messages received are all of type String. This file is a nice-to-have file, meaning it's not necessary to have the writing to this file be within the same transaction of the master flow. So an async wire-tap pattern could be implemented for the use-case. Any messages written to that file however need to be in the same order that they originally were received in (so either 1 thread would need to process them or would need an aggregator to wait for multiple threads to complete then would write them in the original order). I wanted to get a feel for what would be the most performant way to handle this use-case so I tried a few tests. To make it a bit easier my tests are not using an async wire-tap (but this was mentioned in the use-case because perhaps some suggestions might involve batching/buffering solutions). The general flow came from the "Define an integration flow" section of this link: https://spring.io/guides/gs/integration/ The main options I tried were: Use int-file:outbound-channel-adapter (which creates a FileWritingMessageHandler) along with a transformer that appends a newline to each message (transformer uses SpEL expression payload + '#{systemProperties['line.separator']}. spring.expression.compiler.mode=OFF Use int-file:outbound-channel-adapter (which creates a FileWritingMessageHandler) along with a transformer that appends a newline to each message (transformer uses SpEL expression payload.toString() + '#{systemProperties['line.separator']}. spring.expression.compiler.mode=MIXED NOTE: Using payload.toString() rather than payload to get around SpEL issue: https://jira.spring.io/browse/SPR-12514 Use int:logging-channel-adapter rather than int-file:outbound-channel-adapter (saving on having to use a transformer with a SpEL expression). Tested with Log4J2 using RollingRandomAcc…
linked to: http://stackoverflow.com/q/27171978
tagged with: spring-el

http://stackoverflow.com/a/27317157
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/27317066
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27317066
has body: There's no need for the outer loop, it only runs once and you don't use i anyway. why do you have it? For the inner loop, you need to compare against the minimum value. Right now you are comparing it against the first element in the array, which is not necessarily the minimum value. min = arr[0]; for (j=0; j &lt; arr.length; j++) { if (arr[j] &lt; min) { //&lt;---fix is here min = arr[j]; } } Also you could start the loop at 1, since you don't need to compare arr[0] against itself (it was just assigned to min)

http://stackoverflow.com/comment/43181657
type: Comment
has text: Just out of curiosity, how many jumps (ifs) would one need to be slower than the double division with integer conversation? Or am I overestimating the cost of double divisions?
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27363701

http://stackoverflow.com/comment/43376563
has text: No, it's not. I have a different Manifest file (which I'll add in a sec).
comment on: http://stackoverflow.com/q/27470845
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/27314083
has title: Is there a Java/JUnit version of NUnit annotation [TestFixture]
answer count: 1
tagged with: junit
favorite count: 0
upvote count: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43088382
has comment: http://stackoverflow.com/comment/43094945
tagged with: java
has body: I am starting to write WebDriver tests in Java having previously used C#/NUnit. I notice in any examples I have seen there is no Java version of the C# NUnit annotation for [TestFixture]. Is there such a thing in Java?
type: Question
tagged with: c#
has answer: http://stackoverflow.com/a/27321410
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43088861
tagged with: nunit
accepted answer: http://stackoverflow.com/a/27321410

http://stackoverflow.com/comment/43373197
comment on: http://stackoverflow.com/q/27455310
type: Comment
type: QuestionComment
has text: http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/math/Vector2.html Here you go. As you can see there is no getters. But libgdx is open source so you are free to add them.
score: 0

http://stackoverflow.com/a/27346762
answers question: http://stackoverflow.com/q/27344534
downvote count: 0
score: 4
has body: What it means is that , your code is compiled with different version of java to java version which is running it . make sure you compile and runt it with the same version if java.
type: Answer
upvote count: 4

http://stackoverflow.com/comment/43175810
type: Comment
comment on: http://stackoverflow.com/a/27361457
has text: @Name first things first: in your `Regiment` constructor, instead of doing `this.men = men`, you should call `addMen2(regNumber)` - this will initialize your regiment to its corresponding number of men, not 0.
type: AnswerComment
score: 0

http://stackoverflow.com/a/27414061
answers question: http://stackoverflow.com/q/27413667
has comment: http://stackoverflow.com/comment/43278850
has comment: http://stackoverflow.com/comment/43273343
has body: Well, here is a shorter version: public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); System.out.println("Player 1 please enter the word"); String word = keyboard.next(); for (int i = 0; i &lt; NUM_OF_TRIES; i++) { System.out.println("Enter your guess please"); String guess = keyboard.next(); int index = word.indexOf(guess.charAt(0)); if (index == -1) System.out.println("Sorry not letter " + guess.charAt(0)); else System.out.println(" at position " + (index + 1)); } System.out.println("Enter your last guess: "); String wordComp = keyboard.next(); if (wordComp.equals(word)) System.out.println("You got it!"); else System.out.println("Sorry you lost!"); }
score: 0
type: Answer

http://stackoverflow.com/comment/43330495
comment on: http://stackoverflow.com/a/27441701
type: Comment
has text: If you want something to map to `/*`, then you need to remove your servlet context mapping to `/api/*` and everything should work. Your REST controllers should define their own mappings to `/api/whatever`.
score: 0
type: AnswerComment

http://stackoverflow.com/a/27365308
upvote count: 5
has comment: http://stackoverflow.com/comment/69520104
type: AcceptedAnswer
score: 4
type: Answer
has comment: http://stackoverflow.com/comment/43258379
has body: Unfortunately DropWizard currently doesn't support this natively. See this lively discussion for more information. Fortunately there's a workaround if you're willing to forego configuring logging with DropWizard all together. Somewhere in your run method call the following code to reset the logging and reconfigure it using sfl4j's standard mechanism: LoggerContext context = (LoggerContext)LoggerFactory.getILoggerFactory(); context.reset(); ContextInitializer initializer = new ContextInitializer(context); initializer.autoConfig(); Then you can configure logging by adding logback.xml to your classpath and configuring it something like this: /var/log/applicationname-request.log false %-5relative %-5level %logger{35} - %msg%n /var/log/applicationame-response.log false %-5relative %-5level %logger{35} - %msg%n %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n <level value="DEBUG" /> <appender-ref ref="REQUEST" /> <level value="DEBUG" /> <appender-ref ref="RESPONSE" /> <appender-ref ref="STDOUT" /> Then you can grab those corresponding loggers in your resource and log away: static final Logger REQUEST_LOG = LoggerFactory.getLogger("org.example.request"); static final Logger RESPONSE_LOG = LoggerFactory.getLogger("org.example.response");
accepted answer of: http://stackoverflow.com/q/27356918
has comment: http://stackoverflow.com/comment/43239208
downvote count: 1
answers question: http://stackoverflow.com/q/27356918

http://stackoverflow.com/q/27398861
possible better answer: http://stackoverflow.com/a/27398904
has answer: http://stackoverflow.com/a/27398909
score: 0
accepted answer: http://stackoverflow.com/a/27398907
has title: Unable to find why a particular code line is showing error
answer count: 4
tagged with: reference
has body: package morepackage; public class Exampleclass { String s = "myname"; public static void main( ) { Object [] a = new Object[10]; a[1] = new Exampleclass(); System.out.println( a[1] );//this is working System.out.println( a[1].s);//**this is not working** Exampleclass t = new Exampleclass(); System.out.println(t);//this is working System.out.println(t.s);//this is working } } Some of the above lines in the code are working and others are not can anyone please explain why the line "System.out.println( a[1].s);" is showing error.
has answer: http://stackoverflow.com/a/27398907
has comment: http://stackoverflow.com/comment/43243246
type: AnsweredQuestion
tagged with: object
has comment: http://stackoverflow.com/comment/43243215
has answer: http://stackoverflow.com/a/27399313
has answer: http://stackoverflow.com/a/27398904
tagged with: java
type: Question

http://stackoverflow.com/comment/43236187
type: QuestionComment
comment on: http://stackoverflow.com/q/27390209
type: Comment
has text: Read the javadoc, of getOut() and see this FAQ: http://camel.apache.org/using-getin-or-getout-methods-on-exchange.html
score: 0

http://stackoverflow.com/comment/43151715
has text: what language? please add the appropriate tag to your question
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27348551
type: Comment

http://stackoverflow.com/comment/43153702
type: Comment
has text: That should be fine, it's a grid of one width and height so every board[i] will have the same width.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27349585

http://stackoverflow.com/q/27361052
has answer: http://stackoverflow.com/a/47999564
has answer: http://stackoverflow.com/a/76005490
has answer: http://stackoverflow.com/a/36469245
has comment: http://stackoverflow.com/comment/43281341
has answer: http://stackoverflow.com/a/63082627
tagged with: flume
tagged with: log4j2
tagged with: logging
tagged with: flume-ng
type: Question
score: 14
has answer: http://stackoverflow.com/a/36024178
tagged with: java
has comment: http://stackoverflow.com/comment/56213295
has comment: http://stackoverflow.com/comment/56202654
downvote count: 0
answer count: 7
linked to: http://stackoverflow.com/q/75996306
favorite count: 0
has title: failing to load log4j2 while running fatjar
type: UnansweredQuestion
has body: i am working on a project where i utilize log4j2 logging. while developing in intellij, all works fine and the logging is done as expected. the log4j2.xml is linked through java property passed to jvm on startup via intellij settings. but once i try to run a standalone gradle built fat-jar, i'm experiencing the following problems: java -Dlog4j.debug=true -Dlog4j.configurationFile=/home/aaa/log4j2.xml -jar /home/aaa/myjar-SNAPSHOT.jar exceptions: ERROR StatusLogger Unrecognized format specifier [d] ERROR StatusLogger Unrecognized conversion specifier [d] starting at position 16 in conversion pattern. ERROR StatusLogger Unrecognized format specifier [thread] ERROR StatusLogger Unrecognized conversion specifier [thread] starting at position 25 in conversion pattern. ... ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console. i don't even understand where those [thread]s come from, since i get the same error even while using a basic simplest config in my log4j2: &lt;?xml version="1.0" encoding="UTF-8" ?&gt;&lt;Configuration status="WARN" monitorInterval="86400"&gt; &lt;Appenders&gt; &lt;Console name="console-log" target="SYSTEM_OUT"&gt; &lt;PatternLayout pattern="%-5p %d{yyyy-MM-dd HH:mm:ss.SSS} ${hostName} %c{1} %msg %throwable{7}%n"/&gt; &lt;/Console&gt; &lt;/Appenders&gt; &lt;Loggers&gt; &lt;Root level="info" additivity="false"&gt; &lt;AppenderRef ref="console-log"/&gt; &lt;/Root&gt; &lt;/Loggers&gt; any thoughts are welcome. thanks.
has answer: http://stackoverflow.com/a/42922674
has answer: http://stackoverflow.com/a/79141093
upvote count: 14

http://stackoverflow.com/comment/43111626
type: Comment
type: AnswerComment
has text: @user3058763: That's the content of my discussion with Charlie.
comment on: http://stackoverflow.com/a/27325475
score: 0

http://stackoverflow.com/a/27416808
has comment: http://stackoverflow.com/comment/43277165
has comment: http://stackoverflow.com/comment/43277592
has comment: http://stackoverflow.com/comment/43277264
score: -1
has comment: http://stackoverflow.com/comment/43287754
answers question: http://stackoverflow.com/q/27416699
has body: On local system if your file is in another directory except to current web directory You need to set full absolute path of file to download a file using href. Syntax is:- out.println(i+". &lt;a href='file:///"+f.getAbsolutePath()+"' &gt;"+f.getName()+"&lt;/a&gt;");
downvote count: 1
has comment: http://stackoverflow.com/comment/43277203
type: Answer
has comment: http://stackoverflow.com/comment/43277135
has comment: http://stackoverflow.com/comment/43293656
upvote count: 0
has comment: http://stackoverflow.com/comment/43277418
has comment: http://stackoverflow.com/comment/43279066
has comment: http://stackoverflow.com/comment/43279128

http://stackoverflow.com/a/27335468
downvote count: 0
score: 1
answers question: http://stackoverflow.com/q/27335415
has body: Instead of passing the audio file from activity to activity, have each activity read the file from disk (or from some sort of static cache, etc.) instead. There is a limit in how much information you can pass inside an activity intent's bundle extras, and the large size of the audio file is likely causing the application to crash.
upvote count: 1
has comment: http://stackoverflow.com/comment/43128311
type: Answer
has comment: http://stackoverflow.com/comment/43128463

http://stackoverflow.com/comment/43151452
comment on: http://stackoverflow.com/a/27348380
type: AnswerComment
score: 0
type: Comment
has text: interesting, im going to test this a bit more

http://stackoverflow.com/comment/43360654
has text: One way would be remove all the loggers and add just one simple logger that logs everything and a file appender. The existence of the log file will confirm the log4j.properties be read at runtime.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27449024
score: 0

http://stackoverflow.com/comment/43195766
type: Comment
comment on: http://stackoverflow.com/q/27363614
type: QuestionComment
has text: Agreed with @bkail. The character encoding parameter to InputStreamReader should be changed.
score: 0

http://stackoverflow.com/comment/43370445
has text: You will have to parse the HTML to find URLs for external resources. [Use the search](https://stackoverflow.com/search?q=%5Bjava%5D+parse+html).
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27467332

http://stackoverflow.com/q/27429509
has comment: http://stackoverflow.com/comment/43302394
score: 2
tagged with: spring-boot
has answer: http://stackoverflow.com/a/31872977
tagged with: java
has comment: http://stackoverflow.com/comment/43301813
tagged with: integration-testing
has body: Is it possible to load test specific properties when I run integration test. In this case keyspaceApp: test and when ran normally should load keyspaceApp: abc .yml file defaults: &amp;defaults cassandra: keyspaceApp: abc solr: keyspaceApp: xyz test: cassandra: keyspaceApp: test Integration Test @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = CommonDataApplication.class) @IntegrationTest @Profile("test") public class CassandraClientTest { @Autowired CassandraClientNew cassandraClientNew; @Test public void test(){ cassandraClientNew.getSession(); System.out.println(" **** done ****"); } } Main class @EnableAutoConfiguration @ComponentScan @PropertySource("classpath:application.yml") public class CommonDataApplication { public static void main(String[] args) { ConfigurableApplicationContext context = new SpringApplicationBuilder(CommonDataApplication.class) .web(false).headless(true).main(CommonDataApplication.class).run(args); } } Bean @Component @ConfigurationProperties(prefix="cassandra") public class CassandraClientNew { private Cluster cluster; private Session session; @Value("${cassandra.keyspaceApp:@null}") private String keyspaceApp;
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/27390085
answer count: 1
has comment: http://stackoverflow.com/comment/43317785
has title: Load test specific properties when run from integration test or default .yml
favorite count: 0
downvote count: 0
type: UnansweredQuestion
tagged with: spring

http://stackoverflow.com/q/27384829
has comment: http://stackoverflow.com/comment/43221427
has comment: http://stackoverflow.com/comment/43229510
has comment: http://stackoverflow.com/comment/43219704
type: Question
has body: I'm working on a program that will run through a list of +20,000 records of ID, last name, first name, middle name. Now, I have a working regex that pulled the records with an ID sequence and grouped them as well as pulled records with a infraction number sequence and grouped them. The difference between the two is that the latter has a 12 character sequence (3 chars and 9 digits as opposed to a 9 digit ID sequence). There is the obvious problem of validating the names, some have last names that are 3+ i.e. de la Cruz, Smith-Doe, or just really long names. The same problem appears for middle names, which are sometimes just middle initial followed by a dot, simply the middle initial (no period), or the actual middle name. I've created two classes to model the person objects, each with 4 fields (ID/tick num, lName, fName, mName). I want the regex to accurately group and store the 3 parts of a person's full name (as one person object which will be stored in a Vector) so I can later run a search against a person who is both the ticket list and ID list, to then store the matches in a separate list. My problem is with how to accurately capture valid names. Here's a look at the regex I used to pull the two groups (this was done in python but I'm assuming I can reuse the regex: '^([A-Z]{3}\d+)\s+([^\s]+([\D+])+)' --&gt; Ticket group '^(\d+)\s+([^\s]+([\D+])+)' ---&gt; ID group and here's a look at my ReadFile Class, which is meant to open and read the contents of the source file, storing the records as objects in people: public class ReadFile { private Scanner myScan; public void openFile(){ try{ // Scanner object will hold source list myScan = new Scanner(new File("C:\\source.txt")); } catch(Exception e){ System.out.println("Could not find file."); } } // readFile method will iterate through and store the contents of source list into people public void readFile() { Vector&lt;People&gt; people = new Vector&lt;People&gt;(); while(myScan.hasNext()){ People person = new People…
tagged with: regex
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/43221024
has answer: http://stackoverflow.com/a/27402830
has comment: http://stackoverflow.com/comment/43221897
type: UnansweredQuestion
has title: Java Regex to validate and capture ID and full name

http://stackoverflow.com/comment/43130756
comment on: http://stackoverflow.com/a/27335840
score: 0
type: AnswerComment
has text: then why don't you just declare your static class member "public static Scanner NAME;" THEN you initialize that variable in the main function try{ NAME=new Scanner(new File("names.txt")); }catch(Exception e){ } not a class constant but still a public class member.
type: Comment

http://stackoverflow.com/q/27449198
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/43337157
tagged with: android-intent
has answer: http://stackoverflow.com/a/27449351
type: AnsweredQuestion
tagged with: java
downvote count: 1
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/43337213
accepted answer: http://stackoverflow.com/a/27449351
has comment: http://stackoverflow.com/comment/43337137
score: -1
has title: How can i pass a Double[] array to another activity
linked to: http://stackoverflow.com/q/1109988
answer count: 1
tagged with: bundle
has comment: http://stackoverflow.com/comment/43337132
has body: Bundle object doesn't let me pass a Double[] array because it require a double[] array. i'm not able to cast double[] to Double[] and I don't know what to do. Help me please.

http://stackoverflow.com/q/27367514
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/44684754
tagged with: audio-recording
score: 2
tagged with: audio
answer count: 0
downvote count: 0
tagged with: java
has title: How do I made sure a RecordToSample correctly writes to a Sample in Java Beads?
type: Question
has body: I'm using the Beads Project audio library for Java. I'm trying to modify the 7th tutorial file to record its sound in non-realtime mode and write the sound to a file. I'm doing so by using the RecordToSample class. However, when I try to write the sample to a file, it doesn't look like the RecordToSample has actually written any data to the sample - the file that's written is just a few seconds of silence, based on the length of the buffer I initialized the sample with, not the length of the recording. This is what I have so far: public class Lesson07_RecordToSample { public static void main(String[] args) { final AudioContext ac; ac = new AudioContext(); /* * I added this code */ final Sample sample = new Sample(10000D); final RecordToSample recorder = new RecordToSample(ac, sample); Clock clock = new Clock(ac, 700); clock.addMessageListener( //this is the on-the-fly bead new Bead() { // snip /* * I added this code */ if(c.getCount() == 70) { Sample sample = recorder.getSample(); try { sample.write("audio/song.wav", AudioFileType.WAV); } catch (IOException e) { e.printStackTrace(); } ac.stop(); } } } ); ac.out.addDependent(clock); /* * I changed this line */ ac.runNonRealTime(); } public static float random(double x) { return (float)(Math.random() * x); } } This creates a new file at audio/song.wav, but this file just contains 10 seconds of silence. It looks to me that the recorder isn't actually changing any of the data in the sample, and when the sample is written, it just uses the 10000 ms of empty data I initialized it with. I've been looking through the Beads library's docs, and it doesn't look like there are any methods to the RecordToSample class that force the RecordToSample to push its data into its Sample. What is the proper way to make sure that the data I'm recording with the RecordToSample is correctly written to the Sample? Can you please provide a short code example?
has comment: http://stackoverflow.com/comment/43186890
upvote count: 2
favorite count: 0

http://stackoverflow.com/comment/43171537
has text: what's the RDBMS? most of the times the database manages concurrency and synchronization mechanism automatically by providing locks and etc. so when writing concurrent and multi threaded applications on database we have to consider that point also for optimizing the performence
comment on: http://stackoverflow.com/q/27358881
type: QuestionComment
type: Comment
score: 0

http://stackoverflow.com/a/28973874
type: Answer
has body: I know that just creating an link to each file wont get me anywhere Simply creating a link would work - it would open the video and the browser would handle the actual viewing of the file based off the mime-type of the file you are accessing. If, on the other hand, you want to display each item on the same page so you have a nice format and the files being shown (think YouTube or another site), then creating the html for the different elements would be correct. I would advise creating the html based off the file extension rather than off the mime-type. To your "which first" question, that is up to you. You can start with the template or the content within the template, depending on your work flow and what you are most comfortable with.
score: 0
answers question: http://stackoverflow.com/q/27411475

http://stackoverflow.com/q/27342892
tagged with: java
has answer: http://stackoverflow.com/a/27352664
accepted answer: http://stackoverflow.com/a/27352664
has comment: http://stackoverflow.com/comment/43141592
possible better answer: http://stackoverflow.com/a/27352772
type: Question
has comment: http://stackoverflow.com/comment/43145041
has title: how to dynamically load configuraiton file in spring
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27352772
has comment: http://stackoverflow.com/comment/43141475
has body: In a running spring app, could it monitor a folder under which I could put more configuration file in which more beans are defined? I don't want to stop the app, but want the ability to add load more beans, so I am thinking of create a folder, and then put bean definitions into that folder, and let spring to pick it up and initialize the beans. I am wondering whether it is doable or not
tagged with: spring
type: AnsweredQuestion

http://stackoverflow.com/q/27434782
linked to: http://stackoverflow.com/q/1944369
answer count: 1
favorite count: 0
has body: I finished developing my game today with Libgdx but I encountered a weird problem: I deployed my game to android but when I play the game on my device, if I press the back key, it closes the app but if I resume it by clicking on its icon, I have some serious bugs: the game art gets messy, the music is stopped, etc. But if I simply click the Home button during the game and then resumes, nothing happens! It's like when the back key is pressed, all the values (static values) are gone or something. Did someone else encountered this problem before? What should I do? For the record, I have a Values class which holds static members of all the important values in the game (character size, entities size, speed, etc). What should I do?
has answer: http://stackoverflow.com/a/33174564
type: UnansweredQuestion
tagged with: android
score: 0
upvote count: 1
downvote count: 1
type: Question
tagged with: exit
tagged with: libgdx
tagged with: java
has title: App gets messy on exitting in android - Libgdx

http://stackoverflow.com/comment/90975629
has text: Thank a lot! But, for jpeg images, setDestinationType doesn't work (with integrated ICC profile). param.setDestination(new BufferedImage(reader.getWidth(0), reader.getHeight(0), BufferedImage.TYPE_INT_ARGB)); do the job ;-)
score: 0
comment on: http://stackoverflow.com/a/27458294
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27427700
tagged with: button
has comment: http://stackoverflow.com/comment/43298791
has body: I'm new to Android programming and have been searching this problem for a day now and couldn't come up with a solution. Kindly help me in solving this small problem which is creating a big problem for me. The error is that when I press the login button in my MainActivity, the app says that unfortunately it has stopped working and the debug window shows an error "Source not found" and further it says ActivityThread.performLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 2249 I've seen similar posts related to this but those posts couldn't help me. Following my code. Manifest &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.firstapp" android:versionCode="1" android:versionName="1.0" &gt; &lt;uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /&gt; &lt;application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/Theme.Base.AppCompat.Light.DarkActionBar" &gt; &lt;activity android:name=".MainActivity" android:label="@string/title_activity_main" &gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; &lt;activity android:name=".Second" android:label="@string/title_activity_second" &gt; &lt;/activity&gt; &lt;activity android:name=".Registration" android:label="@string/title_activity_registration" &gt; &lt;/activity&gt; &lt;/application&gt; &lt;/manifest&gt; MainActivity.java public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Button button = (Button) findViewById(R.id.button_id); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent i = new Intent(MainActivity.this,Second.class)…
has answer: http://stackoverflow.com/a/27428749
has title: Source not found Error and App closes Abruptly
tagged with: android
has comment: http://stackoverflow.com/comment/43298775
has comment: http://stackoverflow.com/comment/43297856
accepted answer: http://stackoverflow.com/a/27428749
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27428285
has answer: http://stackoverflow.com/a/27428285
tagged with: android-intent
type: Question
has comment: http://stackoverflow.com/comment/43298524
has comment: http://stackoverflow.com/comment/43298601
tagged with: debugging
has comment: http://stackoverflow.com/comment/43297055
tagged with: java
has comment: http://stackoverflow.com/comment/43298662
has comment: http://stackoverflow.com/comment/43297445
score: 0
answer count: 2

cursor
tags question: http://stackoverflow.com/q/27419994
tags question: http://stackoverflow.com/q/27391886
type: Tag
tag name: cursor

http://stackoverflow.com/comment/43383488
comment on: http://stackoverflow.com/q/27474455
score: 0
type: Comment
type: QuestionComment
has text: posible duplicate http://stackoverflow.com/questions/27468382/error-with-loading-screen-assetmanager-libgdx-java

http://stackoverflow.com/comment/56538293
comment on: http://stackoverflow.com/a/27408999
has text: Your service should be listening well known port, as each container gets its own IP (at least in bridged networking) there is no port collision. If you need to have variable ports then you need a more heavy weight service discovery solution like zookeeper.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27405498
has answer: http://stackoverflow.com/a/27512440
has comment: http://stackoverflow.com/comment/43624977
has body: I've recently updated my Spring version from 3.2.4.RELEASE to 4.0.7.RELEASE and since then I'm getting this error while loading context. Please let me know if I'll have to make any changes to context xml after updating spring version. Here is the avengers-flow-context.xml: <?xml version="1.0" encoding="UTF-8"?> <beans:beans xmlns:int="http://www.springframework.org/schema/integration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:task="http://www.springframework.org/schema/task" xmlns:int-jmx="http://www.springframework.org/schema/integration/jmx" xmlns:oxm="http://www.springframework.org/schema/oxm" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd http://www.springframework.org/schema/integration/jmx http://www.springframework.org/schema/integration/jmx/spring-integration-jmx.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-1.5.xsd"> <beans:import resource="classpath*:/META-INF/spring/integration/avengers-properties-context.xml" /> <beans:import resource="classpath*:/META-INF/spring/integration/avengers-common-context.xml" /> <beans:import resource="classpath*:/META-INF/spring/integration/avengers-jms-context.xml" /> <beans:import resource="classpath*:/META-INF/spring/integration/avengers-jmx-context.xml" /> <beans:import resource="classpath*:/META-INF/spring/integration/avengers-saf-config.xml" /> <beans:import resource="classpath*:/META-INF/spring/integration/avengers-saf-jms-co…
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/27511564
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43289944
tagged with: spring
tagged with: nosuchmethoderror
linked to: http://stackoverflow.com/q/22087355
has comment: http://stackoverflow.com/comment/43626252
score: 2
tagged with: spring-4
tagged with: cxf
has answer: http://stackoverflow.com/a/27513936
has comment: http://stackoverflow.com/comment/43296852
tagged with: java
has title: Context initialization failed after updating Spring Version
type: Question
has answer: http://stackoverflow.com/a/27601268
has comment: http://stackoverflow.com/comment/43261548
downvote count: 0

http://stackoverflow.com/q/27318587
tagged with: file-io
linked to: http://stackoverflow.com/q/7679924
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/56644530
has title: How do I read the content of a file in Amazon S3
accepted answer: http://stackoverflow.com/a/27330752
type: Question
tagged with: amazon-s3
tagged with: java
answer count: 2
possible better answer: http://stackoverflow.com/a/52425523
has body: I have a file in Amazon S3 in bucket ABCD. I have 3 objects ("folderA/folderB/folderC/abcd.csv") which are folders and in the final folder I have a .csv file (abcd.csv). I have used a logic to convert it to JSON and load it back into another file which is a .txt file in the same folder ("folderA/folderB/folderC/abcd.txt"). I had to download the file locally in order to do that. How would I read the file directly and write it back to the text file. The code which I have used to write to a file in S3 is below and I need to read a file from S3. InputStream inputStream = new ByteArrayInputStream(json.getBytes(StandardCharsets.UTF_16)); ObjectMetadata metadata = new ObjectMetadata(); metadata.setContentLength(json.length()); PutObjectRequest request = new PutObjectRequest(bucketPut, filePut, inputStream, metadata); s3.putObject(request);
downvote count: 0
has answer: http://stackoverflow.com/a/52425523
tagged with: amazon-web-services
favorite count: 0
score: 8
has comment: http://stackoverflow.com/comment/56644488
upvote count: 8
has answer: http://stackoverflow.com/a/27330752

http://stackoverflow.com/a/38592145
has body: java.io.IOException: Packet len1397966893 is out of range! it said is very sure,your network packet is larger than the zk's default value so you should set JAVA_OPTS=" -Djute.maxbuffer=10000000 -Djava.awt.headless=true -Djava.net.preferIPv4Stack=true " to zk jvm,and your client application
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27416853

http://stackoverflow.com/comment/43226767
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27383172
has text: have you considered storing the metadata externally?

http://stackoverflow.com/comment/43223498
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27387066
has text: @jdv: don’t question the OP’s ability to provide the correct information. Whether Eclipse shows the Execution Environment for `JavaSE-1.8` does not depend on any locally installed JRE at all. Either it supports it, then it will be in the list, otherwise it doesn’t.

http://stackoverflow.com/a/27429869
score: 0
has comment: http://stackoverflow.com/comment/43489080
answers question: http://stackoverflow.com/q/27387999
has comment: http://stackoverflow.com/comment/43379749
type: Answer
has comment: http://stackoverflow.com/comment/43359098
has comment: http://stackoverflow.com/comment/43534791
has comment: http://stackoverflow.com/comment/43413945
has comment: http://stackoverflow.com/comment/43335172
has body: Set an Eclipse environment variable for HEROKU_API_KEY like in this answer (but with a different key name of course). The value of HEROKU_API_KEY should be whatever is printed when you run heroku auth:token The document in question has been miraculously updated with a complete description of this ;)

http://stackoverflow.com/a/27435239
has body: My guess is that it can not find the file since you didn't include the extension to the xml file. try add .xml to the end of the file path and see if that works
answers question: http://stackoverflow.com/q/27434486
has comment: http://stackoverflow.com/comment/43321165
score: 0
has comment: http://stackoverflow.com/comment/43311705
has comment: http://stackoverflow.com/comment/43311992
type: Answer

http://stackoverflow.com/comment/43205683
type: QuestionComment
has text: Have you checked whether `$wnd.$("#" + id)` is providing access to the field you need?
comment on: http://stackoverflow.com/q/27375857
score: 0
type: Comment

http://stackoverflow.com/a/27457759
type: Answer
answers question: http://stackoverflow.com/q/27454475
score: 1
upvote count: 1
has body: As other friends have previously mentioned you can create a Panel,add all the buttons in the panel and finally add scrollbar to the panel. here is my simple code that does the job: import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; public class ArrayOfButtons extends JFrame{ final static int numberOfButtons=5; // Label to display the message indicating which button generated the event. JLabel label=new JLabel(); // Panel to accomodate the labels JPanel panel=new JPanel(); //We create an array of buttons whose number depends on our choice JButton buttons[]=new JButton[numberOfButtons]; public ArrayOfButtons(){ super("Demo"); //We create an instance of the class ButtonHandler which implements the interface //ActionListener. And this object "handler" is basically the object that handles //the events. ButtonHandler handler=new ButtonHandler(); //Using a for loop we create JButtons. for(int i=0;i&lt;numberOfButtons;i++){ buttons[i]=new JButton("Button"+i); // here we register handler as the event listener for all the buttons.i.e if in // case an event occurs in any of the buttons, the event listener (in our case //the handler object) calls an appropriate method that handles the event. buttons[i].addActionListener(handler); // add each button to the panel panel.add(buttons[i]); } // we add the label to the JFrame add(label,BorderLayout.SOUTH); // we add ScrollPane to the JFrame and in turn add Panel to the ScrollPane. add(new JScrollPane(panel)); } // This is an inner class that handles the events.(Look more on inner classes). public class ButtonHandler implements ActionListener{ //This method is called in case an action event occurs.For example you click on the //button public void actionPerformed(ActionEvent event){ // gets the name of the button and displays in the label. label.s…
downvote count: 0

http://stackoverflow.com/q/27459304
accepted answer: http://stackoverflow.com/a/27461465
linked to: http://stackoverflow.com/q/3393649
type: AnsweredQuestion
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/43360152
tagged with: spring-data
type: Question
has comment: http://stackoverflow.com/comment/43358228
tagged with: jpa
answer count: 1
has comment: http://stackoverflow.com/comment/43356189
has answer: http://stackoverflow.com/a/27461465
has body: I have the following classes class Category { Long id; } class Question { Long id; @OneToOne (cascade=CascadeType.ALL) Category category; } class Test { Long id; Map&lt;Category, Long&gt; splitUp; } These are partial versions of the my classes, I have annotated the category and Quesiton classes but having trouble annotating the map "splitUp" in the Test Class. I would like some help in that.
score: 0
has title: Persisting a Map in JPA

http://stackoverflow.com/comment/43184479
has text: If that's the case then just adjust the findViewById calls as mentioned above.
type: Comment
comment on: http://stackoverflow.com/a/27365739
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43223843
has text: By current window, you mean the popped up window,right?
comment on: http://stackoverflow.com/a/27363332
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43219416
has text: String.split() and String.replaceAll() have parameters that are regex themselves. What I was trying to say is to use String.replaceAll() instead of String.split().
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27382193
type: QuestionComment

http://stackoverflow.com/q/27391218
has answer: http://stackoverflow.com/a/27391273
has title: Java - SocketException: Not a multicast address
downvote count: 0
answer count: 1
score: 1
favorite count: 0
tagged with: multicast
tagged with: sockets
accepted answer: http://stackoverflow.com/a/27391273
type: AnsweredQuestion
tagged with: java
upvote count: 1
has body: I have multiple servers on my network that all send out a broadcast message. With the following client I am trying to capture all the broadcast messages from all servers. The sending part works fine(not included in this post), but my receiving part doesn't work... I keep getting "SocketException: Not a multicast address", what am I doing wrong? public static String[] capture(int port) { // port is always 63332 ArrayList&lt;String&gt; clients = new ArrayList&lt;&gt;(); InetAddress address = Utilities.getBroadcastAddress(); // I get "/192.168.2.255" here MulticastSocket socket = null; try { socket = new MulticastSocket(port); socket.setSoTimeout(2000); socket.joinGroup(address); // this part throws the exception DatagramPacket packet; byte[] packetContent; while (true) { packetContent = new byte[1024]; packet = new DatagramPacket(packetContent, packetContent.length); try { socket.receive(packet); String client = packet.getAddress() + ":" + packet.getPort(); clients.add(client); } catch (IOException e) { e.printStackTrace(); } } } catch (SocketException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } if(socket != null) { try { socket.leaveGroup(address); } catch(IOException e) { e.printStackTrace(); } socket.close(); } return clients.toArray(new String[clients.size()]); }
type: Question
tagged with: datagram

http://stackoverflow.com/comment/43345419
score: 0
type: AnswerComment
type: Comment
has text: @JosephMüller Just remove the declaration of `lock` from `WorkerThread` and replace `wait()` and `executor.notify()` in your code with `lock.wait()` and `lock.notify()` respectively. The rule is that you `wait` and `notify` on the same object, and it has to happen within a `synchronized` block on that same object.
comment on: http://stackoverflow.com/a/27453185

http://stackoverflow.com/a/27391219
score: 0
answers question: http://stackoverflow.com/q/27375423
type: Answer
has body: I recommend you looking into JGroups. It is a Java based group communication toolkit. If you looking into the docs, you will see that you can add the required functionality by implementing the Protocol interface. It takes a bit to get used to it, but the documentation is excellent. Also, the community is quite large: you should be able to find help easily if you get stuck.

appium
tags question: http://stackoverflow.com/q/27406450
tag name: appium
tags question: http://stackoverflow.com/q/27409178
type: Tag

http://stackoverflow.com/comment/43170369
type: Comment
comment on: http://stackoverflow.com/a/27357827
has text: Kindly see the updated code to understand more in detail
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43162936
score: 0
type: Comment
has text: @shayan check and try answer
type: QuestionComment
comment on: http://stackoverflow.com/q/27354895

http://stackoverflow.com/q/27326681
accepted answer: http://stackoverflow.com/a/27328410
has title: Passing objects from servlets to client side(javascript)
tagged with: javascript
tagged with: servlets
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43112410
tagged with: jsp
favorite count: 0
has answer: http://stackoverflow.com/a/27328410
has body: I'd like to know what is the best way to pass data from servlet to js code. The only solution that came up to my mind is to serialize object to json string, then pass it as an request attribute to jsp page and then get it in js code and deserialize. Is there a better approach to do this?
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/43112945
type: Question

http://stackoverflow.com/a/27350686
has body: In my opinion you'd be better off separating cars and bikes into separating cars and bikes into two seperate classes 'Car' and 'Bike' and then create a 3rd class to house a collection of those objects, that way you can use an List or ArrayList to store them and have a method to just print them out. import java.util.ArrayList; Public Class Garage { private ArrayList&lt;Vehicle&gt; vehicles; Public Garage() { vehicles = new ArrayList&lt;Vehicle&gt;(); } public void addVehicle(Vehicle v) { vehicles.add(v); } public void getVehicles() { for(Vehicle v : vehicles) { System.out.Println(v.getModel()); } } } You'll notice that the ArrayList accepts objects of type vehicle, well both cars and bikes extend vehicle so they will be accepted.
answers question: http://stackoverflow.com/q/27350604
downvote count: 0
score: 1
type: Answer
upvote count: 1

http://stackoverflow.com/q/27427179
has comment: http://stackoverflow.com/comment/43308902
tagged with: spring-mvc
answer count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43300231
tagged with: gradle
type: Question
has title: Using jettyRun in Gradle with Spring MVC app results in directory listing in browser
score: 5
has comment: http://stackoverflow.com/comment/43296188
upvote count: 5
downvote count: 0
favorite count: 0
type: UnansweredQuestion
has body: I have a simple Spring MVC application that is using Java-based configuration instead of XML. Whenever I run gradle jettyRun from the project directory, I get the following in the web browser: The application runs as expected when using Maven with jetty-maven-plugin and mvn jetty:run. Any idea what I may be doing wrong? The source code for the application is here.
tagged with: maven
has comment: http://stackoverflow.com/comment/43296410
has comment: http://stackoverflow.com/comment/43296365
tagged with: spring

http://stackoverflow.com/a/27456323
type: AcceptedAnswer
downvote count: 0
has body: Regarding SendRawEmail, you should be able to differentiate To, Cc, and Bcc destinations by setting them in your raw message headers. If you don't explicitly specify destinations in the request object, the headers will be checked instead. If you do, the headers won't be checked. Here's a great example regarding this problem that JustinC@AWS shared on the AWS forums: Destinations: (empty) To: A@example.com Cc: B@example.com Bcc: C@example.com The above message will be sent to all three of A@, B@, C@example.com. In contrast, if you send the following input: Destinations: A@example.com To: A@example.com Cc: B@example.com Bcc: C@example.com That message will be delivered only to A@example.com.
type: Answer
accepted answer of: http://stackoverflow.com/q/27446357
answers question: http://stackoverflow.com/q/27446357
score: 18
upvote count: 18

http://stackoverflow.com/a/27465976
type: Answer
accepted answer of: http://stackoverflow.com/q/27465957
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27465957
has body: If table is null. The act of performing table[index] dereferences the array, which causes a NullPointerException. A null array is not a empty array. A null array roughly corresponds to that fact that there is no array at all, and the table variable points to nothing. Please make the distinction between a null array, an empty array and a null element in a non-empty array. Array is null: table == null Array is empty: table.length == 0 Element 0 in array is null: table[0] == null Similarly, you cannot call methods from a null object. If table[index] returns a null element, calling getKey() upon it could result in NullPointerException. Same goes if getKey() is null and then trying to call equals() on that. Please note an uninitialized array is implicitly null. Make sure you actually initialize the array.
upvote count: 2
type: AcceptedAnswer

http://stackoverflow.com/a/27427775
has comment: http://stackoverflow.com/comment/43297818
has comment: http://stackoverflow.com/comment/43300873
has comment: http://stackoverflow.com/comment/43338164
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27408509
type: Answer
has comment: http://stackoverflow.com/comment/43299287
answers question: http://stackoverflow.com/q/27408509
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43302901
has comment: http://stackoverflow.com/comment/43338093
has body: Take a look at https://code.google.com/p/treelayout/ It is the layout code used by antlr and seems to work pretty well.

http://stackoverflow.com/comment/43255187
type: Comment
has text: Basically the idea was to give each box a .pack() method that creates a new box from the prototype (Which is supposed to simulate a problem where creating a new object would be very processing intensive) and to set the dimensions based on the box that is to be packaged.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27404911

http://stackoverflow.com/q/27377926
answer count: 1
tagged with: styleddocument
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27378498
has title: How to get the content with all attributes of a JTextPane?
score: 0
tagged with: java
tagged with: jtextpane
tagged with: swing
type: Question
has body: I have a JTextPane and on a ActionEvent, I want to save the content of the JTextPane (with the colors, text and other attributes) in another class (as a variable). Later on I want to exchange the content of the JTextPane with the one of the variable. I have tried to use: (StyledDocument)myTextPane.getDocument() and myTextPane.getStyledDocument() but both didn't work. I thought about just give the whole JTextPane over, but apperently the pane gets still updated in the other class... EDIT: I would only use the content to show it (later) in the JTextPane again. I won't be saving it in a file or something similar.

http://stackoverflow.com/q/27383126
tagged with: bufferedreader
has comment: http://stackoverflow.com/comment/43215348
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/13464954
has answer: http://stackoverflow.com/a/27386876
has comment: http://stackoverflow.com/comment/43215280
has comment: http://stackoverflow.com/comment/43235167
has answer: http://stackoverflow.com/a/27387157
type: Question
has comment: http://stackoverflow.com/comment/43215591
has comment: http://stackoverflow.com/comment/43219385
has comment: http://stackoverflow.com/comment/43215714
has comment: http://stackoverflow.com/comment/43215512
has title: trying to get BufferedReader to read past first line
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27386086
tagged with: bufferedinputstream
answer count: 3
linked to: http://stackoverflow.com/q/1761051
has comment: http://stackoverflow.com/comment/43215289
has comment: http://stackoverflow.com/comment/43215283
has body: I am trying to read an html link that contains something like this Title Name1 Age1 Hometown1 Name2 Age2 Hometown2 Name3 Age3 Hometown3 with method readData(String[] urls) where String[] urls is an array of strings, strings being one or more urls. Now I'm only interested in what's in the html body of each url, hence I used while .readLine!=null and .contains(" "). However, it appears that my code can only read the first line of the body block (starting with line after , as I want) and does not go on to the lines after until the . How would I make my code read past the first line? public void readData(String[] urls) { for (int i=0; i<urls.length; i++) { String str=""; try { URL url=new URL(urls[i]); URLConnection conn=url.openConnection(); BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream())); String s; while (( s = in.readLine())!=null) if (s.contains(" ")) { str += s; } } catch(Exception e) { e.printStackTrace(); } } } EDIT1: The issue appears to be that the entire input is coming in as one line rather than multiple lines, as it should be. How would I partition that one line into multiple lines so that I can read each? EDIT2: Thanks everyone. I've figured that out. I still use the single long input of String but I just partition it into a String array using .split() and read each element of that. However, there is a new problem now. for my String[] urls, I am only reading the first element. I cannot read anything beyond the first String urls element when actually I want to read all the String elements in urls. Any ideas?
has comment: http://stackoverflow.com/comment/43215032

http://stackoverflow.com/q/27385916
has comment: http://stackoverflow.com/comment/43220087
type: Question
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/43220046
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/43220062
tagged with: bluej
answer count: 2
has title: Why is my Java code giving me a NullPointerException error?
upvote count: 0
favorite count: 0
tagged with: nullpointerexception
type: UnansweredQuestion
has body: I get a null pointer exception error when I run the method runSnackBar and I can't work out why. When I get this error BlueJ highlights the first line in the randomFlavour method but I have no idea why. Please help. import java.util.Random; import java.util.ArrayList; public class SnackBar { private Random randomGenerator; private String[] packets; private SnackMachine newSnackMachine; private ArrayList&lt;Student&gt; students; public SnackBar(int numOfStudents, int numPackOfCrisps, int cost) { randomGenerator = new Random(); String[] packets = {"ready salted", "cheese and onion", "salt and vinegar" , "smokey bacon"}; newSnackMachine = new SnackMachine(numPackOfCrisps , cost); for(int n=0 ; n &lt; numPackOfCrisps ; n++){ newSnackMachine.addPack(new PackOfCrisps(randomFlavour())); } students = new ArrayList&lt;Student&gt;(); for(int i=0 ; i &lt; numOfStudents ; i++){ students.add(new Student(randomFlavour(), newSnackMachine)); } } private String randomFlavour() { int index = randomGenerator.nextInt(packets.length); return packets[index]; } public void describe(){ System.out.println("The SnackBar has" + students.size() + "hungry students"); System.out.println("The SnackMachine has:" + newSnackMachine.countPacks("ready salted") + "packets of ready salted crisps"); System.out.println("," + newSnackMachine.countPacks("cheese and onion") + "of cheese and onion crisps"); System.out.println("," + newSnackMachine.countPacks("salt and vinegar") + "of salt and vinegar crisps"); System.out.println("," + newSnackMachine.countPacks("smokey bacon") + "of smokey bacon crisps"); } public void runSnackBar(int nSteps){ for( int x=1 ; x &lt; nSteps ; x++){ System.out.println("Time step" + x); describe(); int y = randomGenerator.nextInt(students.size()); students.get(y).snackTime(); } } }
has answer: http://stackoverflow.com/a/27385953
has answer: http://stackoverflow.com/a/27385954
downvote count: 2

http://stackoverflow.com/comment/43355316
comment on: http://stackoverflow.com/a/27458263
score: 0
type: Comment
has text: Thanks for your help, compile 'net.sf.json-lib:json-lib:2.4:jdk15' is causing the problem. if i remove this (and remove my java-files) it runs without error. the json-lib also has org.apache.commons.collections, see at http://mvnrepository.com/artifact/net.sf.json-lib/json-lib/2.4. So how do i exlude it in build.gradle?
type: AnswerComment

http://stackoverflow.com/a/45569058
score: 1
has body: You are getting this error because you have added the listeners tag outside the suite You should use the testng.xml as below &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"&gt; &lt;suite name="Test"&gt; &lt;listeners&gt; &lt;listener class-name="org.uncommons.reportng.HTMLReporter"/&gt; &lt;listener class-name="org.uncommons.reportng.JUnitXMLReporter"/&gt; &lt;/listeners&gt; &lt;test name="Round1"&gt; &lt;classes&gt; &lt;class name="testcases.common.testCase"/&gt; &lt;/classes&gt; &lt;/test&gt; &lt;/suite&gt; This is working fine for me. I am sure your problem will be resolved after making changes to your xml file.
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27352872
type: Answer

http://stackoverflow.com/comment/43252161
has text: I've edited inside an answer, not sure why you have an issue after the change, check if its exactly the same exception. I gave a few pointers though, hope you don't mind, perhaps somewhere along the line, you'll spot further issues. Hope it helps
type: AnswerComment
comment on: http://stackoverflow.com/a/27403185
score: 0
type: Comment

http://stackoverflow.com/q/27344409
tagged with: java
has answer: http://stackoverflow.com/a/27344438
answer count: 4
type: AnsweredQuestion
has body: public void addValues(final Set&lt;String&gt; values) { if (values != null || !values.isEmpty()) { //compiler warning here on values.isEmpty(). Null pointer access: The variable values can only be null at this location } } Why am I seeing this NullPointerAccess warning, though I am guarding against the null in the first check. If the value is null first check would fail and it will return without even going to the second check. Can I ignore this warning. I am using Eclipse for development.
possible better answer: http://stackoverflow.com/a/27344424
has answer: http://stackoverflow.com/a/27344424
type: Question
accepted answer: http://stackoverflow.com/a/27344438
has answer: http://stackoverflow.com/a/27344571
has answer: http://stackoverflow.com/a/27344425
has title: Potential NullPointerAccess
score: 0

http://stackoverflow.com/comment/126420557
comment on: http://stackoverflow.com/a/27460624
type: AnswerComment
score: 0
type: Comment
has text: Just to be clear: HashIterator -> O(N) LinkedHashIterator -> O(1) Just got confused because the "Update" message from the OP,saying that HashIterator is O(1) . Thanks!

http://stackoverflow.com/q/27334494
tagged with: hashmap
has title: Space Complexity of HashMap when iterating over an Array in linear time
upvote count: 2
has body: I have a doubt regarding the space complexity of a program. Let's say I am iterating over an Array (stores event ids) with a size of n (may be in billions). I wanted to track the occurrence of each event id, so I have used a hash map to store event id as key and its occurrence counter as value. Here is the pseudo code: Map m = HashMap&lt;&gt; for i to n-1 if m.contains(i) int prevCount = m.get(i) m.put(i, prevCount +1) else m.put(i, 1) What would be the space complexity? PS This is my first question in stackoverflow, if it seems duplicate, please route me to the correct answer.
answer count: 1
downvote count: 1
accepted answer: http://stackoverflow.com/a/27334607
favorite count: 0
has answer: http://stackoverflow.com/a/27334607
tagged with: space-complexity
type: AnsweredQuestion
score: 1
tagged with: java
type: Question

http://stackoverflow.com/comment/43135508
has text: Yeah but it isnt assigned to a variable.
comment on: http://stackoverflow.com/q/27339526
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43194084
comment on: http://stackoverflow.com/q/27371266
type: QuestionComment
type: Comment
has text: sir,i already pos the ForgotPasswordActivity.java and forgotpasword.xml as well..
score: 0

http://stackoverflow.com/q/27337039
has comment: http://stackoverflow.com/comment/43130812
type: UnansweredQuestion
tagged with: android
has title: Updating wrong TextView
tagged with: java
has comment: http://stackoverflow.com/comment/43130950
type: Question
has body: I've got three TextViews, plotText, yearText, and directorText. There's also an EditText for the user input. WHAT SHOULD HAPPEN: When I press the Use Hint button, the Year should appear. When I press the Use Hint button again, the Director should appear. WHAT IS HAPPENING NOW: When I press the Use Hint button, the Year appears as it should. When I press the button again, the Director label shows up, but directorText (the name of the director) appears in the EditText field instead of the TextView I've assigned it to. I've checked that my labels are all named correctly and that I'm assigning to the correct one, and I've tried cleaning the project in Eclipse but that didn't work either. Any ideas? I define the TextViews in onCreate: TextView yearText = (TextView)findViewById(R.id.yearText); TextView directorText = (TextView)findViewById(R.id.directorText); TextView hintText = (TextView)findViewById(R.id.hintText); TextView plotText = (TextView)findViewById(R.id.plotText); Here's the code for the button: public void useHint(View v){ if (game.numHints == 2){ View y = findViewById(R.id.yearLabel); y.setVisibility(View.VISIBLE); yearText.setText(currentMovie.year); game.numHints--; hintText.setText("Hints Remaining: "+game.numHints); }else if (game.numHints == 1){ View d = findViewById(R.id.directorLabel); d.setVisibility(View.VISIBLE); directorText.setText(currentMovie.director); game.numHints--; hintText.setText("Hints Remaining: "+game.numHints); // remove button View b = findViewById(R.id.hintButton); b.setVisibility(View.INVISIBLE); } } Here's the XML: &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" too…
tagged with: eclipse
score: 0
answer count: 1
tagged with: textview
has answer: http://stackoverflow.com/a/27337246

http://stackoverflow.com/comment/43154556
type: QuestionComment
comment on: http://stackoverflow.com/q/27347695
has text: Post the full Logcat error
score: 0
type: Comment

http://stackoverflow.com/q/27399345
score: 0
has body: How to extract the URL from the below string. I searched in web for regex but it extracts only if http:// or www. How to extract for both the type of inputs? Regex: http://blog.houen.net/java-get-url-from-string/ Case1: bhjhrwww.rrjhttp://www.google.com Result: http://www.google.com Case2: bhjhrwww.rrwww.google.com Result: www.google.com
has comment: http://stackoverflow.com/comment/43248047
answer count: 1
tagged with: url
tagged with: string
has comment: http://stackoverflow.com/comment/43244061
has comment: http://stackoverflow.com/comment/43244129
tagged with: regex
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43244473
has title: How to extract the URL from the string in java?
tagged with: java
has answer: http://stackoverflow.com/a/27399482
type: Question

http://stackoverflow.com/q/27450551
type: AnsweredQuestion
upvote count: 2
accepted answer: http://stackoverflow.com/a/27450634
type: Question
tagged with: java
has title: How to specify client version with JClouds-Chef?
has body: I have been using the following JClouds-Chef 1.7.3 code for several months now to bootstrap new VMs from scratch: public class Bootstrapper { public static void main(String[] args) { Bootstrapper b = new Bootstrapper(); b.bootstrap(); } public void bootstrap() { String endpoint = "https://mychef.example.com" String client = "myuser" String validator = "chef-validator" String clientCredential = Files.toString(new File("/etc/myuser/myuser.pem"), Charsets.UTF_8) String validatorCredential = Files.toString(new File("/etc/myuser/chef-validator.pem"), Charsets.UTF_8) Properties props = new Properties() props.put(ChefProperties.CHEF_VALIDATOR_NAME, validator); props.put(ChefProperties.CHEF_VALIDATOR_CREDENTIAL, validatorCredential) props.put(Constants.PROPERTY_RELAX_HOSTNAME, "true") props.put(Constants.PROPERTY_TRUST_ALL_CERTS, "true") ChefContext ctx = ContextBuilder.newBuilder("chef") .endpoint(endpoint) .credentials(client, clientCredential) .overrides(props) .modules(ImmutableSet.of(new SshjSshClientModule())) // .buildView(ChefContext.class); ChefApi api = ctx.unwrapApi(ChefApi.class) MyEnvProvider environmentProvider = new MyEnvProvider() Environment devEnv = environmentProvider.provideEnvironment() api.createEnvironment(devEnv) List&lt;String&gt; runlist = new RunListBuilder().addRole("myrole").build() BootstrapConfig bootstrapConfig = BootstrapConfig.builder().environment("myenv").runList(runlist).build() String vmIp = "myapp01.example.com" String vmSshUsername = "myuser" String vmSshPassword = "12345" ChefService chef = chefContext.getChefService() chef.updateBootstrapConfigForGroup(chefGroup, bootstrapConfig) Statement bootstrap = chef.createBootstrapScriptForGroup(chefGroup) SshClient.Factory sshFactory = chefContext.unwrap().utils() .injector().getInstance(Key.get(new TypeLiteral&lt;SshClient.Factory&gt;() {})) SshClient ssh = sshFactory.create(HostAndPort.fromParts(vmIp, 22), LoginCredentials.builder().user(vmSshUsername).password(vmSshPassword).build()) ssh.…
score: 2
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27450634
favorite count: 0
tagged with: jclouds
tagged with: chef-infra

http://stackoverflow.com/q/27360314
has title: Swing initiate dragging on mouse click
type: Question
score: 0
has comment: http://stackoverflow.com/comment/43172898
tagged with: drag-and-drop
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43172698
tagged with: swing
has comment: http://stackoverflow.com/comment/43172708
answer count: 0
tagged with: java
has body: I have a JPanel with JList, that has dragging support enabled. Dragging works normally while holding the mouse button pressed, but I would like to initiate dragging, when the user just clicks on an item from JList and stop it, when dropping was performed. I tried to add the MouseListener to JList, but this doesn't work (dragging is not initiated): class DragListener extends MouseAdapter{ @Override public void mouseReleased(MouseEvent e) { JComponent jlist = (JComponent) e.getSource(); TransferHandler transferHandler = jlist.getTransferHandler(); transferHandler.exportAsDrag(jlist, e, TransferHandler.COPY); } } How to initiate and keep dragging on item selection, without keeping the mouse button pressed?

http://stackoverflow.com/comment/43212913
type: Comment
type: AnswerComment
has text: I managed it by changing contains to equals. But now another problem is that every sentence has to be totally the same
score: 0
comment on: http://stackoverflow.com/a/27378687

http://stackoverflow.com/comment/43350951
type: QuestionComment
has text: Java 8 replaced PermGen space with Metaspace, which by default auto expands. However Java 8 does nothing about the actual leaks - you can still get OutOfMemoryError: Metaspace. In case you want to read up on the why and how, feel free to check out my blog series on the subject: http://java.jiderhamn.se/2011/12/11/classloader-leaks-i-how-to-find-classloader-leaks-with-eclipse-memory-analyser-mat/
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27451058

http://stackoverflow.com/q/27349856
answer count: 0
has comment: http://stackoverflow.com/comment/43154269
score: 0
tagged with: java
has title: Do duplicate references need significant additional memory in Java?
type: Question
has comment: http://stackoverflow.com/comment/43154906
has comment: http://stackoverflow.com/comment/43154806
tagged with: memory
has comment: http://stackoverflow.com/comment/43154359
has comment: http://stackoverflow.com/comment/43154310
has comment: http://stackoverflow.com/comment/43154253
type: UnansweredQuestion
has body: Let's say I have the following class: public class TestClassA { private Object ref; //...constructor, getter, setter } now let's suppose I do: public static void main(String... args) { String S = "test"; TestInstanceA = new TestClass(); TestInstanceA.setRef(S); TestInstanceB = new TestClass(); TestInstanceB.setRef(S); } Is this program going to need twice the memory of the first object, or is java representing it as an (internal) pointer to the same area of memory, meaning not much additional memory is going to be needed? I always thought that objects in java were basically the same thing as pointers in C (only that they are combined with values), but some of my programs seem to eat increasing amounts of memory, especially when many objects are dynamically created. So I want to make sure I am not getting it wrong. Excited for your answers!
has comment: http://stackoverflow.com/comment/43154746
tagged with: memory-management

http://stackoverflow.com/a/27410825
upvote count: 3
score: 3
has comment: http://stackoverflow.com/comment/43266103
has body: You can't add a type String[] to an array list that expects a type Car. You need to instead add Car objects to that list. Instead, use ArrayList&lt;String[]&gt; carList= new ArrayList&lt;String[]&gt;; If you want to instead put cars in your array list, then convert the strings you're trying to add to Car Objects by constructing them one by one or creating constructor of Car object that takes an ArrayList as a parameter. The main idea, above all here, is to stay consistent with your data types when creating data structures.
downvote count: 0
has comment: http://stackoverflow.com/comment/43266107
type: Answer
answers question: http://stackoverflow.com/q/27410803

pattern-matching
tags question: http://stackoverflow.com/q/27348319
type: Tag
tags question: http://stackoverflow.com/q/27438667
tag name: pattern-matching
tags question: http://stackoverflow.com/q/27376129

http://stackoverflow.com/q/27349374
type: UnansweredQuestion
score: 1
upvote count: 1
type: Question
has title: Covert XLSX row into string and add to array
tagged with: java
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27349419
has body: I am trying to get a basic java program to read from a xlsx file and put each row into an arrayList as a string, where later on I will then split that String up of that row. Below is my code, however i'm trying to figure out where I have gone wrong as it doesn't appear to be doing anything. List&lt;String&gt; text = new ArrayList&lt;String&gt;(); Workbook wb = WorkbookFactory.create(new File("input.xlsx")); DataFormatter fmt = new DataFormatter(); Sheet s = wb.getSheetAt(0); for (Row r : s) { StringBuffer sb = new StringBuffer(); for (Cell c : r) { if (sb.length() &gt; 0) sb.append(" - "); sb.append(fmt.formatCell(c)); } text.append(sb.toString()); } Any help would be appreciated.

http://stackoverflow.com/a/27462299
type: Answer
answers question: http://stackoverflow.com/q/27462258
has comment: http://stackoverflow.com/comment/43361440
upvote count: 1
has comment: http://stackoverflow.com/comment/43361074
type: AcceptedAnswer
has body: Calling stmt.executeUpdate(s1); inside the while(rs.next()) loop closes the ResultSet, and therefore, the next call to rs.next() throws the exception. You should use a different Statement instance to execute that update. A ResultSet object is automatically closed when the Statement object that generated it is closed, re-executed, or used to retrieve the next result from a sequence of multiple results. (Source)
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27462258

http://stackoverflow.com/comment/43099066
comment on: http://stackoverflow.com/a/27319803
has text: Yes, they can be from different impls
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/115738479
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27347209
has text: Related: [Java chained inequality if (5<i<10)](https://stackoverflow.com/questions/10658343/java-chained-inequality-if-5i10)

http://stackoverflow.com/a/27356637
type: Answer
has body: Maven WAR Overlays could solve the problem. If you have two maven web projects, and one of your Web Project depends on the other's you could declare the dependent project as a dependency and do an overlay. Reference: http://maven.apache.org/plugins/maven-war-plugin/overlays.html
answers question: http://stackoverflow.com/q/27356410
score: 0

http://stackoverflow.com/q/27471328
has title: bluej: how to create object with Date type
tagged with: arraylist
score: 0
answer count: 3
duplicate of: http://stackoverflow.com/q/43802
tagged with: types
has answer: http://stackoverflow.com/a/27471621
has answer: http://stackoverflow.com/a/27471604
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/43802
has answer: http://stackoverflow.com/a/27471413
tagged with: java
type: Question
has body: How can I give my datamember date from the type Date a value? I added in my class the import java.util.* statement but I can't find a way to give it a value. It isn't a string like "12-11-2014" This is one of my first project with Java, so I don't have many experience. ;-) Greetings Moleculation import java.util.*; public class Training { // data members (instance variables) private double distance; // in km private double time; // in seconden private String type; private Adres address; private Date date; public Training(int distance, int time, String type, Adres address, Date date) { // initialise data members (if necessary) this.distance = distance; this.time = time; this.type = type; this.address = address; this.date = date; } // getters public double getDistance() { return distance; } public double getTime() { return time; } public String getType() { return type; } public Date getDate() { return date; } public Adres getAddress() { return address; } // setters }
tagged with: arrays
tagged with: date

http://stackoverflow.com/q/27356605
has body: I have this app from Head First Java import javax.sound.midi.*; public class MiniMiniMusicApp{ public static void main(String[] args){ MiniMiniMusicApp mini = new MiniMiniMusicApp(); mini.play(); } public void play(){ try{ Sequencer player = MidiSystem.getSequencer(); player.open(); Sequence seq = new Sequence(Sequence.PPQ,4); Track track = seq.createTrack(); ShortMessage a = new ShortMessage(); a.setMessage(114,1,44,100); MidiEvent noteOn = new MidiEvent(a,1); track.add(noteOn); ShortMessage b = new ShortMessage(); b.setMessage(128,1,44,100); MidiEvent noteOff = new MidiEvent(b,16); track.add(noteOff); player.setSequence(seq); player.start(); } catch(Exception ex){ ex.printStackTrace(); System.out.println("damn"); } } } And this throws the following exception at runtime javax.sound.midi.InvalidMidiDataException: command out of range: 0x72 at javax.sound.midi.ShortMessage.setMessage(ShortMessage.java:280) at MiniMiniMusicApp.play(MiniMiniMusicApp.java:15) at MiniMiniMusicApp.main(MiniMiniMusicApp.java:6) I read some docs on setMessage and it seems the exception is thrown when you pass an invalid MidiMessage but I'm simply following the example from the book. I've read on other forums and it appears that this code works for other people. Any idea on what is causing the issue? Can you try running this on your end and see if it works? At least that'll tell me if it's something on my environment.
tagged with: javasound
possible better answer: http://stackoverflow.com/a/27356737
has answer: http://stackoverflow.com/a/27356737
type: AnsweredQuestion
upvote count: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/27357496
type: Question
has title: InvalidMidiDataException: command out of range
answer count: 2
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43475614
has answer: http://stackoverflow.com/a/27357496
favorite count: 0

http://stackoverflow.com/comment/43167688
score: 0
comment on: http://stackoverflow.com/q/27356139
type: QuestionComment
type: Comment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/66396/discussion-between-helping-hands-and-user3724559).

http://stackoverflow.com/comment/43488613
type: AnswerComment
has text: I do want to find a better way of getting this header to populate without having to set it manually though!
score: 0
comment on: http://stackoverflow.com/a/27512429
type: Comment

http://stackoverflow.com/comment/43156687
type: QuestionComment
comment on: http://stackoverflow.com/q/27351090
has text: Are you setting the breakpoint, in both cases, *after* attaching?
score: 0
type: Comment

http://stackoverflow.com/comment/43129895
score: 0
type: Comment
has text: naaa, the catch will take care of that exception.
comment on: http://stackoverflow.com/a/27335840
type: AnswerComment

http://stackoverflow.com/q/27439884
has comment: http://stackoverflow.com/comment/43319642
tagged with: java-7
type: UnansweredQuestion
answer count: 4
has body: I have a abstract class and some classes extend the abstract class. Now i wanted to do some preprocessing before every functions present in the child classes (for example the functions are nothing but fetching entities from DB, so before even going for DB just check the entities in the cache if the entities are present in the cache then return else call to call() or call(final Set&lt;String&gt; args) fetch the entities store it in cache and return). So i introduced an interface e.g. interface PQRCallable &lt;K&gt; { K call(); Set&lt;K&gt; call(final Set&lt;String&gt; args); } Inside the call function the subclass functions writes the logic to fetch the entities from DB. Now every function in the subclasses call either of the two common functions present in the abstract class i.e. doProcessing(String k, ..., PQRCallable pQRCallable) doProcessing(Set&lt;k&gt;, ..., PQRCallable pQRCallable) with a PQRCallable so that if the preprocessing will face any issue it would fall back to call() or call(final Set&lt;String&gt; args). My problem here is that now every functions inside the subclasses will need to implement both the functions. And doProcessing(Set&lt;k&gt;, ..., PQRCallable pQRCallable) will always call Set&lt;K&gt; call(final Set&lt;String&gt; args); and doProcessing(String k, ..., PQRCallable pQRCallable) will always call K call();. Hence actually the subclass will just implement one function and for other function they should just throw some exception like UnsupportedOperationException. Do anybody can suggest me a better approach for this. Thanks.
has comment: http://stackoverflow.com/comment/43321593
tagged with: oop
has comment: http://stackoverflow.com/comment/43321685
tagged with: java
has comment: http://stackoverflow.com/comment/43320001
has title: How to design the interface / abstract class here (OOP design)
has comment: http://stackoverflow.com/comment/43319578
has comment: http://stackoverflow.com/comment/43319640
has comment: http://stackoverflow.com/comment/43320039
type: Question
has answer: http://stackoverflow.com/a/27441290
has comment: http://stackoverflow.com/comment/43319878
has answer: http://stackoverflow.com/a/27442523
has answer: http://stackoverflow.com/a/27440667
score: 0
has answer: http://stackoverflow.com/a/27441494

http://stackoverflow.com/comment/43364072
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27463951
has text: Yes, sorry will edit the post

http://stackoverflow.com/comment/43234953
has text: Is there multithreading going on here?
type: QuestionComment
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27393685

http://stackoverflow.com/comment/43267524
comment on: http://stackoverflow.com/q/27411089
score: 0
type: Comment
type: QuestionComment
has text: please create an MCVE. Otherwise only very few people will actually try to help you.

http://stackoverflow.com/comment/43241800
score: 1
type: AnswerComment
has text: yes I aware of this solution, but I have many hbase jobs and this is not scale.
type: Comment
comment on: http://stackoverflow.com/a/27397518

http://stackoverflow.com/comment/43213868
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27382100
has text: Thanks again @LuiggiMendoza (+1) - but your answer and the JavaDoc link for `CallableStatement` now have me a bit concerned. (1) If I'm reading the JavaDocs correctly, it seems like JDBC only allows a **single column or value** to be returned by a stored procedure. Is this true, or am I misreading the JavaDocs? If I am reading them correctly, this seems like a horrible limitation, as I might have my procedure returning many columns across many tables!
type: Comment

http://stackoverflow.com/comment/43189502
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27368525
has text: If you just finish all your activities is your app still appearing in the recent task list? Have you tried just finishing all your activities with an Intent with flags?

http://stackoverflow.com/comment/43131869
has text: I can't thank you enough. You are the best. I spent over a week tying to get answer by myself to no avail.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27337594
type: AnswerComment

http://stackoverflow.com/comment/43120368
score: 0
type: QuestionComment
type: Comment
has text: http://docs.oracle.com/javase/1.5.0/docs/guide/language/foreach.html
comment on: http://stackoverflow.com/q/27331274

http://stackoverflow.com/q/27469147
tagged with: android-fragments
has comment: http://stackoverflow.com/comment/43373784
has comment: http://stackoverflow.com/comment/43373567
tagged with: java
has comment: http://stackoverflow.com/comment/43373735
score: 0
answer count: 3
accepted answer: http://stackoverflow.com/a/27469260
has comment: http://stackoverflow.com/comment/43373798
has comment: http://stackoverflow.com/comment/43373617
has title: Pass data to fragment edittext from activity
possible better answer: http://stackoverflow.com/a/27469403
has comment: http://stackoverflow.com/comment/43373768
tagged with: android
has answer: http://stackoverflow.com/a/27469403
has comment: http://stackoverflow.com/comment/43373894
linked to: http://stackoverflow.com/q/10450348
has answer: http://stackoverflow.com/a/27469260
has body: Before you start answering i tried sharing data using sharedpreferences ... i tried bundle thing but still having null values and application crushes, my application is a draw menu when you click on listview item it brings a fragment in front where i have several edittext textviews , when i click on a edittext to change text it works perfect , the problem is that the edittext is initialy blank and it must load data from the main activity and this where i got NULL [MainActivity ] onCreate method EditText editus_ername = (EditText) findViewById(R.id.editUserName); editus_ername.setText("Username"); [fragment class] EditText editus_ername; public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_whats_hot, container, false); editus_ername = (EditText)getActivity().findViewById(R.id.editUserName); return rootView; } 12-14 12:32:48.699: E/AndroidRuntime(1517): FATAL EXCEPTION: main 12-14 12:32:48.699: E/AndroidRuntime(1517): java.lang.NullPointerException 12-14 12:32:48.699: E/AndroidRuntime(1517): at info.androidhive.slidingmenu.WhatsHotFragment.onCreateView(WhatsHotFragment.java:40) 12-14 12:32:48.699: E/AndroidRuntime(1517): at android.app.Fragment.performCreateView(Fragment.java:1695) 12-14 12:32:48.699: E/AndroidRuntime(1517): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:885) 12-14 12:32:48.699: E/AndroidRuntime(1517): at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1057) 12-14 12:32:48.699: E/AndroidRuntime(1517): at android.app.BackStackRecord.run(BackStackRecord.java:682) 12-14 12:32:48.699: E/AndroidRuntime(1517): at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1435) 12-14 12:32:48.699: E/AndroidRuntime(1517): at android.app.FragmentManagerImpl$1.run(FragmentManager.java:441) 12-14 12:32:48.699: E/AndroidRuntime(1517): at android.os.Handler.handleCallback(Handler.java:725) 12-14 12:32:48.699: E/Android…
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27469372

http://stackoverflow.com/a/30218102
type: Answer
accepted answer of: http://stackoverflow.com/q/27358618
score: 1
upvote count: 1
has body: Add a new logger to configuration. <appender-ref ref="info-log" level="info"/> <AppenderRef ref="trace-log" level="trace"/>
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27358618

http://stackoverflow.com/q/27434674
has answer: http://stackoverflow.com/a/27434941
type: Question
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43310559
has answer: http://stackoverflow.com/a/27434698
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43310307
has title: Canvas game rendering freeze pc
upvote count: 1
score: 1
tagged with: java
has body: I don't know what is happening but everytime I run this code my computer totally freezes and I can't do anything...it used to work on windows but on linux is freezes? What's wrong with it? package game; import java.awt.Canvas; import java.awt.Graphics; import java.awt.image.BufferStrategy; import javax.swing.JFrame; public class Gaming extends Canvas implements Runnable { private Thread thread; public Gaming(){ } public void start(){ thread = new Thread(this); thread.start(); } public static void main(String[] args) { JFrame j = new JFrame(); Gaming g = new Gaming(); j.add(g); j.setVisible(true); j.setSize(800,600); j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); g.start(); } public void render(){ BufferStrategy bs = getBufferStrategy(); if(bs == null){ createBufferStrategy(3); return; } Graphics g = bs.getDrawGraphics(); g.fillRect(50, 50, 50, 50); g.dispose(); bs.show(); } @Override public void run() { while(true){ render(); } } }

http://stackoverflow.com/comment/43335064
score: 1
comment on: http://stackoverflow.com/q/27448032
has text: Are you using [SharedPreferences](http://developer.android.com/reference/android/content/SharedPreferences.html)? If you don't save the current settings that the user has configured, the activity won't be able to retain this information; thus it would always be created with the switch checked.
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27436118
score: 3
has body: You could try Objective c to Java converter Incase if you need your java code to be converted to Objective C Java to Objective c converter Reference
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/27436051
downvote count: 0

http://stackoverflow.com/comment/43231851
comment on: http://stackoverflow.com/q/27392175
type: QuestionComment
type: Comment
has text: I would suggest you use a Map instead of a List for this.
score: 1

http://stackoverflow.com/comment/43211154
score: 0
type: Comment
type: AnswerComment
has text: For Chinese, take a look at http://www.chinese-tools.com/learn/chinese/07-year-month-date-day.html. They are using 5月 for May (literally, "5 moon").
comment on: http://stackoverflow.com/a/27371115

http://stackoverflow.com/q/27398768
has title: Pass Custom object from servlet to ajax and display in jsp page
tagged with: jsp
tagged with: jquery
tagged with: servlets
tagged with: ajax
score: 0
has body: Is that any method to pass custome object from servlet to ajax and display in jsp page? When accept inventory id from jsp page, it pass to servlet and get the inventory object based on the id. After that, i want to pass the inventory object back to the ajax and display in jsp page
answer count: 1
has answer: http://stackoverflow.com/a/27403862
has comment: http://stackoverflow.com/comment/43250703
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43251882
type: Question

http://stackoverflow.com/q/27395022
has answer: http://stackoverflow.com/a/27396095
has comment: http://stackoverflow.com/comment/43238236
tagged with: java
has title: Inflate 2 layouts (1 main, 1 additional)
has comment: http://stackoverflow.com/comment/43237111
type: Question
tagged with: android-layout
score: 0
has comment: http://stackoverflow.com/comment/43238325
answer count: 1
has comment: http://stackoverflow.com/comment/43236649
type: UnansweredQuestion
tagged with: android
has body: So i have 2 java files buyClothes.java and searchClothes.java. At buyClothes by java the layout that is being used is : R.layout.bClothes and at searchClothes the layout that is being used is : R.layout.sClothes In bClothes there is an Edittext which is being used in buyClothes, in searchClothes i would like to use that Edittext aswell. From what i understood from this website and information i then have to inflate it in searchClothes to be able to use it. I have done that this way.. View view; LayoutInflater inflater1 = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater1.inflate(R.layout.bClothes, null); EditText testEdit = (EditText)view.findViewById(R.id.edit1); testEdit.setHint("testhint"); Now the application doesn't crash but i don't see the hint on the testEdit file, as if it is being ignored or nothing can be done with the view, or i have a slight feeling that te view might return null or something. Do you have any hints on this matter?
has comment: http://stackoverflow.com/comment/43236680
has comment: http://stackoverflow.com/comment/43237162
has comment: http://stackoverflow.com/comment/43240950

http://stackoverflow.com/q/27367411
answer count: 0
tagged with: java
type: Question
tagged with: jakarta-ee
has comment: http://stackoverflow.com/comment/43263100
tagged with: websphere
has comment: http://stackoverflow.com/comment/43261214
downvote count: 0
has comment: http://stackoverflow.com/comment/43216969
has body: I deleted files in the following directories, but I was able to successfully deploy and launch my project in the browser. Deleted the "MAXIMO" Directory deleted from: D:\IBM\WebSphere\AppServer\profiles\ctgDmgr01\config\cells\ctgCell01\blas D:\IBM\WebSphere\AppServer\profiles\ctgDmgr01\config\cells\ctgCell01\cus Delete the "MAXIMO.ear" from: D:\IBM\WebSphere\AppServer\profiles\ctgAppSrv01\config\cells\ctgCell01\applications D:\IBM\WebSphere\AppServer\profiles\ctgDmgr01\config\cells\ctgCell01\applications Delete all files in the following directories: D:\IBM\WebSphere\AppServer\profiles\ctgAppSrv01\temp D:\IBM\WebSphere\AppServer\profiles\ctgAppSrv01\wstemp D:\IBM\WebSphere\AppServer\profiles\ctgAppSrv01\config\temp D:\IBM\WebSphere\AppServer\profiles\ctgDmgr01\temp D:\IBM\WebSphere\AppServer\profiles\ctgDmgr01\wstemp D:\IBM\WebSphere\AppServer\profiles\ctgDmgr01\config\temp However, I now have issues with launching my admin console as I get this error SRVE0255E: A WebGroup/Virtual Host to handle /ibm/console/login.do has not been defined"
has comment: http://stackoverflow.com/comment/43187248
has comment: http://stackoverflow.com/comment/43222070
has comment: http://stackoverflow.com/comment/43211717
has title: : SRVE0255E: A WebGroup/Virtual Host to handle /ibm/console/login.do has not been defined"Cannot launch Admin Console from Websphere
has comment: http://stackoverflow.com/comment/43262759
favorite count: 0
has comment: http://stackoverflow.com/comment/43241642
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43263452
score: 2

io
tags question: http://stackoverflow.com/q/27424845
tags question: http://stackoverflow.com/q/27377542
tag name: io
tags question: http://stackoverflow.com/q/27459738
tags question: http://stackoverflow.com/q/27465808
tags question: http://stackoverflow.com/q/27424237
tags question: http://stackoverflow.com/q/27366900
tags question: http://stackoverflow.com/q/27326226
tags question: http://stackoverflow.com/q/27462870
tags question: http://stackoverflow.com/q/27335371
tags question: http://stackoverflow.com/q/27461640
tags question: http://stackoverflow.com/q/27422929
type: Tag
tags question: http://stackoverflow.com/q/27325061
tags question: http://stackoverflow.com/q/27353531
tags question: http://stackoverflow.com/q/27415444

http://stackoverflow.com/comment/43353015
score: 0
comment on: http://stackoverflow.com/q/27458027
has text: Which version of Java are you using?
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27557047
downvote count: 1
has body: I have tested your code and failed for me as well. In my case, b.getContentType() returns all uppercase characters (e.g. "TEXT/HTML; charset=UTF-8"). So I have converted that to lowercase and it worked. String contentType=b.getContentType().toLowerCase(Locale.ENGLISH); if(!contentType.contains("text/html")) { continue; }
has comment: http://stackoverflow.com/comment/43570738
has comment: http://stackoverflow.com/comment/43571045
type: Answer
score: 1
upvote count: 2
answers question: http://stackoverflow.com/q/27387202

http://stackoverflow.com/comment/43336723
has text: Duration is exactly what I was looking for. Thanks Jon.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27446847
type: AnswerComment

http://stackoverflow.com/q/27385818
has answer: http://stackoverflow.com/a/27389851
has comment: http://stackoverflow.com/comment/43289588
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/27397118
type: Question
has body: I have a .EAP file with a folder with .java files, and some SQL queries. I've never worked with enterprise architecture, is it possible to compile and run an enterprise application on eclipse ? I'm not even sure if an .EAP file is a solution file or a program that can run . Can anyone lead me in the right direction and what is needed ? I have installed the necessary JDKs and JREs . Please help anyone .
tagged with: java
tagged with: eclipse
answer count: 3
has answer: http://stackoverflow.com/a/27387018
tagged with: compilation
has comment: http://stackoverflow.com/comment/43241462
favorite count: 0
has title: .EAP Enterprise Architecture
score: 0
tagged with: enterprise-architect

http://stackoverflow.com/comment/43227937
score: 2
comment on: http://stackoverflow.com/q/27389990
has text: Don't make your instance fields `static`!
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27462318
has comment: http://stackoverflow.com/comment/43361206
type: Question
linked to: http://stackoverflow.com/q/26533870
answer count: 1
favorite count: 0
score: 0
has answer: http://stackoverflow.com/a/27462367
accepted answer: http://stackoverflow.com/a/27462367
tagged with: android
has comment: http://stackoverflow.com/comment/43361000
upvote count: 1
downvote count: 1
has body: this is my MainActivity.java package com.calc.calculator; import android.os.Bundle; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.EditText; public class MainActivity extends ActionBarActivity { private EditText no1=(EditText) findViewById(R.id.editText1); private EditText no2=(EditText) findViewById(R.id.editText2); private EditText out=(EditText) findViewById(R.id.editText3); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } public void add(View view){ float output=Float.parseFloat(out.getText().toString()); float no1Value = Float.parseFloat(no1.getText().toString()); float no2Value = Float.parseFloat(no2.getText().toString()); float ans=Calc.Add(no1Value, no2Value); output.setText(String.valueOf(Calc.Add(no1Value, no2Value))); } @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); } } this is my Calc.java package com.calc.calculator; public class Calc { public static float Add(float no1,float no2){ return(no1+no2); } } i am trying to make a very simple app that calculates the sum of two nos. but it shows an error in Mainactivity.java at line 35 which is output.setText(String.valueOf(Calc.Add(no1Value, no2Value))); it says Cannot invoke setText(String) on the primitive data type float i am new to android development and i am stuck on this very beginner problem. pls help :D
has comment: http://stackoverflow.com/comment/43361081
has title: can resolve error in very basic android code
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/27356593
downvote count: 0
score: 1
has body: Error is saying that in your file location path there are few character which is not present in the utf-8 character set so the decoder is not able to decode the given file path and it is aborting the operation. see the characters in the location path and correct it if there are any unknown character present in that 'C:\Users\����\AppDa' here the ���� are showing that these characters are not able to decode by utf-8. edit: Check your string with this tool to see in which encoding your character set is encoded. link to tool then you can use that encoder but this is not a practical solution use utf-16 char set it is having large character set, and it vary by platform and language.
upvote count: 1
answers question: http://stackoverflow.com/q/27356306
has comment: http://stackoverflow.com/comment/43166401
type: Answer

http://stackoverflow.com/comment/43206388
type: AnswerComment
score: 0
type: Comment
has text: this works fine it is not throwing any exceptions but the record is not getting deleted in database.
comment on: http://stackoverflow.com/a/27378360

http://stackoverflow.com/comment/43092350
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27316159
has text: My tomcat deploys the war. Debug points doesnt help there, or? I tried @Controller, same problem

http://stackoverflow.com/q/27385887
has comment: http://stackoverflow.com/comment/43289158
has answer: http://stackoverflow.com/a/27399701
score: 1
has comment: http://stackoverflow.com/comment/43221988
tagged with: java
tagged with: indexoutofboundsexception
tagged with: sharedpreferences
type: Question
has comment: http://stackoverflow.com/comment/43220228
answer count: 2
has comment: http://stackoverflow.com/comment/43220036
has comment: http://stackoverflow.com/comment/43221252
has title: Sharedpreferences error index out of bounds
downvote count: 0
has answer: http://stackoverflow.com/a/27386901
tagged with: android
favorite count: 0
has comment: http://stackoverflow.com/comment/43225917
has body: I am trying to save an Arraylist in my with the method SharedPreferences. The problem i get is that my index is out of bounds but i don't see why: @Override public void onPause() { super.onPause(); // Always call the superclass method first data = getSharedPreferences(filename,0); SharedPreferences.Editor editor0 = data.edit(); editor0.putInt("shareddifficulty", difficulty); editor0.putInt("sharedmoves", moves); editor0.putInt("sharedpicture",resource); editor0.putInt("ID_size", ID.size()); for(int i=0;i&lt;ID.size();i++){ editor0.remove("ID_"+i); editor0.putInt("ID_" + i, ID.get(i)); } editor0.commit(); } public void onResume(){ super.onResume(); data = getSharedPreferences(filename,0); difficulty = data.getInt("shareddifficulty", 0); moves = data.getInt("sharedmoves",0); int listsize = data.getInt("ID_size", 0); resource = data.getInt("sharedpicture", 0); for(int i=0; i &lt; listsize;i++){ ID.set(i,data.getInt("ID_" + i,0)); } for(int i=0;i&lt;listsize;i++){ crops.set(ID.get(i),cropsshuffle.get((ID.get(i)))); } } The cropslist and ID list are of the same size. Because it's quite important to know how the arraylists look like i'm going to show the codes for crops and the code for ID: crops: Bitmap bmp = BitmapFactory.decodeResource(getResources(), resource); //Cropping the images and making a ID list that coincide with the cropped images. divideImages(bmp); with private void divideImages(Bitmap bmp) { int width = bmp.getWidth(); float w_ratio = (float) w/width; int scaledwidth = (int) (bmp.getWidth()*w_ratio); int scaledheight = (int) (bmp.getHeight()*w_ratio); Bitmap scaledbmp = Bitmap.createScaledBitmap(bmp,scaledwidth,scaledheight,true); switch(difficulty){ case 0: for(int i=0;i&lt;3;i++){ for(int j=0;j&lt;3;j++){ if(i==2 &amp;&amp; j==2){ Bitmap cropimage = Bitmap.createBitmap(scaledwidth/3,scaledheight/3,Bitmap.Config.ARGB_8888); crops.add(cropimage); cropimage = null; } else{ int startx = (int) ((scaledwidth*j)/3); int starty = (int) ((scaledheight*i)/3); Bit…
has comment: http://stackoverflow.com/comment/43226048
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43230788
has comment: http://stackoverflow.com/comment/43220220
upvote count: 1

http://stackoverflow.com/comment/43237288
type: AnswerComment
type: Comment
has text: Ok i see, but i need the base to stay the same. Only the hypothenuse and the thangent that changes? Would i still use Math.tan ?
comment on: http://stackoverflow.com/a/27394414
score: 0

http://stackoverflow.com/comment/43234699
score: 0
comment on: http://stackoverflow.com/q/27393619
has text: Hmm.. Seems like I will have to come up with a different way. Basically I'm receiving input from a user which they want to filter for. So I may have the fields `Origin` and `Destination`. If they give me an 'Origin' and 'Destination', I want to filter and return the objects that match the Origin and Destination fields. If they only give me one of them, for example Origin, then i want to return all the objects that match in the Origin field and ignore the Destination field.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27438961
downvote count: 0
score: 1
has body: Get the indexes of the placeholder in the pattern: int i = pattern.getIndexOf('$'); You'll must to iterate to obtain all the indexes: pattern.getIndexOf('$', lastIndex+1); The loop and the checks are up to you. Then use charAt with the indexes over each element of the set.
upvote count: 1
answers question: http://stackoverflow.com/q/27438667
type: Answer

http://stackoverflow.com/comment/43153130
score: 0
type: AnswerComment
type: Comment
has text: @TavianBarnes Regarding the compilation, thx for pointing out, I've edited my answer (I should've place a disclaimer I coded from my head w/o compiling it actually). Regarding "just do bind(double[][].class).toInstance(MY_MATRIX)" , this will inject *ANY* double matrix (if it will appear in the code) to the instance, this could lead to troubles hence annotations which restricts the injection scope (so to speak) is better
comment on: http://stackoverflow.com/a/27343799

http://stackoverflow.com/a/27346659
has body: When you do slot1 = new JLabel(getImage()); slot2 = new JLabel(getImage()); slot3 = new JLabel(getImage()); slot4 = new JLabel(getImage()); you're not changing the GUI. You're updating the values of the slotX variables. You should also replace the actual components in the GUI tree. Try making CardsPanel a member variable, and do CardsPanel.removeAll(); CardsPanel.add(new JLabel(getImage())); CardsPanel.add(new JLabel(getImage())); CardsPanel.add(new JLabel(getImage())); CardsPanel.add(new JLabel(getImage()));
downvote count: 0
type: Answer
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27346629

http://stackoverflow.com/a/27429386
type: Answer
has body: The habit may be akin to certain types of arrays in languages such as C which use null bytes to serve as terminating "sentinels" to indicate the end of an array; an example would be "C-strings", which take the form char[] or char *. That being said, Java is not C, and why the author chooses to do this eludes me. It's misleading and would absolutely be considered bad practice. Your remark on doing this to mitigate ArrayOutOfBounds exceptions could be correct too, but creating an array of a different size than intended is not the proper way to go about it. EDIT: Based on the example you've given, I would say that the application for this habit of creating "misleadingly-sized" arrays is nothing more than a function of the problem that the code is designed to solve. For instance, it's possible that the DynQueue is being constructed this way because the first or last index represents data that is to be differentiated from the rest of the data in the array somehow... perhaps q[0] (the first element of the queue) represents the char that is the 'next' to be considered in some algorithm or processing (it's at the "front of the line" so to speak), but has not been cleared out of the array yet. (That still doesn't change the fact that the way it is done is questionable.)
score: 5
downvote count: 0
upvote count: 5
answers question: http://stackoverflow.com/q/27429009

http://stackoverflow.com/q/27345064
has answer: http://stackoverflow.com/a/27687192
score: 0
answer count: 1
has title: How to print the directory tree from the list of strings?
has comment: http://stackoverflow.com/comment/43176910
has comment: http://stackoverflow.com/comment/43146573
favorite count: 0
linked to: http://stackoverflow.com/q/3154488
has comment: http://stackoverflow.com/comment/43145490
has comment: http://stackoverflow.com/comment/43150421
accepted answer: http://stackoverflow.com/a/27687192
has comment: http://stackoverflow.com/comment/43146156
type: AnsweredQuestion
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43220381
has body: I'm looking for a library that could help me to print the directory tree from the list of strings. List "/a/b/c/file1.txt" "/a/b/c/file2.txt" "/a/b/file3.jpg" and so on...
has comment: http://stackoverflow.com/comment/43145597

http://stackoverflow.com/q/27433414
possible better answer: http://stackoverflow.com/a/27433504
tagged with: android
accepted answer: http://stackoverflow.com/a/27435320
type: AnsweredQuestion
has title: Android - Errors when trying to change activities
tagged with: java
has comment: http://stackoverflow.com/comment/43309296
has body: For some reason this came up when trying to switch activities. I've had no problem running the same kind of code with other activities in this project. I'll post the code and see if anyone can figure it out ;( I can't get my error to format right in this, so here's the error log http://textuploader.com/oe6g Here's my different activities. The Problem occurs when I click on the button in my New Game Activity Layout, and that button runs the confirm(View view) NewGameActivity.java public class NewGameActivity extends Activity { EditText title; TextView team1, team2; SqliteHelper db; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_newgame); //ListViews team1 = (TextView) findViewById(R.id.textView4); team2 = (TextView) findViewById(R.id.textView5); title = (EditText) findViewById(R.id.editText1); db = new SqliteHelper(this.getApplicationContext()); populateListViews(); registerClickCallback(); } /* * * Database Functions * */ /* * * ListView Stuff * */ private void populateListViews() { // THIS HERE WILL POPULATE BOTH TEAM LIST VIEWS //Create list of items Cursor cursor = db.getTeams(); ArrayList&lt;String&gt; values = new ArrayList&lt;String&gt;(); if (cursor != null &amp;&amp; cursor.getCount() != 0) { cursor.moveToFirst(); while (!cursor.isAfterLast()) { values.add(cursor.getString(cursor.getColumnIndex("Team_Names"))); cursor.moveToNext(); } } //Build Adapter ArrayAdapter&lt;String&gt; t1adapter = new ArrayAdapter&lt;String&gt;( this, // Context R.layout.teamlistviews, // Layout to use values); // Items to be displayed ArrayAdapter&lt;String&gt; t2adapter = new ArrayAdapter&lt;String&gt;( this, // Context R.layout.teamlistviews, // Layout to use values); //Configure the List View ListView t1list = (ListView) findViewById(R.id.listView1); t1list.setAdapter(t1adapter); ListView t2list = (ListView) findViewById(R.id.listView2); t2list.setAdapter(t2adapter); } private void registerClick…
type: Question
has answer: http://stackoverflow.com/a/27433504
has answer: http://stackoverflow.com/a/27435320
has answer: http://stackoverflow.com/a/27436953
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/43307996

specifications
type: Tag
tag name: specifications
tags question: http://stackoverflow.com/q/27464511
tags question: http://stackoverflow.com/q/27441825

http://stackoverflow.com/comment/43348424
type: QuestionComment
comment on: http://stackoverflow.com/q/27455245
has text: You said it's: not working as intended. What actually happens?
score: 0
type: Comment

http://stackoverflow.com/q/27340479
score: 0
accepted answer: http://stackoverflow.com/a/27340492
tagged with: sqlite
answer count: 1
has body: I am new to Android language. My SQLite database is missing a column which I do not where is it. logcat returns sqlite returned: 12-07 01:38:03.337: E/AndroidRuntime(1218): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.myrecordapps/com.example.myrecordapps.Subject}: java.lang.IllegalArgumentException: column '_id' does not exist I cannot access my activity of Subject when I try to access it. I had use listView in my Subject to show all my data insert in my table. The error show me is my database problem. can someone help? coding below: Subject.java DBHandlerCourse adapter_ob; DBHelperCourse helper_ob; SQLiteDatabase db_ob; ListView nameList; Button registerBtn; Cursor cursor; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.subject); nameList = (ListView) findViewById(R.id.list); registerBtn = (Button) findViewById(R.id.addsubject); adapter_ob = new DBHandlerCourse(this); String[] from = { DBHelperCourse.KEY_COURSE_NAME, DBHelperCourse.KEY_COURSE_CODE, DBHelperCourse.KEY_START_TIME}; int[] to = { R.id.coursename, R.id.coursecode, R.id.starttime }; cursor = adapter_ob.queryName(); @SuppressWarnings("deprecation") SimpleCursorAdapter cursorAdapter = new SimpleCursorAdapter(this, R.layout.row, cursor, from, to); nameList.setAdapter(cursorAdapter); nameList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub Bundle passdata = new Bundle(); Cursor listCursor = (Cursor) arg0.getItemAtPosition(arg2); int nameId = listCursor.getInt(listCursor .getColumnIndex(DBHelperCourse.KEY_ID)); Toast.makeText(getApplicationContext(),Integer.toString(nameId), 500).show(); passdata.putInt("keyid", nameId); Intent passIntent = new Intent(Subject.this, EditCourse.class); passIntent.putExtras(passdata); startActivity(passIntent); } }); registerBtn.setOnClickList…
tagged with: android
tagged with: java
has title: Where is my missing column in Database in android?
has answer: http://stackoverflow.com/a/27340492
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/43271337
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27413585
type: Comment
has text: give you vote up for mentioning conditional statement

http://stackoverflow.com/a/27449879
has body: You can set the EXTRA_OUTPUT extra on the intent to tell whatever app responds to the intent where to put the file.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27449127

http://stackoverflow.com/q/27318354
tagged with: user-interface
accepted answer: http://stackoverflow.com/a/27318698
tagged with: awt
score: 0
possible better answer: http://stackoverflow.com/a/27318682
has answer: http://stackoverflow.com/a/27318682
has title: Why won't my swing GUI launch from the main class
tagged with: swing
has comment: http://stackoverflow.com/comment/43096604
type: AnsweredQuestion
tagged with: java
has body: The problem that I'm facing is that when i launch the program from the GUImain class it will work with no problem but when i try and call it up from the main class nothing opens. The only message i get from the console is: &lt;terminated&gt; Main [Java Application] /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/bin/java (5 Dec 2014 14:39:29) This is my main class code: public class Main { public static void main(String[] args) { int i = 0; int t = 0; int st = 0; int h = 0; Texts textObject = new Texts(); textObject.TextList(); Commands commandObject = new Commands(); commandObject.commands(); GUImain guiObject = new GUImain(); } } This is my GUImain class import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JButton; import javax.swing.JList; import javax.swing.JTextPane; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.JScrollBar; import javax.swing.JTextField; public class GUImain { private JFrame frame; private JTextField textField; //Launch the application. public static void main(String[] args) { GUImain window = new GUImain(); window.frame.setVisible(true); } //Create the application. public GUImain() { frame = new JFrame(); frame.setBounds(100, 100, 611, 471); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); JButton btnInventory = new JButton("Inventory"); btnInventory.setBounds(514, 6, 91, 29); frame.getContentPane().add(btnInventory); JButton btnLoad = new JButton("Load"); btnLoad.setBounds(453, 6, 68, 29); frame.getContentPane().add(btnLoad); JButton btnSave = new JButton("Save"); btnSave.setBounds(404, 6, 54, 29); frame.getContentPane().add(btnSave); JButton btnOptions = new JButton("Options"); btnOptions.setBounds(335, 6, 76, 29); frame.getContentPane().add(btnOptions); JTextArea History = new JTextArea(); History.setText("lol"); History.setBounds(6, 6, 329, 343); frame.getContentPane().add(History); JButton btnEnter = new JButton("Enter"); btnEnt…
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/27318698
answer count: 2

http://stackoverflow.com/comment/43234769
comment on: http://stackoverflow.com/q/27393795
has text: You probably could use a BoxLayout for this as well. C.f. `Box.createVerticalBox()`.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43169845
score: 0
type: Comment
type: QuestionComment
has text: ID column is needed in the query but not needed to be visible when showing data. OK, I need to digest info ;) thanks for replies.
comment on: http://stackoverflow.com/q/27358576

http://stackoverflow.com/a/37974564
score: 0
type: Answer
has body: I had the same problem. I did the following to fix: delete the server create a new server when asking for "Server's host name", using "127.0.0.1" instead of "localhost" (same as the answer of Clueless) start the server. This time it worked. delete the server again create a new server and use "localhost" for "Server's host name".
answers question: http://stackoverflow.com/q/27443028

http://stackoverflow.com/comment/43266023
has text: no empty i want to add the records string to it
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27410803
type: QuestionComment

http://stackoverflow.com/comment/43178944
type: Comment
score: 0
has text: Someone write it and show what you mean. I tried the variable and it was giving me errors. This is just making me pull out my hair.
type: AnswerComment
comment on: http://stackoverflow.com/a/27362882

http://stackoverflow.com/comment/43511591
score: 0
comment on: http://stackoverflow.com/a/27491063
type: AnswerComment
type: Comment
has text: I didnt decide yet. I thought those would be overkill for my purpose.

http://stackoverflow.com/comment/43159026
has text: Thanks.. :) I will be adding it in a for loop.
comment on: http://stackoverflow.com/a/27352617
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27352760
tagged with: hashmap
linked to: http://stackoverflow.com/q/2773824
tagged with: hashset
has comment: http://stackoverflow.com/comment/43159196
duplicate of: http://stackoverflow.com/q/2773824
answer count: 1
has answer: http://stackoverflow.com/a/27352789
has comment: http://stackoverflow.com/comment/43159212
favorite count: 0
has comment: http://stackoverflow.com/comment/43159213
type: UnansweredQuestion
score: -1
has title: Java Collection HashSet vs HashMap
has body: I have Question regarding the best practice of using a Collection regarding the memory. I need to call a method which returns pairs of (Key,Value) frequently, so which way is the best, using HashMap or creating an Object that contains Key and value and save this object in a HashSet? Thanks &amp; Regards.
has comment: http://stackoverflow.com/comment/43159621
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/43160235
has comment: http://stackoverflow.com/comment/43162614
upvote count: 1
tagged with: memory
tagged with: collections
type: Question

http://stackoverflow.com/a/27338291
downvote count: 0
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27335002
score: 1
answers question: http://stackoverflow.com/q/27335002
has body: By using the /tags/tag-name/media/recent API endpoint and providing a count parameter you can receive more than 20 photos doing the pagination. There are no API endpoints to get all the tags for a specified user. You may query all the media posted by that user (/users/user-id/media/recent) and extract the used hashtags.
type: AcceptedAnswer

http://stackoverflow.com/comment/43143620
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27344062
has text: I think you're mad going with a 4 dimensional array! I would stick to 2 dimensions so you have a 20x20 grid then if you want to `goEast()` you would increment the position of the array like `pos[0][0] -> pos[0][1]` - So you move east by one (I'm using pseudo code)

http://stackoverflow.com/q/27397114
tagged with: java
has answer: http://stackoverflow.com/a/27397256
type: Question
has body: I have ten array list with words. I want to create another array list with 2 fields, word, int=in how many array list it occurred. ArrayList&lt;String&gt; text1; ArrayList&lt;String&gt; text2; ArrayList&lt;String&gt; text3; ArrayList&lt;String&gt; text4; ArrayList&lt;String&gt; text5; ArrayList&lt;String&gt; text6; ArrayList&lt;String&gt; text7; ArrayList&lt;String&gt; text8; ArrayList&lt;String&gt; text9; ArrayList&lt;String&gt; text10; I want result like apple 3 banana 8 cucumber 5 ...
has answer: http://stackoverflow.com/a/27397377
tagged with: arraylist
score: 0
possible better answer: http://stackoverflow.com/a/27398059
accepted answer: http://stackoverflow.com/a/27397256
has answer: http://stackoverflow.com/a/27398059
has title: Count occurrences in arraylist and create another arraylist
has answer: http://stackoverflow.com/a/27397476
tagged with: dictionary
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/a/32361943
answers question: http://stackoverflow.com/q/27438314
score: 1
upvote count: 1
has body: @RequestMapping annotation makes controller to be initialized eagerly despite the fact that it is also annotated with @Lazy(value=true). In your case, removing @RequestMapping annotation should make the controller initialize lazily. Though I do not know if it is possible to use @RequestMapping annotation and have that controller load lazily, I did not manage to achieve it (solved my issue without making the controller load lazily, but that is out of scope of this question).
downvote count: 0
type: Answer

http://stackoverflow.com/comment/43250390
comment on: http://stackoverflow.com/q/27402877
score: 1
has text: `java email1.EmailAttachmentSender` should be the correct invocation (from the folder containing `email1` folder which contains `EmailAttachmentSender.class`). Could you share the error message for that?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27444683
type: AnsweredQuestion
has title: mvn clean install Could not find artifact
score: 1
favorite count: 0
tagged with: maven
upvote count: 1
answer count: 1
accepted answer: http://stackoverflow.com/a/27444858
tagged with: java
downvote count: 0
has body: Could not find artifact oswego-concurrent:concurrent:jar:1.3.4-jboss-update1 in gtrepositories -&gt; [Help 1] [ERROR] What does this mean? How do I correct this? Does this mean that file is missing in the repo? I find that hard to believe because lots of people use jboss with maven.
type: Question
has answer: http://stackoverflow.com/a/27444858

http://stackoverflow.com/q/27472985
tagged with: orm
type: Question
tagged with: jpa
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/27474186
favorite count: 0
has comment: http://stackoverflow.com/comment/43380597
has title: Use Hibernate to save objects to the database
upvote count: 1
has answer: http://stackoverflow.com/a/27474186
type: AnsweredQuestion
has body: In my java application I have some serialized entity classes with inheritance. When saving instances of these classes i am converting them to a byte array and saving to a longblob column in my database table. Is there any advantage using hibernate to implement this program. Because as far I understand hibernate is used to map entities with database tables in a proper way. But here I don't have a relational model to map attributes of entities. I am saving them as objects. Am I missing something. Please clarify me. Thanks in advance.
score: 1
tagged with: java
tagged with: hibernate
tagged with: database

m2e
type: Tag
tag name: m2e
tags question: http://stackoverflow.com/q/27419257
tags question: http://stackoverflow.com/q/27447077

http://stackoverflow.com/comment/43214665
type: Comment
has text: Yeah, I know it, so my question is a quite theoretical. But in some other languages (like PHP), it's very easy to do this thing. I just want to know, how to do some flexible things like this.
type: AnswerComment
comment on: http://stackoverflow.com/a/27382949
score: 0

http://stackoverflow.com/a/27473527
score: 2
downvote count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/43381560
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27473519
has body: Yes. You can catch the unchecked exception and throw a checked exception. Example : public void setID (String id) throws SomeException { if (id==null) throw new SomeException(); try { setID (Integer.valueOf (id)); } catch (NumberFormatException intEx) { // catch unchecked exception throw new SomeException(id, intEx); // throw checked exception } } Then, in the constructor of the checked exception, you call initCause with the passed exception : public SomeException (String id, Throwable reason) { this.id = id; initCause (reason); }
type: Answer
answers question: http://stackoverflow.com/q/27473519

http://stackoverflow.com/a/27455544
type: Answer
downvote count: 0
has body: The infinite recursion can be explained in the following way: The infinite recursion is caused by the call B.m1(). Class BClass extends AClass,so BClass inherits both the public methods of AClass i.e. methods m1 and m2. So the method call B.m1() calls the method m1 of BClass which it inherits from classA. Inside m1() the call this.m2() is actually equivalent to B.m2().Thus it calls the overridden method m2() from BClass because the overridden method has more priority than the method originally implemented in the super class.But when m2 in BClass is called, it in turn calls method m1() of AClass again via super.m1() and it in turn again calls overridden method of BClass via this.m2().This causes infinite recursion.
score: 1
answers question: http://stackoverflow.com/q/27455037
upvote count: 1

http://stackoverflow.com/a/27456383
has comment: http://stackoverflow.com/comment/43350424
has body: Since the if statement is the very last thing that needs to be done you can just execute it after the for loop with some little tweaks. public void actionPerformed(ActionEvent event) { String getStringChar = event.getActionCommand(); char c = getStringChar.charAt(0); int arrayLength = Game.labelArray.length; for(int i = 0; i &lt; arrayLength; i++) { if(Game.labelArray[i].getText().contains(""+ c)) { Game.labelArray[i].setVisible(true); } } if(!(Game.labelArray[arrayLength-1].getText().contains(""+ c))) { score++; Game.setImage(score); } }// end method actionPerformed UPDATE AFTER COMMENT public void actionPerformed(ActionEvent event) { String getStringChar = event.getActionCommand(); char c = getStringChar.charAt(0); int arrayLength = Game.labelArray.length; containsCharacter = false for(int i = 0; i &lt; arrayLength; i++) { if(Game.labelArray[i].getText().contains(""+ c)) { Game.labelArray[i].setVisible(true); containsCharacter = true } } if(!containsCharacter) { score++; Game.setImage(score); } }// end method actionPerformed
has comment: http://stackoverflow.com/comment/43350423
has comment: http://stackoverflow.com/comment/43350271
score: 1
has comment: http://stackoverflow.com/comment/43350340
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27456286
answers question: http://stackoverflow.com/q/27456286
has comment: http://stackoverflow.com/comment/43350232
has comment: http://stackoverflow.com/comment/43350481
has comment: http://stackoverflow.com/comment/43350445
type: Answer
upvote count: 1

http://stackoverflow.com/a/27455341
score: 0
has body: A.m1() -->Prints "A.m1()" because you are calling this method from you the main method. A.m1() method also calls this.m2() inside it. This will go in the method m2() and print -->"A.m2()" **Note that this.m2() is the same thing as just calling m2(). A.m2() -->Prints "A.m2()" because you are calling this method from the main. Now for the slightly tricky part. B.m1(), As you can see, BClass does not have a m1() method but it inherits it from AClass. By inheriting from AClass, BClass Have (internally) all the public and protected methods of AClass. This means BClass now has a m1() method (the same one as AClass). Therefore, calling B.m1() will print AClass m1() --> "A.m1()". Now remember that A.m1() also calls this.m2() inside of it. But since BClass also have an m2() method, Java will use that one instead and this will end up printing --> "B.m2()".
type: Answer
answers question: http://stackoverflow.com/q/27455037

clientbundle
tags question: http://stackoverflow.com/q/27432635
tag name: clientbundle
type: Tag

android-volley
tags question: http://stackoverflow.com/q/27400261
tags question: http://stackoverflow.com/q/27376750
type: Tag
tag name: android-volley
tags question: http://stackoverflow.com/q/27341848

http://stackoverflow.com/q/27452344
has title: Tomcat 7.0 HTTP post request utf-8 issues with windows server 2008 R2
score: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27494180
has body: I have a very strange issue, I have a web app (JSP file) on Tomcat 7.0 instance. I can't figure out why it is not sending POST UTF-8 request correctly. I have installed it on windows server 2008 R2. I have configured all those needed settings in server.xml and web.xml, such as URIEncoding=UTF-8 for tags and setting filter in web.xml. inside my JSP, I am calling a .Net web service which accepts POST method: private String urlcallPOST(String content){ String result=""; try { String urlParameters = "&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://tempuri.org/\"&gt;"+ " &lt;SOAP-ENV:Body&gt;"+ " &lt;ns1:Message&gt;"+ " &lt;ns1:contentList&gt;"+ " &lt;ns1:string&gt;"+content+"&lt;/ns1:string&gt;"+ " &lt;/ns1:contentList&gt;"+ " &lt;/ns1:Message&gt;" + " &lt;/SOAP-ENV:Body&gt;" + "&lt;/SOAP-ENV:Envelope&gt;"; URL url = new URL("http://theIP/webservice.asmx"); URLConnection connection = url.openConnection(); connection.setDoOutput(true); connection.setDoInput(true); connection.setRequestProperty("Content-Type","text/xml; charset=utf-8"); connection.setRequestProperty("SOAPAction", "\"http://tempuri.org/Message\""); byte[] buf = urlParameters.getBytes(); DataOutputStream os = new DataOutputStream(connection.getOutputStream()); os.write(buf, 0, buf.length); BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); String line = null; while ((line = reader.readLine()) != null) { System.out.println(line); } reader.close(); os.close(); } catch(Exception e) { } return result; } I have used meta tag and defined charset=utf-8 and also used: request.setCharacterEncoding("UTF-8"); before any request. I have created one folder called GetMine inside webapps inside tomcat 7.0.57. and copied this jsp file there. When I call the urlCallPOST method with content="some utf-8 Arabic text" it shows ???? inside Tomcat's log folder in stdout fi…
tagged with: java
type: Question
tagged with: windows-server-2008-r2
answer count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/43349564
tagged with: tomcat
has comment: http://stackoverflow.com/comment/43345584
tagged with: utf-8
has comment: http://stackoverflow.com/comment/43349909

http://stackoverflow.com/q/27434276
possible better answer: http://stackoverflow.com/a/27434414
has comment: http://stackoverflow.com/comment/43309945
type: Question
has answer: http://stackoverflow.com/a/27434619
has body: I am practicing and I want to create a code with a infinite loop the while loop, but my problem is that I don't know how to compare char or read char from the keyboard. So, far I have done the code below, any suggestions please ? Scanner keyboard = new Scanner(System.in); System.out.println("Guess my favorite character: "); String letter = keyboard.nextLine(); char secret = 'a'; while (true) { System.out.println(" Enter guess:"); String guess = keyboard.nextLine(); for (int i = 0; i &lt; guess.length(); i++) { if (guess.chartAt(i).equals('a')) { break; } } System.out.println("YOU got it!"); } } }
has title: trouble with char in java
answer count: 3
tagged with: while-loop
upvote count: 0
has comment: http://stackoverflow.com/comment/43309497
favorite count: 0
accepted answer: http://stackoverflow.com/a/27434619
score: -3
has comment: http://stackoverflow.com/comment/43309913
has answer: http://stackoverflow.com/a/39354859
has answer: http://stackoverflow.com/a/27434414
type: AnsweredQuestion
tagged with: java
downvote count: 3

http://stackoverflow.com/comment/43335172
type: Comment
comment on: http://stackoverflow.com/a/27429869
has text: I wish this worked but it didn't. Exactly the same error is thrown.
score: 0
type: AnswerComment

http://stackoverflow.com/a/27335543
type: Answer
has body: Well, two things - 1) I do not get why you have both execute() and executeQuery() in your method? I think executeQuery() should work for you. 2) Do not close the statement before iterating through resultset. Make it an instance variable and close it after iterating.
answers question: http://stackoverflow.com/q/27335451
score: 0

http://stackoverflow.com/comment/43234675
comment on: http://stackoverflow.com/a/27393713
has text: @paxdiablo Thanks for your answer. Do you have a guess for what exactly would be happening when I use the bitwise operator, and why that screws up things at runtime?
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27390195
tagged with: java
has answer: http://stackoverflow.com/a/27390250
has title: Random Number Generator Using Arrays With No Duplicates
type: Question
tagged with: arrays
tagged with: duplicates
duplicate of: http://stackoverflow.com/q/4040001
score: 0
has comment: http://stackoverflow.com/comment/43228400
tagged with: random
answer count: 1
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43228422
linked to: http://stackoverflow.com/q/4040001
tagged with: numbers
has body: I'm in the process of creating a program that generates 50 random numbers between 1-999, but I can't figure out how to stop duplicates from showing up in the program. Any help would be appreciated. public class Random50 //Name of my class { public static void main(String[] args) { int[] randomArray; //Declares a new array of integers randomArray = new int[51]; Random rand = new Random(); for (int i = 1; i &lt; randomArray.length; i++) { int n = rand.nextInt(1000); randomArray[i] = n; } for (int i = 1; i &lt; randomArray.length; i++) 4 { System.out.printf("Number " + i + ": " + "%03d\n", randomArray[i]); } } }
has comment: http://stackoverflow.com/comment/43228490

http://stackoverflow.com/q/27389775
tagged with: hash
answer count: 0
has comment: http://stackoverflow.com/comment/43227463
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43227839
has body: I am looking for two hash functions for hashing strings in Java. Can anyone suggest some functions that are already written in Java for this? I already looked here but I am not sure how to implement them in Java. Thanks.
has comment: http://stackoverflow.com/comment/43227832
tagged with: java
has title: What are some good hash functions for getting hash values of a string in Java?
type: Question
has comment: http://stackoverflow.com/comment/43229318
tagged with: function
score: 0
linked to: http://stackoverflow.com/q/2624192
has comment: http://stackoverflow.com/comment/43227477
has comment: http://stackoverflow.com/comment/43227503

http://stackoverflow.com/q/27348231
accepted answer: http://stackoverflow.com/a/29195446
type: Question
has title: FXCollections.reverse throwing UnsupportedOperationException
has comment: http://stackoverflow.com/comment/43151335
score: 0
has comment: http://stackoverflow.com/comment/43153012
answer count: 1
has comment: http://stackoverflow.com/comment/43208180
has comment: http://stackoverflow.com/comment/43151525
has comment: http://stackoverflow.com/comment/43151834
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43151225
has body: I am using FXCollections.reverse on a ObservableList created using FXCollections.observableArrayList(), and the method throws an UnsupportedOperationException. I have even tried to reverse a list created using FXCollections.observableList(list), with different types of list, bu the reverse method keeps throwing the exception. I am missing something? P.S. I am using JavaFX on Linux.
tagged with: java
tagged with: javafx
has answer: http://stackoverflow.com/a/29195446

http://stackoverflow.com/q/27434549
tagged with: imageicon
has comment: http://stackoverflow.com/comment/43310015
has comment: http://stackoverflow.com/comment/43310270
has title: Can't add JLabel to JPanel
has comment: http://stackoverflow.com/comment/43310205
type: AnsweredQuestion
tagged with: jlabel
has answer: http://stackoverflow.com/a/27434598
upvote count: 1
tagged with: swing
accepted answer: http://stackoverflow.com/a/27434707
has comment: http://stackoverflow.com/comment/43310031
type: Question
possible better answer: http://stackoverflow.com/a/27434598
tagged with: java
has comment: http://stackoverflow.com/comment/43310074
answer count: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43310142
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43310184
has body: I have this code: ImageIcon ii = new ImageIcon("https://c1.staticflickr.com/9/8384/8682624224_4e44bf947d_h.jpg"); subStream.add(new JLabel(ii)); It's meant to add JLabel with photo to JPanel called subStream. But it doesn't work, no errors or anything. Why so? Image is supposed to appear in 3rd JPanel, just above Buttons.
has answer: http://stackoverflow.com/a/27434707

http://stackoverflow.com/a/27396777
type: Answer
has comment: http://stackoverflow.com/comment/43420179
score: 2
has comment: http://stackoverflow.com/comment/43342071
has comment: http://stackoverflow.com/comment/43353491
has comment: http://stackoverflow.com/comment/43324055
has comment: http://stackoverflow.com/comment/43391935
has comment: http://stackoverflow.com/comment/43369075
type: AcceptedAnswer
downvote count: 0
has body: EDIT Shows example of how to color cells based on the time, if time remaining is less or equal to five minutes, the cell becomes red. First, you need to create a custom renderer class, which will be used by your table. This class will contain the logic for coloring of cells, eighter red, or default white: static class CustomRenderer extends DefaultTableCellRenderer { @SuppressWarnings("compatibility:-3065188367147843914") private static final long serialVersionUID = 1L; @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component cellComponent = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); //get the current cell component //get the time as String from the current cell at position (row,column) //if the string value of time is less than the string representing 5 minutes color it red, else white. //Because of lexicographic alphabet sorting, we can compare the strings correctly like this String time = (String) table.getValueAt(row, column); if (time!=null &amp;&amp; time.compareTo("00:05:00") &lt;= 0) { cellComponent.setBackground(Color.RED); } else { cellComponent.setBackground(Color.WHITE); } return cellComponent; } } Next, you need to tell your table to use this new custom renderer: tableModel = new DefaultTableModel(rowData, columnNames); table = new JTable(tableModel); int columnCount = table.getColumnModel().getColumnCount(); //get number of columns //for each column apply the custom rendered for (int i = 0; i &lt; columnCount; i++) { table.getColumnModel().getColumn(i).setCellRenderer(new CustomRenderer()); } And that's it! Now the cells will be red or not depending on the time. I edited the original answer with this modification, you can test and run the code below: Adapt this to your needs. import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.event.WindowAdapter; import java.awt.event.…
has comment: http://stackoverflow.com/comment/43349175
answers question: http://stackoverflow.com/q/27337800
upvote count: 2
has comment: http://stackoverflow.com/comment/43433054
accepted answer of: http://stackoverflow.com/q/27337800

http://stackoverflow.com/comment/43384821
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27470291
has text: I'm not sure what you mean. Where do you need to use a collection? Perhaps some other part of the assignment would benefit from a collection. Maybe you should add the complete definition of your assignment to your original question.
type: AnswerComment

http://stackoverflow.com/comment/43264441
type: Comment
comment on: http://stackoverflow.com/a/27410035
has text: Worth pointing out that if you take the error text and Google for it, this page is the first result...
score: 0
type: AnswerComment

http://stackoverflow.com/q/27383172
tagged with: java
upvote count: 1
tagged with: http://stackoverflow.com/tag/jpeg
type: Question
has body: My problem is I am trying to insert a large amount of RDF data into a jpeg image, specifically into the XMP headers. The RDF is specific to my application, with custom namespaces etc. However this should not affect the process of inserting RDF. I can do this with a small amount of RDF data, however I reach the XMP packet size limit when I try to insert anything larger. I am using Java and the Apache Sanselan lib, however I'm open to use other libs. Below is the code I am using in a test app to do this, however I do not know how to split it over multiple XMP packets in order for me to insert all the data I need to. Any help or pointers in the right direction would be greatly appreciated :) Thanks private static File writeXmpToFile(File file, String xmpXmlAsString) throws FileNotFoundException, ImageReadException, IOException, ImageWriteException { String XmpXmlAsString = xmpXmlAsString; File fileWithXmpXml = new File(file.getParent(), file.getName()+ ".added-xmp" + ".jpg"); OutputStream os = null; try { os = new BufferedOutputStream(new FileOutputStream(fileWithXmpXml)); new JpegXmpRewriter().updateXmpXml(new ByteSourceFile(file), os, XmpXmlAsString); } finally { if (os != null) { os.close(); } os = null; } return fileWithXmpXml; }
tagged with: xmp
has comment: http://stackoverflow.com/comment/43259509
has answer: http://stackoverflow.com/a/28865855
has comment: http://stackoverflow.com/comment/43226767
answer count: 1
downvote count: 0
favorite count: 0
tagged with: http://stackoverflow.com/tag/rdf
has comment: http://stackoverflow.com/comment/43260795
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/23253281
has title: Inserting large amount of XMP data into jpg using multiple packets?
score: 1

http://stackoverflow.com/comment/43136648
comment on: http://stackoverflow.com/q/27340180
type: QuestionComment
type: Comment
score: 1
has text: When `str` is `""`, what do you expect `str.substring(1, str.length())` will do?

http://stackoverflow.com/comment/43394756
has text: @MartijnPieters - True, but it's good practice in my opinion.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27465761

http://stackoverflow.com/a/27393678
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27393654
has comment: http://stackoverflow.com/comment/43234586
accepted answer of: http://stackoverflow.com/q/27393654
type: Answer
has body: The + operator is heavily overloaded. It takes almost anything. If either side is a String, then the other will be converted to a String. That works with char as well as for other primitive types. For Objects, toString() is called (after a null-check).
has comment: http://stackoverflow.com/comment/43256994
score: 4
upvote count: 4

http://stackoverflow.com/a/27464671
has body: A X&lt;? super Y&gt; is an object of type X that may consume objects of type Y (i.e. Y is the parameter type of methods of X). A X&lt;? extends Y&gt; is an object of type X that may produce objects of type Y (i.e. Y is the return type of methods of X). So, a List&lt;? super Goods&gt; is a list where you can add any instance of Goods, which is List&lt;Goods&gt; or List&lt;Object&gt;. This do not includes List&lt;Bed&gt; because you can't add any instance of Goods there, just some (i.e. those who happens to be instances of the Bed subclass). A List&lt;? extends Goods&gt; is a list from where you can retrieve Goods, which is List&lt;Goods&gt;, List&lt;GoodPackage&gt; or List&lt;Bed&gt;. Whatever is the item retrieved from the list, it will always be an instance of Goods (or some of its subclass). So I think that you really wanted to use List&lt;? extends Goods&gt; instead of List&lt;? super Goods&gt;: class GoodPackage extends Goods { private List&lt;? extends Goods&gt; goodsInside; @Override public Integer interpret(CurrentPricesContext context) { int totalSum = 0; for (Goods goods : goodsInside) { totalSum += goods.interpret(context); } return totalSum; } public List&lt;? extends Goods&gt; getGoodsInside() { return goodsInside; } public void setGoodsInside(List&lt;? extends Goods&gt; goodsInside) { this.goodsInside = goodsInside; } } And about this for loop: for (Iterator&lt;? super Goods&gt; iter = goodsInside.iterator(); iter.hasNext(); iter.next()) { Goods good = (Goods) iter.next(); totalSum += good.interpret(context); } It has two problems: It will give a ClassCastException if you got a List&lt;Object&gt; with something that is not Goods inside (like a String or a Cat). You are calling the next() method twice. This will result in it interpreting only the odd-numbered items and will throw a NoSuchElementException if the list has an even number of elements. The equivalent, without using the enhanced-for syntax would be this: for (Iterator&lt;? extends Goods&gt; it…
type: Answer
accepted answer of: http://stackoverflow.com/q/27464042
answers question: http://stackoverflow.com/q/27464042
upvote count: 1
score: 1
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27378051
has body: Replace statement.executeQuery( "SELECT \"*\" FROM \"kunden\"" + "WHERE (\"Sozialversicherungsnummer\" = '" + SVN + "')" ); With statement.executeQuery( "SELECT * FROM kunden WHERE Sozialversicherungsnummer='" + SVN +"'" ); Also you can optimize your code in the exception blocks. Instead of String i= "Kann nicht gefunden werden"; return i; You can return "Kann nicht gefunden werden";
has comment: http://stackoverflow.com/comment/43235129
answers question: http://stackoverflow.com/q/27377802
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43228255

http://stackoverflow.com/comment/43238802
type: QuestionComment
comment on: http://stackoverflow.com/q/27396288
has text: have you checked the option *build automatically*?
score: 0
type: Comment

http://stackoverflow.com/comment/43287458
type: Comment
type: QuestionComment
score: 0
has text: https://tomcat.apache.org/maven-plugin-trunk/run-mojo-features.html
comment on: http://stackoverflow.com/q/27421783

http://stackoverflow.com/a/27360627
type: Answer
has comment: http://stackoverflow.com/comment/43173904
has comment: http://stackoverflow.com/comment/43174037
has body: This line effectively turns test classes into production classes: sourceSets.test.output.classesDir = sourceSets.main.output.classesDir. Remove this line, it shouldn't be needed.
has comment: http://stackoverflow.com/comment/43203827
answers question: http://stackoverflow.com/q/27359845
score: 0

http://stackoverflow.com/q/27439860
accepted answer: http://stackoverflow.com/a/27439956
answer count: 3
has comment: http://stackoverflow.com/comment/43319617
tagged with: arrays
possible better answer: http://stackoverflow.com/a/27439949
favorite count: 0
has answer: http://stackoverflow.com/a/27439949
score: 0
tagged with: groovy
has title: how to get rid of brackets and commas in groovy when printing an array
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27439956
has answer: http://stackoverflow.com/a/27440279
upvote count: 1
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43319789
has body: I need to print an array without parenthesis part of a json file "platforms": [ { "platformCode": "EOS", "platformCodeDescription": "Credit Card Servicing (Voyager) platform" }, { "platformCode": "OLB", "platformCodeDescription": "Online Retail Bank Servicing Platform" } ], part of code def list=json.loginModel.get("platforms") log.info list output is [{platformCode=EOS, platformCodeDescription=Credit Card Servicing (Voyager) platform}, {platformCode=OLB, platformCodeDescription=Online Retail Bank Servicing Platform}] if I use this code def list=json.loginModel.get("platforms").platformCode log.info list output [EOS, OLB] i need the EOS and OLB without "[]"and","
has comment: http://stackoverflow.com/comment/43319901
tagged with: java
tagged with: http://stackoverflow.com/tag/json
linked to: http://stackoverflow.com/q/1010698

http://stackoverflow.com/a/27323536
has body: It means the folder is defined as an Intellij Module. Complete list of Intellij icons: https://www.jetbrains.com/idea/help/symbols.html
has comment: http://stackoverflow.com/comment/43107615
type: AcceptedAnswer
upvote count: 24
has comment: http://stackoverflow.com/comment/81315339
accepted answer of: http://stackoverflow.com/q/27323450
has comment: http://stackoverflow.com/comment/108772432
type: Answer
answers question: http://stackoverflow.com/q/27323450
downvote count: 0
score: 24
has comment: http://stackoverflow.com/comment/65021239
has comment: http://stackoverflow.com/comment/43106725

http://stackoverflow.com/q/27377372
type: Question
has comment: http://stackoverflow.com/comment/43204245
has title: How to construct a two dimentional array in Java?
accepted answer: http://stackoverflow.com/a/27377413
answer count: 1
downvote count: 0
favorite count: 0
has body: I am stuck in a very simple problem for more then 2 hours. I am trying to create a two dimensional array and fill it with a constructor. However, I couldn't pass this step. public class Test { public State [][] test1= new State[4][3];// public State test2[][]= new State[4][3];// public State [][]test3; public State test4[][]; public class State{ int position; double reward; int policy; } public Test(){ test1[1][1].position=1; // never worked test2[1][3].position=2; //never worked test3=new State[4][3]; test3[1][2].position=3; //never worked test4=new State[4][3]; test4[2][2].position=4;//never worked } } I am calling above function with following code Test test= new Test(); Log.e("done","pass"); //I never reach here. the code always stuck on the constructor.
tagged with: constructor
tagged with: multidimensional-array
has answer: http://stackoverflow.com/a/27377413
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/43134523
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27338962
has text: "I can't seem to figure out how to put a blank space there instead of 0's" - A blank space in an array of ints?

http://stackoverflow.com/a/27437707
score: 0
answers question: http://stackoverflow.com/q/27437663
has body: The at sign character (@) indicates to the compiler that what follows is an annotation. In the following example, the annotation's name is Override: @Override void mySuperMethod() { ... } annotation refrance In your example @Override indicated that onCreate(Bundle savedInstanceState) method does overrides or implements a method declared in a supertype, if onCreate(Bundle savedInstanceState) not present in super class it cause error. @Override public void onCreate(Bundle savedInstanceState) {}
type: Answer

http://stackoverflow.com/q/27399612
has body: I have a textfield which should allow pasting only numbers in Struts 2. I tried using onPaste attribute in textfield but it throws below exception org.apache.jasper.JasperException: /WEB-INF/**.jsp Attribute onPaste invalid for tag textfield according to TLD Is there anyway to do above function without paste event?
answer count: 1
tagged with: jsp
tagged with: jquery
has comment: http://stackoverflow.com/comment/57510010
has title: How to use JavaScript paste event to allow numbers in Struts 2
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43245582
has answer: http://stackoverflow.com/a/27401751
tagged with: java
upvote count: 1
downvote count: 1
type: Question
tagged with: javascript
tagged with: struts2
accepted answer: http://stackoverflow.com/a/27401751
score: 0

http://stackoverflow.com/comment/43325302
score: 0
comment on: http://stackoverflow.com/q/27441662
type: Comment
type: QuestionComment
has text: Your comment and update don't make things any clearer. Let's say there's a user john. Is it right that this user can have both `ROLE_USER`and `ROLE_API`? Then at some point the credentials have to be entered and those are sent to the server. Obviously you know how to do that, so I still don't see your problem. If you have only one user with the `ROLE_API`, then you are doing something wrong. That's essentially like having no authentication at all.

http://stackoverflow.com/a/27476023
upvote count: 7
answers question: http://stackoverflow.com/q/27466644
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: I discovered the problem. Because I was calling EventBus.register() in Activity.onCreate() I was getting multiple instances of the Activity on my backstack which would act as responders to these events. The solution is to either register your Activity as late as possible with @Override protected void onResume() { super.onResume(); EventBus.getInstance().register(this); } @Override protected void onPause() { EventBus.getInstance().unregister(this); super.onPause(); } or to declare your Activity as a single instance with android:launchMode="singleTask"
score: 7
accepted answer of: http://stackoverflow.com/q/27466644

http://stackoverflow.com/comment/106049319
type: QuestionComment
has text: this jar needs to be present in the dependencies.
comment on: http://stackoverflow.com/q/27425472
score: 0
type: Comment

http://stackoverflow.com/comment/43114954
has text: @Pbasak Yes. Object to JSON conversion as provided by Gson recursively converts all field objects, field objects of field objects, etc. unless you specify otherwise, and builds the corresponding JSON tree. I guess cyclic references may need special treatment, though.
type: Comment
comment on: http://stackoverflow.com/a/27327770
score: 0
type: AnswerComment

http://stackoverflow.com/a/27452230
type: Answer
has body: You could try something like: if(nodeList.item(i).getElementsByTagName("MiddleName").item(0).getFirstChild() == null) { here set the value to "" }
score: 0
answers question: http://stackoverflow.com/q/27451595

http://stackoverflow.com/comment/43218074
type: Comment
type: QuestionComment
score: 0
has text: @nem I don't mean to print them. I mean to take all values from list separated. Even if I put them into another list, all I get from it is a list with all data as a group. I believe I made it more clear...
comment on: http://stackoverflow.com/q/27384678

http://stackoverflow.com/q/27358263
has answer: http://stackoverflow.com/a/27358342
has answer: http://stackoverflow.com/a/27358390
favorite count: 0
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43169803
has body: I have two sets which contain some elements as object. I want to remove common element from the set. How can I remove common elements from set? Set&lt;AcceptorInventory&gt; updateList = new HashSet&lt;AcceptorInventory&gt;(); Set&lt;AcceptorInventory&gt; saveList = new HashSet&lt;AcceptorInventory&gt;(); Both sets have some items, the saveList have duplicated items &amp; I wish to remove duplicated items from saveList. I tried with foreach loop, but it did not work. Sample output: save 5 save 20 save 50 save 10 update 5 update 10 update 20 AcceptorInventory Hashcode and equals @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + count; result = prime * result + ((currency == null) ? 0 : currency.hashCode()); result = prime * result + ((date == null) ? 0 : date.hashCode()); result = prime * result + (int) (id ^ (id &gt;&gt;&gt; 32)); result = prime * result + (isCleared ? 1231 : 1237); result = prime * result + ((kioskMachine == null) ? 0 : kioskMachine.hashCode()); result = prime * result + ((time == null) ? 0 : time.hashCode()); long temp; temp = Double.doubleToLongBits(total); result = prime * result + (int) (temp ^ (temp &gt;&gt;&gt; 32)); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; AcceptorInventory other = (AcceptorInventory) obj; if (count != other.count) return false; if (currency == null) { if (other.currency != null) return false; } else if (!currency.equals(other.currency)) return false; if (date == null) { if (other.date != null) return false; } else if (!date.equals(other.date)) return false; if (id != other.id) return false; if (isCleared != other.isCleared) return false; if (kioskMachine == null) { if (other.kioskMachine != null) return false; } else if (!kioskMachine.equals(other.kioskMachine)) return false; if (time == null) { if (other.time != null) return false; } else if (!time…
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/43168897
has title: Compare two set and remove common items
downvote count: 1
type: UnansweredQuestion
score: 2

http://stackoverflow.com/a/27408463
score: 0
answers question: http://stackoverflow.com/q/27407987
type: Answer
has body: You should probably have it come up with a dialog instead to guarantee that it blocks until you can read the answer. JOptionPane.showMessage(winner);

http://stackoverflow.com/q/27347595
has comment: http://stackoverflow.com/comment/43149912
has body: There seems to be a problem with Statement st = conn.createStatement(); Here's my code: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { DefaultTableModel model=(DefaultTableModel)p1.getModel(); try{ Class.forName("java.sql.Driver"); Connection conn=(Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/product","root",""); Statement st = conn.createStatement(); String query="Select*from voltron;"; ResultSet rs=st.executeQuery(query); while(rs.next()) { String s1=rs.getString("id"); String s2=rs.getString("product"); String s3=rs.getString("brand"); String s4=rs.getString("price"); String s5=rs.getString("release"); model.addRow(new Object[]{s1,s2,s3,s4,s5}); } rs.close();; st.close(); conn.close(); } catch (Exception e) { JOptionPane.showMessageDialog(this, "There is an ERROR"); } }
score: 0
has comment: http://stackoverflow.com/comment/43150213
has comment: http://stackoverflow.com/comment/43150227
favorite count: 0
has comment: http://stackoverflow.com/comment/43150088
has title: Why is Netbeans showing an error in createStatement() for a MySQL database connection?
has comment: http://stackoverflow.com/comment/43150029
type: UnansweredQuestion
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43150270
has comment: http://stackoverflow.com/comment/43149998
has answer: http://stackoverflow.com/a/27347794
tagged with: java
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/27347725
answer count: 2
has comment: http://stackoverflow.com/comment/43150085

line
tags question: http://stackoverflow.com/q/27390569
tag name: line
type: Tag

http://stackoverflow.com/comment/93225976
has text: Yes you are right.I should have added code to show how to read a PDF from the file system, read the bytes from one generated on the fly, read one over the network, read one from a database....
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27408958

http://stackoverflow.com/q/27314068
favorite count: 0
tagged with: youtube-analytics
has comment: http://stackoverflow.com/comment/44198127
has body: I have downloaded the sample command line program for Youtube Analytics api and Youtube Data Api v3 and imported in eclipse. So below I have mentioned the code for my OAuth 2.0 implementation class: package com.google.api.services.samples.youtube.cmdline; import com.google.api.client.auth.oauth2.Credential; import com.google.api.client.auth.oauth2.StoredCredential; import com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp; import com.google.api.client.extensions.jetty.auth.oauth2.LocalServerReceiver; import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow; import com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets; import com.google.api.client.http.HttpTransport; import com.google.api.client.http.javanet.NetHttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.util.store.DataStore; import com.google.api.client.util.store.FileDataStoreFactory; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; import java.util.List; /** * Shared class used by every sample. Contains methods for authorizing a user and caching credentials. */ public class Auth { /** * Define a global instance of the HTTP transport. */ public static final HttpTransport HTTP_TRANSPORT = new NetHttpTransport(); /** * Define a global instance of the JSON factory. */ public static final JsonFactory JSON_FACTORY = new JacksonFactory(); /** * This is the directory that will be used under the user's home directory where OAuth tokens will be stored. */ private static final String CREDENTIALS_DIRECTORY = ".oauth-credentials"; /** * Authorizes the installed application to access user's protected data. * * @param scopes list of scopes needed to run youtube upload. * @param credentialDatastore name of the credential datastore to cache OAuth tokens */ public static Credential authorize(List&lt;String&gt…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/44019170
has comment: http://stackoverflow.com/comment/44004779
downvote count: 0
has comment: http://stackoverflow.com/comment/44198896
answer count: 0
score: 1
tagged with: java
tagged with: oauth-2.0
tagged with: youtube-data-api
has comment: http://stackoverflow.com/comment/44138600
has comment: http://stackoverflow.com/comment/44035897
tagged with: youtube-api
has comment: http://stackoverflow.com/comment/44046784
type: Question
has comment: http://stackoverflow.com/comment/44122422
has comment: http://stackoverflow.com/comment/44196725
has comment: http://stackoverflow.com/comment/44218623
has comment: http://stackoverflow.com/comment/44197422
upvote count: 1
has comment: http://stackoverflow.com/comment/44194108
has comment: http://stackoverflow.com/comment/43098250
has title: Error while executing YouTube Analytics Api sample

http://stackoverflow.com/comment/43309734
score: 0
type: Comment
type: QuestionComment
has text: Yes, I seen that. I don't know how I'm supposed to modify the code and still be able to run normally. Is there a similar method in the JWindow class?
comment on: http://stackoverflow.com/q/27434340

http://stackoverflow.com/q/27357396
downvote count: 0
has answer: http://stackoverflow.com/a/27357406
has answer: http://stackoverflow.com/a/27357469
has comment: http://stackoverflow.com/comment/43167197
favorite count: 0
has answer: http://stackoverflow.com/a/66741355
has answer: http://stackoverflow.com/a/27357557
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27357470
has answer: http://stackoverflow.com/a/77863617
linked to: http://stackoverflow.com/q/24839819
upvote count: 4
has body: When I am working with multiple versions of Java in my windows machine - 1.6 &amp; 1.7, and when I try to switch from 1.7 to 1.6, and modified the PATH environment variable, it's still showing the 1.7 version only. How can I fix it?
tagged with: java
has comment: http://stackoverflow.com/comment/63867695
type: Question
answer count: 8
has answer: http://stackoverflow.com/a/27357738
score: 4
has title: Java path not getting reflected even after changing the PATH variable when working with multiple java versions
has answer: http://stackoverflow.com/a/79033116
has comment: http://stackoverflow.com/comment/137268831

http://stackoverflow.com/q/27314243
answer count: 0
has comment: http://stackoverflow.com/comment/43091797
type: UnansweredQuestion
tagged with: spring
has body: I have a JSP who display destinations, a list on the left and a form on the middle. The form is bound to the destination who is selected from the list and that works nicely. However when I submit the form, all values are empty. Like if the binding was not done. public class DestinationsCtrl { @RequestMapping("/{id}") public String edit(@PathVariable("id")String id, Model model) { if ( "new".equals(id) ) { model.addAttribute("model", new AdministrationModel(destinations.list(), new EmptyDestination())); } else { model.addAttribute("model", new AdministrationModel(destinations.list(), destinations.get(id))); } return "administration"; } @RequestMapping(value = "/", method = POST) // "form" or "model.form" give me an empty 'form' public String create(@ModelAttribute("model.form") DestinationForm form, Errors errors, RedirectAttributes messages, HttpServletRequest request) { LOG.info("Creating new destination [name:{}, contact.email:{}], {} errors.", form.getName(), form.getContactEmail(), errors.getErrorCount()); destinations.store( new Destination(form.getName(), new Contact(form.getContactEmail(), form.getContactName())) ); return null; } } public class AdministrationModel { private final Set<Destination> destinations = new TreeSet<Destination>(/*comparator*/); private final Destination selected; private DestinationForm form; public DestinationForm getForm() { if ( form==null ) { form = new DestinationForm(getSelected()); } return form; } // Getters and some utility logic. NO SETTERS } public class DestinationForm { private String template = ""; private String name = ""; private String contactEmail = ""; private String contactName = ""; private String description = ""; public DestinationForm() { this(null); } public DestinationForm(final Destination destination) { if (destination != null) { name = destination.getName(); contactEmail = destination.getContact().getEmail(); contactName = destination.getContact().getName(); } } // Getters and setters } And finally, the J…
type: Question
tagged with: spring-mvc
tagged with: java
tagged with: jsp
score: 0
has comment: http://stackoverflow.com/comment/43092464
has title: Spring-mvc, form binding

http://stackoverflow.com/q/27361544
type: Question
has body: Actuall it is not my first time to work with List, but I really do not know what is wrong with declaration o the below List. what I want to do is, to declare a List&lt;Integer, Page&gt; "Page" is a class I created it, but when I declare my list as shown below I receive the below posted errors declaration: private List&lt;Integer, Page&gt; pageList; errors: Multiple markers at this line - Incorrect number of arguments for type List&lt;E&gt;; it cannot be parameterized with arguments &lt;Integer, Page&gt;
upvote count: 0
has comment: http://stackoverflow.com/comment/43175256
has comment: http://stackoverflow.com/comment/43175214
tagged with: arraylist
has answer: http://stackoverflow.com/a/27361570
favorite count: 0
has answer: http://stackoverflow.com/a/27361600
has answer: http://stackoverflow.com/a/27361586
answer count: 5
type: UnansweredQuestion
has title: List declaration error
has answer: http://stackoverflow.com/a/27361628
downvote count: 1
has comment: http://stackoverflow.com/comment/43175241
tagged with: list
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/27361754

http://stackoverflow.com/a/27566596
answers question: http://stackoverflow.com/q/27389074
has body: We added this functionality, but it will only be available with Java 8u40. The exact syntax is java.awt["Color(int, int, int)"] (the signature is part of the last name component, consistent with how it works on method names). You can try it out with early access releases of 8u40 at this time (it's scheduled for release in March 2015).
score: 4
type: Answer
upvote count: 4
downvote count: 0

http://stackoverflow.com/a/27341025
answers question: http://stackoverflow.com/q/27340999
upvote count: 6
has comment: http://stackoverflow.com/comment/43137961
has comment: http://stackoverflow.com/comment/43137951
type: Answer
has body: private static final String TAG = YourClass.class.getSimpleName(); ... android.util.Log.d(TAG, String.format("value = %d. random color = %d", randomRGB, backgroundColorRandomize())); More info: http://developer.android.com/reference/android/util/Log.html https://developer.android.com/tools/debugging/debugging-log.html Logging libraries: https://android-arsenal.com/tag/57
downvote count: 0
score: 6

http://stackoverflow.com/comment/43231908
has text: Can you show us how you configure your mapping and how you invoke Orika ?
comment on: http://stackoverflow.com/q/27382275
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27317932
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27317861
has body: You have several options to run your program this. One of them is: Create a separate basketBallTester.java file, and place there your class basketBallTester. Compile both files: basketBallTester.java and basketBall.java Run your program with java basketBallTester
answers question: http://stackoverflow.com/q/27317861
has comment: http://stackoverflow.com/comment/43095482
has comment: http://stackoverflow.com/comment/43095514
score: 4
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43095912
type: Answer
upvote count: 4

http://stackoverflow.com/comment/43212430
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27381781
has text: Maybe this helps: http://stackoverflow.com/questions/20405474/spring-boot-context-root
type: Comment

http://stackoverflow.com/a/27422576
has body: When there is a space in the date, for example 2014-12-11 13:08:08 then you must put quotes around it on the command line, otherwise the command prompt will see it as two separate arguments. Ofcourse you can change your program so that the date and time will be handled as two separate arguments: public static void main(String[] args) { String date = args[0]; String time = args[1]; System.out.println("The date is: " + date); System.out.println("The time is: " + time); String dateTime = date + " " + time; System.out.println("The date and time: " + dateTime); } (You can find out for yourself how to do that with args4j).
type: Answer
answers question: http://stackoverflow.com/q/27422520
has comment: http://stackoverflow.com/comment/43294249
score: 0

http://stackoverflow.com/comment/43177137
comment on: http://stackoverflow.com/q/27362527
type: QuestionComment
has text: Is there an error thrown?
type: Comment
score: 0

http://stackoverflow.com/comment/43225623
type: AnswerComment
score: 0
type: Comment
has text: I can use the Go key to operate the nextQuestion task but when my Answer buttons want to use it the array does not give out the next question but keeps spamming question number one and if I leave the array within the service I can not use it outside obviously do you have any ideas on how to solve this I really am stuck I am sorry to bother you you I'll post the code again on the top the new version I mean
comment on: http://stackoverflow.com/a/27367308

http://stackoverflow.com/comment/43260085
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27405914
has text: Why move row + 5 and col + 2? move both +1 and if the value is 0 move to the previous row and same col.

http://stackoverflow.com/comment/43100113
type: AnswerComment
comment on: http://stackoverflow.com/a/27320448
type: Comment
score: 2
has text: "*I am not allowed to use any import statements...*"

http://stackoverflow.com/a/29594882
type: Answer
has body: This can be more efficient especially with a helper method! Don't overthink the problem, I know its hard. My strategy is get the block for this char and move on to the next one. public int maxBlock(String str) { if (str.length() == 0) { return 0; } int biggest = Integer.MIN_VALUE; for (int a = 0; a &lt; str.length(); a++) { biggest = Math.max(biggest, (countBlock(str, str.substring(a, a + 1), a)); } return biggest; //by now we have the biggest } public int countBlock(String s, String any, int startIndex) { int cnt = 1; for (int a = startIndex + 1; a &lt; s.length(); a++) { //start right after index if (s.substring(a, a + 1).contains(any)){ //keep going cnt++; } else if (!s.substring(a, a + 1).equals(any)) { //stop here break; } } return cnt; }
score: 0
answers question: http://stackoverflow.com/q/27386752

http://stackoverflow.com/comment/43296285
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27427334
has text: Check that you actually have the jpa jar in your classpath
score: 0

http://stackoverflow.com/a/27368898
type: Answer
has comment: http://stackoverflow.com/comment/43189890
has comment: http://stackoverflow.com/comment/43189843
has comment: http://stackoverflow.com/comment/43189752
score: 0
has comment: http://stackoverflow.com/comment/43189970
answers question: http://stackoverflow.com/q/27368795
has body: What you should do is to create class Person which implements Comparable&lt;Person&gt; and if you are little bit lazy and the amount of data is not large Serializable too. Then put everything inside TreeSet&lt;Person&gt; and write methods which serialize the TreeSet and deserialize it too. Like this: import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.TreeSet; public class Person implements Comparable&lt;Person&gt;, Serializable { private String name; private int score; public Person(String name, int score) { this.name = name; this.score = score; addPerson(this); } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getScore() { return score; } public void setScore(int score) { this.score = score; } @Override public int compareTo(Person o) { return score - o.score; } @Override public String toString() { return "Person [name=" + name + ", score=" + score + "]"; } private static TreeSet&lt;Person&gt; classExtension = new TreeSet&lt;Person&gt;(); private static void addPerson(Person person) { classExtension.add(person); } private static void removePerson(Person person) { classExtension.remove(person); } private static void showExtension() { for (Person person : classExtension) System.out.println(person); } public static void serialize() { FileOutputStream fos = null; ObjectOutputStream oos = null; try { fos = new FileOutputStream("Person.ser"); oos = new ObjectOutputStream(fos); oos.writeObject(classExtension); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { try { if (oos != null) oos.close(); } catch (IOException e) { } try { if (fos != null) fos.close(); } catch (IOException e) { } } } public static void deserialize(){ FileInputStream fis = null; ObjectInp…

http://stackoverflow.com/q/27427613
score: 2
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27428446
tagged with: java
tagged with: http://stackoverflow.com/tag/json
possible better answer: http://stackoverflow.com/a/27428592
type: Question
has answer: http://stackoverflow.com/a/27428592
has answer: http://stackoverflow.com/a/27912585
has body: I am trying to use the Elasticsearch Java API to dynamically create mappings. This is important because I don't want to have to change compiled code to change the mapping. Almost all of the examples out there are using XContentBuilder to do this, but I want to use a JSON string from a file. Code: client.admin().indices().preparePutMapping(indexName) .setType("test") .setSource(indexMapping) .execute().actionGet(); File String: { "test": { "dynamic": "strict", "_id": { "path": "id" }, "properties": { "address": { "index_analyzer": "ip4-pattern-analyzer", "store": true, "type": "string", "fields": { "raw": { "index": "not_analyzed", "type": "string" } } } } } } Error thrown from Elasticsearch PutMappingRequest.class: failed to generate simplified mapping definition The same JSON defined using XContentbuilder works perfectly. String type = "test"; XContentBuilder jb = XContentFactory.jsonBuilder(). startObject(). startObject(type). field("dynamic", "strict"). startObject("_id"). field("path", "id"). endObject(). startObject("_all"). field("enabled", "true"). endObject(). startObject("properties"). startObject("address"). field("type", "string"). field("store", "yes"). field("index_analyzer", "ip4-pattern-analyzer"). startObject("fields"). startObject("raw"). field("type","string"). field("index","not_analyzed"). endObject(). endObject(). endObject(). endObject(). endObject(). endObject();
answer count: 3
downvote count: 0
favorite count: 0
has title: elasticsearch Java API putmapping from JSON file error
upvote count: 2
accepted answer: http://stackoverflow.com/a/27912585
tagged with: elasticsearch

http://stackoverflow.com/comment/43491812
type: QuestionComment
has text: I mean how would making the fields private having setters/getters affect performance?
score: 0
comment on: http://stackoverflow.com/q/27455310
type: Comment

http://stackoverflow.com/q/27471015
tagged with: timer
has title: pause and resume timer without reseting the timer
has answer: http://stackoverflow.com/a/27471421
accepted answer: http://stackoverflow.com/a/27471421
type: AnsweredQuestion
tagged with: java
has body: is there any simple method that when the timer is paused then started again it will resume from the time that it was paused at? i looked at other tutorials and they only restart the timer once the pause button is pressed twice. Im new to android development so sorry if this is a silly question. public class Timer extends Fragment { TextView CurrentDate; TextView CurrentTime; Thread ThreadTime; TextView textTimeStarted; Button buttonReset; Button buttonPauseStart; TextView textElapsedTime; private Button startButton; private Button pauseButton; private TextView timerValue; long timeInMilliseconds = 0L; long timeSwapBuff = 0L; long updatedTime = 0L; long startTime = 0L; //runs without a timer by reposting this handler at the end of the runnable Handler timerHandler = new Handler(); Runnable timerRunnable = new Runnable() { @Override public void run() { long millis = System.currentTimeMillis() - startTime; int millisecs = (int) (millis % 1000); int seconds = (int) (millis / 1000); int minutes = seconds / 60; seconds = seconds % 60; textElapsedTime.setText(String.format("%d:%02d:%02d", minutes, seconds, millisecs)); timerHandler.postDelayed(this, 0); } }; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View T = inflater.inflate(R.layout.time_layout, container, false); Runnable myRunnableThread = new CountDownRunner(); ThreadTime = new Thread(myRunnableThread); ThreadTime.start(); ConnecttoXML(T); buttonReset = (Button) T.findViewById(R.id.buttonStop); buttonReset.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { timerHandler.removeCallbacks(timerRunnable); textElapsedTime.setText(""); textTimeStarted.setText(""); } }); buttonPauseStart = (Button) T.findViewById(R.id.ButtonStart); buttonPauseStart.setText("Start"); buttonPauseStart.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { buttonPauseStart = (Button) v; if (buttonPauseStart.get…
type: Question
tagged with: handler
answer count: 1
score: 0
tagged with: android
tagged with: runnable

http://stackoverflow.com/q/27427429
type: AnsweredQuestion
tagged with: dropwizard
downvote count: 0
tagged with: jax-rs
score: 7
has body: In DropWizard, I can set up basic auth like so (in the Application#run impl): BasicAuthProvider&lt;SimplePrincipal&gt; authProvider = new BasicAuthProvider(authenticator, "SECRET_REALM"); environment.jersey().register(authProvider); I am wondering what the significance of the String realm ("SECRET_REALM") is? From general security concepts, I understand a "realm" to be a place (database, directory, file, keystore, etc.) where users and roles/permissions are stored. What does a realm mean in DropWizard, and what's the significance of specifying it inside BasicAuthProvider? Does it create something with this realm under the hood?
favorite count: 0
type: Question
accepted answer: http://stackoverflow.com/a/27431182
linked to: http://stackoverflow.com/q/27392224
tagged with: java
tagged with: authentication
upvote count: 7
answer count: 1
tagged with: jersey
has title: DropWizard Auth Realms
has answer: http://stackoverflow.com/a/27431182

http://stackoverflow.com/a/27458552
has comment: http://stackoverflow.com/comment/43356694
has comment: http://stackoverflow.com/comment/43356309
has comment: http://stackoverflow.com/comment/43356939
has comment: http://stackoverflow.com/comment/43355494
score: 1
has comment: http://stackoverflow.com/comment/43356340
has body: Why am I getting an UnhandledIOExeption? A quick look at your code reveals that you are trying to read from a File which may result in an IOExeption that must be handled. The line: BufferedImage myPicture = ImageIO.read(new File("42.png")); throws an IOException. From oracle: public static BufferedImage read(File input) throws IOException Returns a BufferedImage as the result of decoding a supplied File with an ImageReader chosen automatically from among those currently registered. The File is wrapped in an ImageInputStream. If no registered ImageReader claims to be able to read the resulting stream, null is returned. The current cache settings from getUseCacheand getCacheDirectory will be used to control caching in the ImageInputStream that is created. Note that there is no read method that takes a filename as a String; use this method instead after creating a File from the filename. This method does not attempt to locate ImageReaders that can read directly from a File; that may be accomplished using IIORegistry and ImageReaderSpi. Parameters: input - a File to read from. Returns: a BufferedImage containing the decoded contents of the input, or null. Throws: IllegalArgumentException - if input is null. IOException - if an error occurs during reading. That means that you must handle the IOExeption by putting the line in a try catch block, like so: try { BufferedImage myPicture = ImageIO.read(new File("42.png")); // do stuff with myPicture here } catch (IOException e) { // Handle the exaption here e.printStackTrace(); } Another problem with this is that myPicture is only visible inside the try scope, so what you really should do is declare your variables at the class level and initialize them in the Constractor like: private JRadioButton A; private JRadioButton B; private JRadioButton C; private JRadioButton D; private BufferedImage myPicture; private JLabel picLabel; // Constructor public ExamPrac (){ A = new JRadioButton("1"); B = new JRadioButton("2"); C = new JRa…
has comment: http://stackoverflow.com/comment/43355653
has comment: http://stackoverflow.com/comment/43356347
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43356350
type: Answer
answers question: http://stackoverflow.com/q/27458361
has comment: http://stackoverflow.com/comment/43356429
accepted answer of: http://stackoverflow.com/q/27458361
has comment: http://stackoverflow.com/comment/43356448
upvote count: 1

http://stackoverflow.com/a/27350240
has comment: http://stackoverflow.com/comment/43194664
has comment: http://stackoverflow.com/comment/43156358
score: 0
has comment: http://stackoverflow.com/comment/43175910
has comment: http://stackoverflow.com/comment/43155659
answers question: http://stackoverflow.com/q/27350120
has comment: http://stackoverflow.com/comment/43156193
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27350120
has comment: http://stackoverflow.com/comment/43156113
has body: This will allow you to determine if they are the same if(word.equalsIgnoreCase(userAnswer.getText().toString())) { answerOutput.setText("Correct"); } However, generally speaking you have a much larger problem, unless it's in code somewhere that you aren't showing us. Somewhere in your activity onCreate/onStart you want to initialize your button with whatever view it might be. Button checkAnswer = (Button) findViewById(//whatever your id is) Then you want to set the onClick listener of the button. With the approach that you are using, it would end up needing two things. First this public class MainActivity extends Activity implements View.OnClickListener { Then in you need to set the onClick listener to your Button, probably in OnCreate. checkAnswer.setOnClickListener(this); Then your onClick would look something like @Override public void onClick(View v) { if (word.equals(userAnswer)){ answerOutput.setText("Correct!!"); } else { answerOutput.setText("Sorry try again."); } } The logic for scrambling the word etc, probably wouldn't be in onClick here. Also, if you have multiple things you want to set click listeners for you would do something like this @Override public void onClick(View v) { switch(v.getId()) { case(R.id.//whatever): { //dosomething break; } } } Where you can multiple cases for all of the views that you have set the MainActivity to handle. Edit: Since you updated your code public class MainActivity extends Activity implements View.OnClickListener { private EditText userAnswer; private TextView answerOutput; private TextView scrambledWord; private String word; private String shuffledWord; private Button button; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); scrambledWord = (TextView) findViewById(R.id.scrambledWord); userAnswer = (EditText) findViewById(R.id.answerInput); answerOutput = (TextView) findViewById(R.id.answerOutput); createWord(); button = (Button) …
type: Answer
has comment: http://stackoverflow.com/comment/43156261

http://stackoverflow.com/comment/43181588
type: AnswerComment
type: Comment
has text: localhost means when the DB is running on the same Computer/Server as your programm. When you start your DB managing program for exampel mysql there is an information like connection xy opened on port 1537 the dbname is the name that your DB has and with url i mean the String mention bevore
comment on: http://stackoverflow.com/a/27361196
score: 1

http://stackoverflow.com/comment/43200001
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27374140
has text: Ok, I kinda understood this, but the problem I encounter is that my html page is build using java so I can't put the Applet.html into the same directory as the others because it really doesn't exist.

apache-stringutils
tags question: http://stackoverflow.com/q/27437780
tag name: apache-stringutils
type: Tag

http://stackoverflow.com/a/27431819
accepted answer of: http://stackoverflow.com/q/27362588
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/112443595
has body: Ok - after digging a lot more, I finally got this working. Much thanks to @Dave G and this tutorial: Configuring two-way SSL authentication on Tomcat from which most of these instructions are paraphrased. Generally, the steps to get mutual authentication functional are as follows: Create a certificate for the tomcat server. The client has to trust this certificate. Create a keystore for the tomcat server, and import the server certificate into it. Create a certificate for the client. The server has to trust this certificate. Import the client certificate into the server keystore Update the tomcat server.xml file with the correct Connector XML. The above steps are necessary on the server. Once completed, to set up the client, do the following: Copy the client certificate from the server to the client. Use the client certificate when communicating with the server (this process varies with the nature of the client application). For the certificate configuration, I executed the following on the server machine: # For the following commands, set the values in parenthesis to be whatever makes sense for your environment. The parenthesis are not necessary for the command. # This is an all-in-one command that generates a certificate for the server and places it in a keystore file, while setting both the certifcate password and the keystore password. # The net result is a file called "tomcat.keystore". keytool -genkeypair -alias (serveralias) -keyalg RSA -dname "CN=(server-fqdn),OU=(organizationalunit),O=(organization),L=(locality),ST=(state),C=(country)" -keystore tomcat.keystore -keypass (password) -storepass (password) # This is the all-in-one command that generates the certificate for the client and places it in a keystore file, while setting both the certificate password and the keystore password. # The net result is a file called "client.keystore" keytool -genkeypair -alias (clientalias) -keyalg RSA -dname "CN=(client),OU=(organizationalunit),O=(organization),L=(locality…
score: 35
type: Answer
has comment: http://stackoverflow.com/comment/67696753
downvote count: 0
has comment: http://stackoverflow.com/comment/55924552
has comment: http://stackoverflow.com/comment/48630952
upvote count: 35
has comment: http://stackoverflow.com/comment/65070815
answers question: http://stackoverflow.com/q/27362588
has comment: http://stackoverflow.com/comment/68195506

http://stackoverflow.com/a/27463143
accepted answer of: http://stackoverflow.com/q/27349947
score: 3
has body: Okay so releasing a LibGDX game to iOS with Admob and GPGS or other bindings is a painful process, but I have managed to get everything working and my game is now in the waiting for review state. At the time of this answer it looks like Apple is rejecting apps that use Google Play Game Services because the GPGS SDK takes the user to Safari in order to log in. This is unacceptable per Apple because it is a "poor user experience". Actually when a user tries to log in the GPGS SDK looks for an installation of Google+ in order to log in, if it can't be found it then it opens a Chrome browser, and finally Safari if Chrome isn't installed. After getting the GPGS correctly integrated and trying to submit my binary to Apple I was facing another issue about the Google SDK not being signed. Since it looked like my app would be rejected even if I were to fix that issue I decided to ditch GPGS and use Apple's Game Center instead. That said, I was still able to get GPGS with Admob working on my test device so I can answer how here. First, the samples in BlueRiverInteractive are not all that useful for a LibGDX game. All the UIWindow, UIViewController and UIView stuff you shouldn't have to mess with. Your IOSLauncher class should extend Delegate instead of UIApplicationDelegateAdapter. If you look inside Delegate, it takes care of setting UIApplication, UIWindow, and other iOS things for your application. When you extend it, you will be forced to implement createApplication(). This is mine for example: @Override protected IOSApplication createApplication() { final IOSApplicationConfiguration config = new IOSApplicationConfiguration(); config.orientationLandscape = false; config.orientationPortrait = true; config.useAccelerometer = false; config.useCompass = false; iosApplication = new IOSApplication(new SplishGame(this), config); return iosApplication; } Keep iosApplication as a field member of your IOSLauncher class. Through it, you can get the UIWindow that you need to show int…
type: AcceptedAnswer
downvote count: 0
upvote count: 3
has comment: http://stackoverflow.com/comment/51866772
type: Answer
answers question: http://stackoverflow.com/q/27349947

http://stackoverflow.com/comment/43151379
score: 0
comment on: http://stackoverflow.com/q/27348296
type: QuestionComment
type: Comment
has text: Can you see the difference between the code you posted first and the code you've posted now? hint: `parseInt` != `parse`

http://stackoverflow.com/comment/137865635
comment on: http://stackoverflow.com/a/50343572
score: 0
type: AnswerComment
type: Comment
has text: Android Studio warns to override performClick() and call performClick() from onTouchEvent. You cannot not do either to remove the warning. However, as mentioned above, if you call performClick() in your onTouchEvent you will end-up having two entries in performClick(), one from your code and one from the system. That is completely useless, and I personally think the warning to override performClick() on your custom view is invalid. If the system is going to call it anyway, why call it as well.

http://stackoverflow.com/comment/43363898
comment on: http://stackoverflow.com/a/27463841
type: Comment
has text: Commenting out the setBounds(...) method doesn't show my shop items at all.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43170444
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27359074
has text: Possible duplicate: http://stackoverflow.com/questions/17370909/sorting-a-linkedhashset
type: Comment

http://stackoverflow.com/comment/43169150
comment on: http://stackoverflow.com/a/27357377
type: Comment
has text: Do you need to know that the `ResultCommand` is a `ResultCommand`? Or couldn't you use the ADT `AbstractCommand` instead?
score: 0
type: AnswerComment

http://stackoverflow.com/a/27400655
downvote count: 0
answers question: http://stackoverflow.com/q/27400485
type: Answer
has body: It doesn't make sense to me to run an additional query just to get the count. If you must use an arrays, you'd be better off first reading the data from the ResultSet to ArrayLists, and then creating arrays based on the size() of the ArrayLists and copying the data to them. However, I don't think that access to ArrayLists is slower than access to arrays. After all, ArrayLists are backed by an actual array, and have the same random access : Here's ArrayList::get: public E get(int index) { RangeCheck(index); return (E) elementData[index]; } The only thing that would slow you down when working with ArrayLists is if they will have to be resized multiple times while you are inserting data to them, but you only have this problem because you don't know the size of the data in advance, which is the precise reason why you can't use arrays.
accepted answer of: http://stackoverflow.com/q/27400485
score: 4
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/43327141
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27440496
has text: What about a common table expression that starts with `WITH`? That could be an insert, update, delete or a plain select. Your `else` branch would also treat `drop` or `create` as a "select"
score: 0

http://stackoverflow.com/comment/43165018
type: Comment
has text: The code is not offending, it works perfectly well on other devices, I have analyzed the memory usinf the DDMS tools. This error occurs before the system calls System.gc(). Which however is not under my control, so I thought of using system.gc() manually however that is a bad programming practice and will not be feasible as I am not only targeting Note devices. Even if I roll back the complete operation, it is not guaranteed that I will not get this error at some point or the other - as and when memory consumption increases.
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27329140

http://stackoverflow.com/comment/43222944
type: QuestionComment
has text: I'm afraid this database file is so broken it can't be repaired. I'm interested to analyze this problem. Would it be possible if you send me the database file?
score: 1
comment on: http://stackoverflow.com/q/27360272
type: Comment

http://stackoverflow.com/q/27408735
has answer: http://stackoverflow.com/a/27437442
tagged with: mongodb
answer count: 2
tagged with: bson
score: 0
has answer: http://stackoverflow.com/a/27412222
tagged with: google-app-engine
has body: It seems to me that Javas "NetworkInterface" isn't supported on GoogleAppEngine - not a surprise I guess given the limited Java .net support on GAE. I do however want to use the BSON Java library to covert my string to a BSON object (ObjectID). The problem is that it uses the below as part of the generation of the ObjectId: StringBuilder sb = new StringBuilder(); Enumeration&lt;NetworkInterface&gt; e = NetworkInterface.getNetworkInterfaces(); while ( e.hasMoreElements() ){ NetworkInterface ni = e.nextElement(); sb.append( ni.toString() ); } machinePiece = sb.toString().hashCode() &lt;&lt; 16; Which is clearly problematic when using GoogleAppEngine. Does anyone know an alternative to NetworkInterface that is supported by GAE that I could use in the above case? It's really making me tear my hair out! For reference the offending code appears between lines 356 and 362 in the below file: https://github.com/mongodb/mongo-java-driver/blob/2.11.x/src/main/org/bson/types/ObjectId.java
has comment: http://stackoverflow.com/comment/43293634
type: UnansweredQuestion
tagged with: network-interface
type: Question
has title: NetworkInterface not supported on GoogleAppEngine?
tagged with: java

http://stackoverflow.com/q/27458902
downvote count: 0
has body: Here is what I am trying to do. I have a number of threads which should all wait at a common point before they proceed, so obvious solution is to use CyclicBarrier. But I want to also compute the total time taken by the threads to execute. I defined the following utility method in class ConcurrentExecutionActionTimer. public static long elapsedTimeUsingCyclicBarrier(Executor executor, int concurrency, final Runnable action) throws InterruptedException { final Runnable barrierAction = new Runnable() { @Override public void run() { System.out.println("Condition of barrier is met."); } }; final CyclicBarrier barrier = new CyclicBarrier(concurrency, barrierAction); final CountDownLatch done = new CountDownLatch(concurrency); for(int i=0; i&lt;concurrency; i++ ){ executor.execute(new Runnable() { @Override public void run() { try { System.out.println("Waiting at barrier."); barrier.await(); action.run(); //Cyclic barrier gets reset automatically. Again wait for them to finish. barrier.await(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } catch (BrokenBarrierException e) { e.printStackTrace(); } finally { done.countDown(); } } }); } long startNanoTime = System.nanoTime(); done.await(); return System.nanoTime() - startNanoTime; } Then I called it up like: public static void main(String[] args) { //Executor is replacement for common thread idiom: (new Thread(r)).start() to e.execute(r) ExecutorService executor = Executors.newFixedThreadPool(10); Worker action = new Worker(); int concurrency = 5; try { long elapsedTime = ConcurrentExecutionActionTimer.elapsedTimeUsingCyclicBarrier(executor, concurrency, action); double seconds = (double)elapsedTime / 1000000000.0; System.out.println("Time Taken approximately: " + seconds + "seconds."); } catch (InterruptedException e) { e.printStackTrace(); } } Here Worker is suppose my thread that does some work. For example: class Worker implements Runnable { @Override public void run() { System.out.println("Doi…
accepted answer: http://stackoverflow.com/a/27479136
favorite count: 0
has title: Using cyclic barrier does not wait till all threads finish
type: AnsweredQuestion
tagged with: cyclicbarrier
tagged with: multithreading
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27479136
has answer: http://stackoverflow.com/a/64822970
tagged with: countdownlatch
score: 1
tagged with: java
possible better answer: http://stackoverflow.com/a/64822970
answer count: 2

http://stackoverflow.com/comment/48795883
comment on: http://stackoverflow.com/a/27431965
has text: I have exactly the same problem (with the same hadoop version). Did you spot the actual reason of this, other than changing the split size?
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/55711060
type: Comment
comment on: http://stackoverflow.com/q/27418189
type: QuestionComment
score: 0
has text: did you solve this somehow?

http://stackoverflow.com/comment/43225240
type: AnswerComment
type: Comment
has text: For Multiset, `n` typically refers to the number of _distinct_ elements, whereas for e.g. a `List` it's going to refer to the total number of elements, distinct or not.
score: 1
comment on: http://stackoverflow.com/a/27374489

http://stackoverflow.com/comment/43229551
comment on: http://stackoverflow.com/q/27390775
has text: It will change depending on user input
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43118799
comment on: http://stackoverflow.com/q/27317615
score: 0
type: Comment
has text: Thank you guys for all your answers , I think that I have not ask the question the right way this is my bash script http://pastebin.com/yvjKNaAa I use this script to create new repositories . everything works fine until I push the sources to the repository this is my output remote: remote: [INFO] Total time: 11.616s remote: [INFO] Finished at: Sat Dec 06 11:53:05 EET 2014 remote: [INFO] Final Memory: 14M/34M remote: [INFO] ------------------------------------------------------------------------ remote: cp: target `/opt/jetty/webapps/test.war' is not a directory
type: QuestionComment

http://stackoverflow.com/comment/43100868
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27320721
has text: Also thought about the same. The main problem here is to obtain next unvisited "node". If we could afford O(n^2) of additional memory, I'd suggest to sacrifice O(n^2) time first to store all coordinates in HashSet and remove visited "nodes" from it. That will give us amortized constant time for obtaining of next unvisited node between BFS runs.
type: Comment

http://stackoverflow.com/comment/43125396
type: AnswerComment
has text: Is there a way to run fixed number of threads without using Executor?
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27333545

http://stackoverflow.com/comment/43316994
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27438480
has text: `Data.toArray();` will convert an ArrayList in Java to an Array. but what do you mean by c array?

http://stackoverflow.com/a/27441412
has comment: http://stackoverflow.com/comment/43324061
has comment: http://stackoverflow.com/comment/43323199
has comment: http://stackoverflow.com/comment/43323272
has comment: http://stackoverflow.com/comment/43325154
type: Answer
has comment: http://stackoverflow.com/comment/43326085
has comment: http://stackoverflow.com/comment/43325068
score: 3
has comment: http://stackoverflow.com/comment/43324778
has comment: http://stackoverflow.com/comment/43324387
upvote count: 3
has body: Just create a static initialization block: public enum ListenerEnum implements EventListener{ INSTANCE; private int counter; private static final ExecutorService exec; //this looks strange. I'd move this service out of enum. private static final EventProducer ep; static{ exec = Executors.newSingleThreadExecutor(); ep = new EventProducer(INSTANCE); //Automatically unregisters when the producer is done. exec.submit(ep); } @Override public void doSomething() { System.out.println("Did something."); counter++; if (counter &gt;= 5) { exec.shutdownNow(); } } } As long as enum values are final and static they are initialized before the static initialization block. If you decompile the enum you'll see a single initialization block: static{ INSTANCE = new ListenerEnum(); exec.submit(INSTANCE.ep); }
has comment: http://stackoverflow.com/comment/43325040
has comment: http://stackoverflow.com/comment/43324927
has comment: http://stackoverflow.com/comment/43324965
answers question: http://stackoverflow.com/q/27440701
has comment: http://stackoverflow.com/comment/43325233
has comment: http://stackoverflow.com/comment/43325329
has comment: http://stackoverflow.com/comment/43325279
has comment: http://stackoverflow.com/comment/43324245
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43325005
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27440701

http://stackoverflow.com/comment/43311996
type: QuestionComment
score: 0
has text: why not try to specify a target location. just to make sure it generates the file :)
comment on: http://stackoverflow.com/q/27435527
type: Comment

http://stackoverflow.com/q/27338370
has title: Days Until Christmas Application Java Value Will Not Round Up
possible better answer: http://stackoverflow.com/a/27338546
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/43135085
type: Question
has answer: http://stackoverflow.com/a/27338468
answer count: 2
downvote count: 0
accepted answer: http://stackoverflow.com/a/27338468
favorite count: 0
has body: I'm teaching myself Java and I am working on this application that will count the days until Christmas. The HOUR_OF_DAY, MONTH, and SECOND values of the GregorianCalendar and Date objects for today and Christmas are all set to zero. By debugging I can see the variable for the difference in days in milliseconds and it gives me a time of 1641599724 milliseconds which comes out to be 18.99999 days but it wont round up to 19 no matter what I try! I have tried Math.ceil method to try and round up but I can't get it to equal 19. FIRST: DataUtils class stores/modifies input from the user package chapter13datesstrings; import java.util.*; public class DateUtils { static final int MILLS_IN_DAY = 24 * 60 * 60 * 1000; public static Date getCurrentDate(){ GregorianCalendar currentDate = new GregorianCalendar(); currentDate.set(Calendar.HOUR_OF_DAY, 0); currentDate.set(Calendar.MINUTE, 0); currentDate.set(Calendar.SECOND, 0); return currentDate.getTime(); } public static Date createDate(int year, int month, int day){ GregorianCalendar date = new GregorianCalendar(year, month, day); return date.getTime(); } public static Date stripTime(Date date){ GregorianCalendar noTimeDate = new GregorianCalendar(); noTimeDate.setTime(date); noTimeDate.set(Calendar.HOUR, 0); noTimeDate.set(Calendar.MINUTE,0); noTimeDate.set(Calendar.SECOND, 0); return noTimeDate.getTime(); } public static double daysDiff(Date date1, Date date2){ date1 = stripTime(date1); date2 = stripTime(date2); long longDate1 = date1.getTime(); long longDate2 = date2.getTime(); long longDiff = longDate2 - longDate1; return (int) (Math.ceil(longDiff / MILLS_IN_DAY)); } } SECOND: DateUtilExample class provides input to the DataUtils class package chapter13datesstrings; import java.util.*; import java.text.*; public class DateUtilExample { public void thisIsCode(){ GregorianCalendar currentGC = new GregorianCalendar(); int currentYear = currentGC.get(Calendar.YEAR); //sets current year Date currentDate = DateUtils.getCurrentDat…
has answer: http://stackoverflow.com/a/27338546
type: AnsweredQuestion

http://stackoverflow.com/comment/43178560
comment on: http://stackoverflow.com/q/27363324
has text: What does the logcat say?
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/a/27474697
type: Answer
has body: Above stated answer is absolutely right but u can also save it statically nd just increase the counter number if u want to show how many times he has bitten by using simple char at function. Nd clearing the file text with new text or just by replacing the number by replace function of string
score: 0
answers question: http://stackoverflow.com/q/27474521

http://stackoverflow.com/a/33484976
has body: The oscP5 library has a default datagram size of 1536, which is why you experienced that bound. You can change the datagram size with OSCProperties::setDatagramSize(), which is used in the constructor of the OscP5 object: OscP5(Object theParent, OscProperties theProperties) See this link for an old example from the Processing forum: https://forum.processing.org/one/topic/query-re-sending-large-number-of-values-to-processing-via-osc-from-supercollider.html Clay Budin NYC
downvote count: 0
upvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27377843
type: Answer
answers question: http://stackoverflow.com/q/27377843
score: 1

http://stackoverflow.com/a/27340004
upvote count: 2
has body: Read the section from the Swing tutorial on How to Make Dialogs for working examples of using a JOptionPane. If you really want to add a JOptionPane to your own JDialog, then read the JOptionPane API for a basic example of how to check which button was selected.
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27339988

http://stackoverflow.com/q/27383506
tagged with: arrays
has comment: http://stackoverflow.com/comment/43217270
possible better answer: http://stackoverflow.com/a/27383974
tagged with: string
has answer: http://stackoverflow.com/a/27383974
has answer: http://stackoverflow.com/a/27384150
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43216391
has comment: http://stackoverflow.com/comment/43216163
type: Question
accepted answer: http://stackoverflow.com/a/27384150
has comment: http://stackoverflow.com/comment/43215736
has body: import java.io.*; public class Test{ public static void main(String args[]){ String Str = new String("Welcome to Tutorialspoint.com and again some other random stuff in this string."); String[] result= new String[8]; byte c=0b0; int i=0; int j=0; for (int a=0;a&lt;7;a++){ result[a]=""; } for(i=0; j&lt;Str.length(); j++){ c=(byte)(Str.charAt(j)); result [i]+=(char)c; if (i&lt;7){i++;}else{i=0;} } for (int a=0;a&lt;8;a++){ System.out.println(result[a]); } } } The goal is to create 8 strings from the original string. String[0] will hold characters 0,8,16,...and so on. String[1] will hold characters 1,9,17,...and so on. I hope this is clear enough. What I get with this code is something I cannot seem to overcome. Wtitdsemis eoa. or nt l lcam s r cTsogertti oupma auhn mto ionfig eoiantdfs. null rnn ho Notice null in last line - I need this gone as string should start with ' rnn ho' just like this. Wtitdsemis eoa. or nt l lcam s r cTsogertti oupma auhn mto ionfig eoiantdfs. rnn ho Would really appreciate if someone pointed out how to not get this output. This is a 'test' code for splitting a String that will hold values from -126 to 127 binary. Not all of them will be printable and I need them to still be split correctly. For the most part code seems to work except for those seemingly random 'null' strings in output. I do not mind [null]=0 characters as long as they take 1 character space and not 4 in one String. ================================================================================== Initializing a&lt;8 fixed this problem. But I did not even have time to read all other comments/answers. Did not expect such fast answers. THANK YOU ALL . I will up vote any relevant solution when I read them all and/or get reputation required. ================================================================================== FIXED!. ================================================================================== Selected answer of Ian McLaird as not only it fixed my 'silly' mist…
has title: Java-Split characters from a String into an Array of Strings
tagged with: java
has answer: http://stackoverflow.com/a/27384206
tagged with: split
score: 0
answer count: 3

http://stackoverflow.com/comment/43096066
type: Comment
score: 0
type: AnswerComment
has text: I could've guessed that. Thanks anyway.
comment on: http://stackoverflow.com/a/27318212

http://stackoverflow.com/a/27397055
upvote count: 0
has comment: http://stackoverflow.com/comment/43240240
has comment: http://stackoverflow.com/comment/43240560
answers question: http://stackoverflow.com/q/27396819
type: Answer
downvote count: 1
score: -1
has body: String s = "DSD SDFS PNL 02 E"; s = s.replaceAll("PNL\\s*02\\s*E", "PNL02E"); System.out.println(s);
has comment: http://stackoverflow.com/comment/43240318

http://stackoverflow.com/comment/43164232
type: Comment
comment on: http://stackoverflow.com/q/27328745
has text: yes exactly I think that you didn't understand but I need your help
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43317114
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27438372
has text: Although your edited answer directly answers my question, TheLostMind's answer solves my actual problem. I will be inclined to accept that instead. Thanks for understanding.
score: 0

instantiation
type: Tag
tags question: http://stackoverflow.com/q/27416408
tag name: instantiation
tags question: http://stackoverflow.com/q/27388214

http://stackoverflow.com/comment/43770685
comment on: http://stackoverflow.com/a/27648323
score: 0
type: Comment
has text: tks u very much! I have recently discovered that ! My team have decided to use parquet + snappy and it worked like a charm
type: AnswerComment

http://stackoverflow.com/q/27456200
tagged with: performance
tagged with: java
has body: I was wondering whether you could help me work out a way to model the following in a GAE datastore such that it is scalable and can be updated frequently. I thought I had a solution which I expressed in this question but whilst waiting for replies I realise that it might be overly complicated. I have explained below why I have kept it as a separate question. Problem: Building a system with users who can send many messages to each other. Each user must be able to retrieve their messages - like online chat. Would like to avoid contention when possibly a user may receive many messages over a short time. Solution 1: As mentioned here I am wondering whether a sharded list can be used to implement this. By this I mean have messages stored as entity objects and sender and receiver store the keys of these objects (the messages sent between them) in a list. I thought of sharding because a user who receives many messages would have to update the list frequently and a sharding approach could have prevented datastore contention. Problem - what happens when the list of keys to say a user's received messages gets large? Will appending to it not become slow? I could split the list over several entities but this would take careful thought on allocation schemes and ways of retrieval. Willing to do this if it is the best way. Alternative approach: Store messages as entity objects (as above) but this time have them store a properties which are indexed (date, from, to, etc). Retrieve messages for a user using queries (date greater than..., from=... etc). This could work well but I worry - will all the indexing degrade as they will grow extremely large with many users sending many messages? Seems like it will degrade into an SQL like system. Any thoughts? I have read about how to model complex relations in the GAE docs but they are using python for an example and I am having trouble abstracting the overall design pattern. Many thanks to anyone with input on this PS at the moment using t…
type: Question
tagged with: modeling
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: google-app-engine
linked to: http://stackoverflow.com/q/27441311
has answer: http://stackoverflow.com/a/27480725
has title: Modeling a system with users who can send messages to each other in GAE datastore
has comment: http://stackoverflow.com/comment/43355277
has comment: http://stackoverflow.com/comment/43370063

http://stackoverflow.com/comment/43276766
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27416408
score: 0
has text: If it's a `Map`, what are you going to instantiate?

http://stackoverflow.com/comment/62808019
has text: having a weird issulinearlayout manager now. im instantiating it but in still ge this error. holy cow.
comment on: http://stackoverflow.com/a/28708981
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43151922
has text: you said valid, then what it means 0 to 255 ?
comment on: http://stackoverflow.com/a/27348477
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27465295
has answer: http://stackoverflow.com/a/27465342
type: Question
has title: How to change the last iteration in an array?
tagged with: arrays
has answer: http://stackoverflow.com/a/27465899
has body: I have an array that prints out the number with a comma attached but for the last iteration, I don't want there to be a comma attached to the last number. Is there a way that I can create an if statement that only applies to the last iteration? Its java.
tagged with: iteration
has answer: http://stackoverflow.com/a/27490961
score: 0
has answer: http://stackoverflow.com/a/27465331
answer count: 4
has comment: http://stackoverflow.com/comment/43366792
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/43308956
score: 2
comment on: http://stackoverflow.com/q/27433900
has text: Those two operations are not the same. `x * 1.0 != x + 1.0`. 1d is just another way of writing 1.0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27470845
tagged with: java
tagged with: noclassdeffounderror
tagged with: eclipse
downvote count: 1
has comment: http://stackoverflow.com/comment/43376511
type: Question
has title: Eclipse NoClassDefFoundError
score: 0
tagged with: android
has body: I'm developing an application using Google Maps. It references the Google Map Util library project, which references google play services library and appcompat-v7. Here is my workspace: https://www.dropbox.com/s/cwy2o9di7bk74li/Zrzut%20ekranu%202014-12-14%2016.21.07.png?dl=0 And yet, if I try to compile and run the application, it instantly crashes, with the following trace: 12-14 16:14:24.063: E/AndroidRuntime(7592): FATAL EXCEPTION: main 12-14 16:14:24.063: E/AndroidRuntime(7592): java.lang.NoClassDefFoundError: com.google.android.gms.maps.model.LatLng 12-14 16:14:24.063: E/AndroidRuntime(7592): at michal.myapp.activities.StartupScreenActivity.onCreate(StartupScreenActivity.java:36) So apparently the compiler has trouble finding google play services jars. Any ideas? Manifest: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="michal.myapp" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="21" /> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.ACCELEROMETER"/> <uses-permission android:name="android.permission.CAMERA" /> <uses-feature android:glEsVersion="0x00020000" android:required="true"/> <uses-feature android:name="android.hardware.camera" /> <uses-feature android:name="android.hardware.camera.autofocus" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="@string/api_key"/> <meta-data android:name="com.google.android.gms.version" android…
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27470877
has comment: http://stackoverflow.com/comment/43376563
upvote count: 1
accepted answer: http://stackoverflow.com/a/27470877
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/5848769

http://stackoverflow.com/comment/43292314
comment on: http://stackoverflow.com/a/27422746
type: Comment
has text: well, from this I guess that there is no way to add some string to a specific position using the out.println() method, which is what I wanted to know. Thanks!
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43207369
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27378944
type: AnswerComment
has text: @geert3 When you use set() method for example, it enforces fields recomputation on subsequent get().

http://stackoverflow.com/a/27413503
answers question: http://stackoverflow.com/q/27413404
score: 1
has body: I was so hopeful that my original answer would solve your problem, but.. no. See this extract from DecimalFormat's javadocs. The grouping separator is commonly used for thousands, but in some countries it separates ten-thousands. The grouping size is a constant number of digits between the grouping characters, such as 3 for 100,000,000 or 4 for 1,0000,0000. If you supply a pattern with multiple grouping characters, the interval between the last one and the end of the integer is the one that is used. So "#,##,###,####" == "######,####" == "##,####,####". I had originally suggested using DecimalFormatSymbols. This will allow you to change the comma to a minus, but it won't allow for variable-length groups. So your requirements cannot be met using the built-in support for grouping. You need to build your own formatter or do it manually.
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer
accepted answer of: http://stackoverflow.com/q/27413404

http://stackoverflow.com/q/27435476
favorite count: 0
has answer: http://stackoverflow.com/a/27435511
has body: Some code we have throws different exceptions during it's execution. I want to replace exceptions with Optional; but optional can only inform users that value does not exist. I need more details about various issues that happens during the execution. I need this details mostly for the error messages and getting the right error code. What is the intended way to use Optional in this case?
has comment: http://stackoverflow.com/comment/43311865
accepted answer: http://stackoverflow.com/a/27435511
tagged with: java-8
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43312146
tagged with: java
has title: Java8 Optional to replace method that throws several exceptions
type: Question
upvote count: 4
tagged with: function
linked to: http://stackoverflow.com/q/26162407
answer count: 1
downvote count: 0
score: 4

http://stackoverflow.com/a/27341390
upvote count: 12
downvote count: 0
has body: The simplest way of doing this is probably to make most of your code only depend on Random, with an instance being injected (e.g. by passing it into a constructor). That way, for testing purposes you can pass in a simple Random with a fixed seed - but for real runs where security is required, you can pass in an instance of SecureRandom.
accepted answer of: http://stackoverflow.com/q/27341294
score: 12
answers question: http://stackoverflow.com/q/27341294
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/43119320
type: Comment
comment on: http://stackoverflow.com/a/27330698
has text: Yes `Pattern.compile` is a static method that returns an object of type `Pattern`.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43367717
type: AnswerComment
type: Comment
has text: A quick solution would be to switch another boolean flag on (when you trigger an update from afterTextChanged) to allow the first modification to take effect, and then always switch that same flag off if it is currently true. That would prevent the infinite loop, though there may be a neater (and more robust) way to do it.
comment on: http://stackoverflow.com/a/27465129
score: 1

http://stackoverflow.com/a/27336770
has body: You're seeing the default `toString() method from the Object class, and you're finding that it's not too helpful. You're also not creating a Card or a true Deck class and so you can't give any class a decent toString() method. Solutions: Create a Card class. Give it a rank and a value field. Give it a toString() method. Create a Deck class Give it a collection of Cards. Give it a decent toString() method. e.g., // for Deck @Override public String toString() { StringBuilder sb = new StringBuilder(); for (Card card: cards) { sb.append(card.toString() + ", "); } return sb.toString(); }
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27336725
answers question: http://stackoverflow.com/q/27336725
has comment: http://stackoverflow.com/comment/43130559
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43145258
has text: Which line if you can figure that out? May be goto generated java file?
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27344863
type: QuestionComment

http://stackoverflow.com/comment/43168263
has text: good solution :-) Just a note on the reason of the exception: recursion in the selectedItems list was my first guess as well, but isn't. Actually it's the modification of the orderList during its firing the change. Client notification of selectedItem -> remove item -> selectionModel is listening to list change and updates itself -> selectedItem firing again -> client notification again: here we are still in the notification of the first remove, thus violating the no-list-modifications-while-being-notified rule
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27350784
type: Comment

http://stackoverflow.com/q/27399806
has body: I have a JavaFX desktop application that requires login authentication with database using Spring Security. The AuthenticationManager is not getting autowired properly and throws NullPointerException. I reused most of this code from web app where this is working properly, but won't here. LoginController.java @Component public class LoginController{ private boolean userAuthenticated = true; @Autowired @Qualifier("authenticationManager") private AuthenticationManager authenticationManager; @FXML public void login() { Authentication authToken = new UsernamePasswordAuthenticationToken( emailField.getText(), passField.getText()); try { System.out.println(authenticationManager); authToken = authenticationManager.authenticate(authToken); // throws NullPointer SecurityContextHolder.getContext().setAuthentication(authToken); } catch (Exception e) { e.printStackTrace(); } applicationContext.xml &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; &lt;context:component-scan&gt; &lt;bean id="LoginController" class="controller.LoginController"&gt; &lt;property name="authenticationManager" ref="authenticationManager" /&gt; &lt;/bean&gt; &lt;authentication-manager alias="authenticationManager"&gt; &lt;authentication-provider user-service-ref="userService"&gt; &lt;password-encoder ref="bCryptPasswordEncoder" /&gt; &lt;/authentication-provider&gt; &lt;/authentication-manager&gt; &lt;/beans:beans&gt;
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43255648
has comment: http://stackoverflow.com/comment/43253187
tagged with: spring
tagged with: spring-mvc
answer count: 0
has comment: http://stackoverflow.com/comment/43251792
tagged with: java
tagged with: javafx
has title: @Autowired AuthenticationManager is null (JavaFX + Spring Security)
type: Question
has comment: http://stackoverflow.com/comment/43254506
has comment: http://stackoverflow.com/comment/43251579
score: 0
tagged with: spring-security
has comment: http://stackoverflow.com/comment/43298503

http://stackoverflow.com/q/27407361
linked to: http://stackoverflow.com/q/18093928
has comment: http://stackoverflow.com/comment/43259534
possible better answer: http://stackoverflow.com/a/27407654
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27407654
tagged with: java
has body: I have a jar file named- ParseCSV-0.0.1-SNAPSHOT.jar and the contents of it are - META-INF/ META-INF/MANIFEST.MF foo/ foo/ReadCSV.class META-INF/maven/ META-INF/maven/Test/ META-INF/maven/Test/ParseCSV/ META-INF/maven/Test/ParseCSV/pom.xml META-INF/maven/Test/ParseCSV/pom.properties The main class is ReadCSV.class and it takes a CSV file (C:\Testting\ValidaResults.csv) as an input parameter. I am trying to execute the jar file from the command promt by running the following command- java -jar . ParseCSV-0.0.1-SNAPSHOT.jar "C:\Testting\ValidationResult.csv" But I am getting an error saying- Error: Could not find or load main class foo.ReadCSVTest What is going wrong here.
type: Question
has answer: http://stackoverflow.com/a/27407668
tagged with: jar
has title: Error in executing a jar file
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/27407668

http://stackoverflow.com/comment/43170301
has text: post your logcat....
comment on: http://stackoverflow.com/q/27358996
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/45842510
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/28778545
has text: I have already got it to work by making use of xmlsec. Thanks Thanks a bunch though!

http://stackoverflow.com/q/27388214
tagged with: instantiation
type: AnsweredQuestion
has body: Let's say I have a class, Car, and I'm trying to import a large set of data to create multiple instances of "Car". My CSV file is laid out like so: Car Manufacturer,Model,Color,Owner,MPG,License Plate,Country of Origin,VIN,... etc The point is, there is a lot of data that needs to be in the constructor. If there's only a few of these, it wouldn't be that bad to manually instantiate it by writing Car FordFocus = new Car(Ford,Focus,Blue,John Doe,108-J1AZ,USA,194241-12e1...), but if I have hundreds of these, is there any way to import all this data to make the classes?
has comment: http://stackoverflow.com/comment/43225133
possible better answer: http://stackoverflow.com/a/27388308
tagged with: java
has answer: http://stackoverflow.com/a/27388586
type: Question
score: 0
has comment: http://stackoverflow.com/comment/43224404
tagged with: class
has answer: http://stackoverflow.com/a/27388308
answer count: 3
tagged with: http://stackoverflow.com/tag/csv
has title: How to create new instances of classes based on a CSV file
has answer: http://stackoverflow.com/a/27388477
accepted answer: http://stackoverflow.com/a/27388586

http://stackoverflow.com/a/27425442
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43293540
accepted answer of: http://stackoverflow.com/q/27425348
score: 2
answers question: http://stackoverflow.com/q/27425348
has body: You are missing an exclamation mark here if (Files.isDirectory(file)). It should be if (!Files.isDirectory(file))
has comment: http://stackoverflow.com/comment/43295811
upvote count: 2

http://stackoverflow.com/q/27397333
upvote count: 3
tagged with: extends
has answer: http://stackoverflow.com/a/27402391
has comment: http://stackoverflow.com/comment/43240773
has comment: http://stackoverflow.com/comment/43241535
has title: Hibernate "The resource type Session does not implement java.lang.AutoCloseable"
downvote count: 0
type: UnansweredQuestion
tagged with: implements
linked to: http://stackoverflow.com/q/2016299
linked to: http://stackoverflow.com/q/24041170
score: 3
tagged with: session
tagged with: java
tagged with: hibernate
has body: I want to use construction import org.hibernate.Session; ... try (Session session){ } How can I do that? Because "The resource type Session does not implement java.lang.AutoCloseable" I know, that I need to extend Session and override AutoCloseable method, but when I've try to do that, there is error "The type Session cannot be the superclass of SessionDAO; a superclass must be a class" Update I've wrote my own DAO framework, but will be use Spring for that
type: Question
has comment: http://stackoverflow.com/comment/43241011
answer count: 1
favorite count: 0

http://stackoverflow.com/a/27334973
type: Answer
accepted answer of: http://stackoverflow.com/q/27334574
has comment: http://stackoverflow.com/comment/43127743
score: 0
answers question: http://stackoverflow.com/q/27334574
type: AcceptedAnswer
has body: You could pass it as parameter to next jsp. Sample1.jsp &lt;form action="sample2.jsp" method="post"&gt; &lt;input type="submit" id="buttonSubmit" name="buttonSubmit" value="Buy"/&gt; &lt;input type="hidden" name="book" value="&lt;%=strBook%&gt;"/&gt; &lt;/form&gt; Sample2.jsp &lt;% // Obtain strBook for rendering on current page String strBook = (String) request.getParameter("book"); %&gt; &lt;h1&gt; Book: &lt;/h1&gt; &lt;p&gt; &lt;%="SAMPLE 2 RESULT " + strBook%&gt; &lt;/p&gt;

http://stackoverflow.com/a/27588865
type: Answer
answers question: http://stackoverflow.com/q/27446257
has body: make sure your loop is ok,i mean Categories and Category class and make sure your CategoriesCombo is a JComboBox type and then add your ComboBox to Jpanel then use DefaulComboBoxModel for give a model to ComboBox like this : class test extends JFrame{ private JComboBox combo; private final DefaultComboBoxModel model; private Jpanel panel; test() { combo = new JComboBox(); model = new DefaultComboBoxModel(); panel = new Jpanel(); createModel(); combo.SetModel(model); panel.add(Combo); add(panel); } void createModel() { for(Category c : categories){ model.addElement(c); NoResultsLabel.setVisible(false); } public static void main(String[] args) { test t = new test(); } }
score: 0

http://stackoverflow.com/comment/43346164
has text: for reading and writing data a simple text file would be more than enough if it is needed to be read by the user though if you are the one who needs to read the file I suggest looking into xml http://www.w3schools.com/xml/ though that link only shows you what xml is I suggest you do some of the research on implementing it into java.
type: Comment
comment on: http://stackoverflow.com/q/27453979
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43208341
has text: why this question is tagged under 'talend'? it's not related to TOS at all; i suggest an editing
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27378821

http://stackoverflow.com/q/27467635
type: UnansweredQuestion
tagged with: criteria-api
type: Question
has comment: http://stackoverflow.com/comment/43371017
tagged with: java
tagged with: hibernate
has body: I have this entity : @Entity(name="TestEntity") @Table(name = "TestTable") public class TestEntity { private Long id; ... some fields ... private List&lt;TestEntity&gt; children; @ManyToMany(cascade = CascadeType.ALL) @Column public List&lt;TestEntity&gt; getChildren() { return children; } public void setChildren(List&lt;TestEntity&gt; children) { this.children = children; } } And I want to create a search criteria with the inner children field with something like this : CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery&lt;?&gt; query = builder.createQuery(theClass); Root from = query.from(theClass); Path objectPath = from.get("children"); predicate = objectPath.in(1, 2, 3, 4, 5, 6); Predicate ands = builder.and(predicate to array); query.select(from).where(ands); But I have this exception Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement : select testentity0_.id as id1_0_, testentity0_.code as code2_0_, testentity0_.description as descript3_0_, testentity0_.mainType as mainType4_0_ from TestTable testentity0_ cross join TestTable_TestTable children1_, TestTable testentity2_ where testentity0_.id=children1_.TestTable_id and children1_.children_id=testentity2_.id and (. in (1 , 2 , 3 , 4 , 5 , 6)) [42001-182]
has comment: http://stackoverflow.com/comment/46266476
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/43371101
has answer: http://stackoverflow.com/a/27470153
has title: Exception on select with in clause using hibernate JPA CriteriaQuery

http://stackoverflow.com/comment/43347352
score: 1
has text: If the guess is too low, all you should do is raise the min to one more than the guess, right? And if the guess is too high, all you should do is lower the max to one less than the guess, right? Why do you change both min and max in each case?
type: QuestionComment
comment on: http://stackoverflow.com/q/27454639
type: Comment

http://stackoverflow.com/comment/43357079
has text: I suggest including the formatted output as part of the question.
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27459555
type: Comment

http://stackoverflow.com/q/27343607
score: 0
answer count: 1
has body: Doing homework, implementation of the algorithm flood fills. I'm writing a program to this guide: http://en.wikipedia.org/wiki/Flood_fill. And I have some questions: Is it normal to specify the parameters in function replaces the color of any character bucketFill.fill (0, 0, '*', 'O');, I do not know what kind of color will be initially to these coordinates? An algorithm is correct? I wrote it for example in Wikipedia, but the result of my program is as follows: @@@@@ @@@@@ @@@@@ @@@@@ @@@@@ @@@@@ @@@@@ I think must be this: *@@@@ @@@@@ @@#@@ @@@@@ @@@@@ @@@## @@@@@ My code: class BucketFill { private char[][] pixels; public BucketFill(char[][] pixels) { this.pixels = pixels; } public void fill(int x, int y, char newColor, char oldColor) { if (x &lt; 0) return; if (y &lt; 0) return; if (x &gt;= pixels.length) return; if (y &gt;= pixels[x].length) return; oldColor = pixels[x][y]; if (newColor == pixels[x][y]) return; if (oldColor != pixels[x][y]) return; pixels[x][y] = newColor; fill(x - 1, y, newColor, oldColor); fill(x + 1, y, newColor, oldColor); fill(x, y - 1, newColor, oldColor); fill(x, y + 1, newColor, oldColor); } public void inspect() { for (int y = 0; y &lt; pixels.length; y++) { for (int x = 0; x &lt; pixels[y].length; x++) { System.out.print(pixels[y][x]); } System.out.print("\n"); } } public static void main(String argv[]) { char pixels[][] = { { 'O', 'X', 'X', 'X', 'X' }, { 'X', 'O', 'O', 'O', 'X' }, { 'X', 'O', '#', 'O', 'X' }, { 'X', 'O', 'O', 'O', 'X' }, { 'X', 'X', 'X', 'X', 'X' }, { 'X', 'X', 'X', '#', '#' }, { 'X', 'X', 'X', 'X', 'X' } }; BucketFill bucketFill = new BucketFill(pixels); bucketFill.fill(0, 0, '*', 'O'); bucketFill.fill(3, 0, 'O', 'O'); bucketFill.fill(2, 1, '@', 'O'); bucketFill.inspect(); } }
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27343668
has title: Questions about the flood fill algorithm in Java
tagged with: algorithm
tagged with: java
type: Question
tagged with: flood-fill

http://stackoverflow.com/q/27368432
accepted answer: http://stackoverflow.com/a/27369217
tagged with: default-method
has comment: http://stackoverflow.com/comment/43188763
tagged with: java
linked to: http://stackoverflow.com/q/23453568
has comment: http://stackoverflow.com/comment/43191226
has comment: http://stackoverflow.com/comment/43188809
has comment: http://stackoverflow.com/comment/43188856
has comment: http://stackoverflow.com/comment/43188831
type: AnsweredQuestion
upvote count: 35
downvote count: 0
has comment: http://stackoverflow.com/comment/43188883
has body: Let's take an example: public interface Testerface { default public String example() { return "Hello"; } } public class Tester implements Testerface { @Override public String example() { return Testerface.super.example() + " world!"; } } public class Internet { public static void main(String[] args) { System.out.println(new Tester().example()); } } Simply enough, this would print Hello world!. But say I was doing something else with the return value of Testerface#example, for instance initializing a data file and returning a sensitive internal value that shouldn't leave the implementing class. Why does Java not allow access modifiers on default interface methods? Why can't they be protected/private and potentially elevated by a subclass (similar in how a class that extends a parent class can use a more visible modifier for an overridden method)? A common solution is moving to an abstract class however in my specific case, I have an interface for enums, so that does not apply here. I imagine it was either overlooked or because the original idea behind interfaces that they are a "contract" of available methods, but I suppose I want input as to what's going on with this. I've read "Why is “final” not allowed in Java 8 interface methods?", which states: The basic idea of a default method is: it is an interface method with a default implementation, and a derived class can provide a more specific implementation And it sounds to me like visibility wouldn't break that aspect at all. As with the linked question since it looks like it had trouble being closed, an authoritative answer would be appreciated in this matter, rather than opinion-based ones.
favorite count: 0
has comment: http://stackoverflow.com/comment/43217945
type: Question
has answer: http://stackoverflow.com/a/27369217
linked to: http://stackoverflow.com/q/23453287
has comment: http://stackoverflow.com/comment/43210560
has comment: http://stackoverflow.com/comment/43188794
has comment: http://stackoverflow.com/comment/43188720
score: 35
has comment: http://stackoverflow.com/comment/43188807
has comment: http://stackoverflow.com/comment/43188820
has title: Why does Java 8 not allow non-public default methods?
has comment: http://stackoverflow.com/comment/43188947
answer count: 1
tagged with: java-8
has comment: http://stackoverflow.com/comment/43210659
has comment: http://stackoverflow.com/comment/43189821

http://stackoverflow.com/a/27440856
score: 0
answers question: http://stackoverflow.com/q/27440155
type: Answer
upvote count: 1
downvote count: 1
has body: If you have a lot of phrases and many keywords, it might be better to parallelize the matching instead of using regex. This is indeed much faster than using a regex in a loop on the same processor. First you need one processing class, which is submitted to individual work threads: final class StringMatchFinder implements Runnable { private final String text; private final Collection&lt;Match&gt; results; public StringMatchFinder(final String text, final Collection&lt;Match&gt; results) { this.text = text; this.results = results; } @Override public void run() { for (final String keyword : keywords) { if (text.contains(keyword)) { results.add(new Match(text, keyword)); } } } } Now you need a ExecutorService: final ExecutorService es = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()); And then process the phrases: public void processText(List&lt;String&gt; texts) { final Collection&lt;Match&gt; results = new ConcurrentLinkedQueue&lt;Match&gt;(); final Collection&lt;Future&lt;?&gt;&gt; futures = new LinkedList&lt;Future&lt;?&gt;&gt;(); for (final String text : texts) { futures.add(es.submit(new StringMatchFinder(text, results))); } es.shutdown(); try { es.awaitTermination(1, TimeUnit.DAYS); } catch (InterruptedException e) { e.printStackTrace(); } for (final Match match : results) { System.out.println(match.getOriginalText() + " ; keyword found:" + match.getKeyword()); //or write them to a file } } The loop over the futures is to check for processing errors. Results are saved in a list of matches Here is a complete example. The class Match public class Match { private String originalText; private String keyword; public Match(String originalText, String keyword) { this.originalText = originalText; this.keyword = keyword; } public void setOriginalText(String originalText) { this.originalText = originalText; } public String getOriginalText() { return originalText; } public void setKeyword(String keyword) { this.keyword = keyword; } public String get…

http://stackoverflow.com/comment/43249651
type: Comment
comment on: http://stackoverflow.com/a/27402450
type: AnswerComment
has text: Exposing the backing list is not neccesarily a bad thing. Many of the standard collections allows you to get a modifiable view of the backing data structures with for instance keySet or entrySet. If you have invariants that would break (such as an internal size-field) that must be in sync with the list, then it's another story.
score: 0

http://stackoverflow.com/q/27425836
has answer: http://stackoverflow.com/a/27426856
downvote count: 0
tagged with: gretty
answer count: 1
tagged with: build.gradle
favorite count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
tagged with: java
has title: How to run integrations test on a web project from another subproject using gradle
tagged with: gradle
type: Question
has body: I have a gradle multi project where my war file is built in one subproject and my integrations tests are in a different subproject. I have read that gretty should be able to start a jetty instance to let me run the integrations tests during build, but I can not figure out how to "connect" the gretty integrationTestTask task to the task in my other subproject from where the actual tests will be run. My project structure looks like this: root/ int-test/ build.gradle web/ build.gradle build.gradle settings.gradle File content root/settings.gradle: include ':web' include ':int-test' root/build.gradle: apply plugin: 'java' root/web/build.gradle: apply plugin: 'war' apply from: 'https://raw.github.com/akhikhl/gretty/master/pluginScripts/gretty.plugin' gretty { contextPath = '/' integrationTestTask = 'intTests' } task intTests &lt;&lt; { println 'This task will run in just the right time' } root/int-test/build.gradle: apply plugin: 'java' task intTests &lt;&lt; { println 'All integration testing is done in here' } When I run "./gradlew -q intTests", this is the output: All integration testing is done in here 2014-12-11 15:37:02.046 INFO - Logging initialized @1157ms 2014-12-11 15:37:02.554 INFO - jetty-9.2.3.v20140905 2014-12-11 15:37:02.682 WARN - ServletContainerInitializers: detected. Class hierarchy: empty 2014-12-11 15:37:03.114 INFO - Started o.a.g.JettyWebAppContext@7da22e4a{/,file:/Users/fredrik/callista/dev/grettyfitnesse/web/build/inplaceWebapp/,AVAILABLE} 2014-12-11 15:37:03.130 INFO - Started ServerConnector@2590ae17{HTTP/1.1}{0.0.0.0:8080} 2014-12-11 15:37:03.130 INFO - Started @2245ms 2014-12-11 15:37:03.137 WARN - Jetty 9.2.3.v20140905 started and listening on port 8080 2014-12-11 15:37:03.158 WARN - runs at: 2014-12-11 15:37:03.159 WARN - http://localhost:8080/ This task will run in just the right time 2014-12-11 15:37:03.221 INFO - Stopped ServerConnector@2590ae17{HTTP/1.1}{0.0.0.0:8080} 2014-12-11 15:37:03.229 INFO - Stopped o.a.g.JettyWebAppContext@7da22…

http://stackoverflow.com/q/27377711
upvote count: 8
tagged with: maven
has title: Maven test fails with NoClassDefFoundError for ANTLR class
accepted answer: http://stackoverflow.com/a/27378009
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43204948
tagged with: antlr
has comment: http://stackoverflow.com/comment/43205051
type: Question
score: 8
has comment: http://stackoverflow.com/comment/43205079
downvote count: 0
answer count: 1
has body: I am using main/resources/antlr-4.2-complete.jar external library. I already included it on my classpath. But when I run test goal, inside eclipse I receive following message Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.048 sec <<< FAILURE! checkGrammar(br.com.stoneage.GrammarTest) Time elapsed: 0.011 sec <<< ERROR! java.lang.NoClassDefFoundError: org/antlr/v4/runtime/CharStream So I know that test goal is not looking for antlr-4.2-complete.jar. How can I solve this? Here is my POM file: 4.0.0 br.com.stoneage SASInterpreter 0.0.1-SNAPSHOT jar SASInterpreter http://maven.apache.org <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> junit junit 4.11 test
has answer: http://stackoverflow.com/a/27378009
linked to: http://stackoverflow.com/q/4955635
favorite count: 0
has comment: http://stackoverflow.com/comment/43205210

sql-server
tags question: http://stackoverflow.com/q/27345076
tags question: http://stackoverflow.com/q/27315366
tags question: http://stackoverflow.com/q/27330664
tags question: http://stackoverflow.com/q/27361612
tags question: http://stackoverflow.com/q/27466078
type: Tag
tags question: http://stackoverflow.com/q/27422484
tag name: sql-server
tags question: http://stackoverflow.com/q/27373401
tags question: http://stackoverflow.com/q/27425182
tags question: http://stackoverflow.com/q/27419106
tags question: http://stackoverflow.com/q/27418875
tags question: http://stackoverflow.com/q/27452536

http://stackoverflow.com/a/27349285
upvote count: 1
has body: There are several ways I think. You can just use a Map with the command as the key and an interface which executes your code as the value. Something like this: Map&lt;String, CommandInterface&gt; commands = new .... and then use the map like this: CommandInterface cmd = commands.get(command); if(cmd != null) { cmd.execute(); }
type: AcceptedAnswer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27348606
answers question: http://stackoverflow.com/q/27348606
type: Answer

http://stackoverflow.com/comment/43315508
score: 0
type: Comment
type: QuestionComment
has text: Severe: ResponseEntityProxy{[Content-Type: text/html;charset=utf-8,Content-Length: 963,Chunked: false]} Severe: java.lang.NullPointerException at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:2002) at org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1980) at org.apache.commons.io.IOUtils.copy(IOUtils.java:1957) at org.apache.commons.io.IOUtils.copy(IOUtils.java:1907) at org.apache.commons.io.IOUtils.copy(IOUtils.java:1933) at dao.DataAccessImpl.transferAttachment(DataAccessImpl.java:535) at bean.InbxBean.NewRecordupload(InbxBean.java:1118)
comment on: http://stackoverflow.com/q/27437348

http://stackoverflow.com/q/27379901
tagged with: screenshot
score: 1
tagged with: java
has title: Java SWT: read-only preview of existing composites
type: Question
upvote count: 1
favorite count: 0
tagged with: e4
has body: We have got a number of Composites (let's say around 10), which shall all be displayed in a kind of overview with the following properties: read-only smaller than the original One way would be to take a screenshot of each composite and then display the pictures. Do you know of any simpler method to do this?
type: UnansweredQuestion
tagged with: swt
answer count: 0
downvote count: 0

http://stackoverflow.com/a/27417773
has body: I think it's &lt;logger&gt; not &lt;category&gt;. Note that Spring Boot also saves you from having to remember that by making log levels configurable in application.properties.
answers question: http://stackoverflow.com/q/27400069
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/43323258
has comment: http://stackoverflow.com/comment/43328861
downvote count: 0
score: 1

http://stackoverflow.com/q/27428610
tagged with: java
type: Question
upvote count: 2
answer count: 2
has answer: http://stackoverflow.com/a/27428761
tagged with: tomcat
has body: I am trying to include spring security in my project. Until now I was looking only at 404 error and didn't know why. Today I came to know how to look into logs folder of apache-tomcat and I got these errors in log file. my web.xml file: Archetype Created Web Application dispatcher org.springframework.web.servlet.DispatcherServlet 1 dispatcher / org.springframework.web.context.ContextLoaderListener contextConfigLocation /WEB-INF/dispatcher-servlet.xml /WEB-INF/spring-security.xml springSecurityFilterChain org.springframework.web.filter.DelegatingFilterProxy springSecurityFilterChain /* dispatcher-servlet.xml file: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:jee="http://www.springframework.org/schema/jee" xmlns:lang="http://www.springframework.org/schema/lang" xmlns:p="http://www.springframework.org/schema/p" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:util="http://www.springframework.org/schema/util" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <mvc:resources mapping="/css/**" location="/css/" /> <mvc:resources mapping="/fonts/**" location="/fonts/" /> <mvc:resources mapping="/javascript/**" location="/javascript/" /> <mvc:annotation-driven /> <context:component-scan base-package="controller" /> <context:annotation-config /> /WEB-INF/jsp/ .jsp classpath:hibernate.cfg.xml org.hibernate.cfg.AnnotationConfiguration ${jdbc.dialect} true spring-security.xml file: <?xml version="1.0…
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has answer: http://stackoverflow.com/a/27428795
downvote count: 0
type: UnansweredQuestion
tagged with: spring
tagged with: spring-mvc
has title: org.xml.sax.SAXParseException; Cannot find the declaration of element 'beans:beans
score: 2

http://stackoverflow.com/comment/43133371
score: 2
has text: I would make an effort to get used to the syntax. It's very useful and not defining the type is error prone and the result is unnecessary casting.
comment on: http://stackoverflow.com/q/27338313
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27366445
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/43185384
has comment: http://stackoverflow.com/comment/43185107
has comment: http://stackoverflow.com/comment/43185183
tagged with: servlets
type: Question
has comment: http://stackoverflow.com/comment/43185040
tagged with: jsp
has comment: http://stackoverflow.com/comment/43184952
tagged with: ajax
has body: I am working on a sports-betting website. I have a program that fetches sports data and writes/updates a MySQL db. This program stays running on my local PC, where the DB is also located. In order to retrieve the data, the client (the web browser) creates a new "bean" object. The bean's constructor is to populate some HashMaps with values queried from the DB. Then, the JSP iterates through the bean's HashMaps and displays the content. Here is what the code looks like: <% Bean m = new Bean(); %> NBA <% //Iterates through the NBA hashmap Iterator itrNba = m.getNbaM().entrySet().iterator(); for (Map.Entry<Integer, Match> entry : m.getNbaM().entrySet()) { Match value = entry.getValue(); %> // Creates a table row for every Match object in the hashmap, and outputs its values <%=value.getTeam0Name()%> <% if (value.getStatus() != 0) { %> <%=value.getTeam0Score()%> <%=value.getQuarter()%> <% } else { %> <%=value.getQuarter()%> <% } %> <%=value.getTeam1Name()%> <% if (value.getStatus() != 0) { %> <%=value.getTeam1Score()%> <% } %> <% } %> However, I haven't found a simple way to allow my values to refresh. My really simple temporary fix was to just refresh the whole page every X seconds, and then scroll down to where the user previously was viewing. A new bean is created, causing it to read from the DB again. However, this is an approach that is beyond ugly. Is there a simple way for just the values to refresh? I realize that I may have to look into jQuery and servlets etc, which I am willing to do. However, I would like to stay away from JSON, JS, and lots of client side scripting. Id prefer to stick with JSP or a servlet which has a doPost that prints out html code, but how can I make this loop periodically? Thanks.
has comment: http://stackoverflow.com/comment/43184890
has comment: http://stackoverflow.com/comment/43185103
answer count: 1
has comment: http://stackoverflow.com/comment/43201968
has comment: http://stackoverflow.com/comment/43185302
has comment: http://stackoverflow.com/comment/43184941
has comment: http://stackoverflow.com/comment/43209727
linked to: http://stackoverflow.com/q/11306000
type: UnansweredQuestion
score: 0
has comment: http://stackoverflow.com/comment/43184841
has title: How to periodically refresh JSP with updated DB contents?
has comment: http://stackoverflow.com/comment/43209655
has comment: http://stackoverflow.com/comment/43185533
has answer: http://stackoverflow.com/a/27366720
has comment: http://stackoverflow.com/comment/43185582

http://stackoverflow.com/a/27317335
type: Answer
answers question: http://stackoverflow.com/q/27317083
score: 0
has body: Once you check documentation to CLI java you will see there are only two options: java [ options ] class [ arguments ] here you specify the class you want to execute.. or java [ options ] -jar file.jar [ arguments ] you specify exactly one JAR file which (as you already know) must contain Main-Class in manifest.

http://stackoverflow.com/comment/43341416
type: Comment
comment on: http://stackoverflow.com/a/27451358
type: AnswerComment
has text: How do i get the compiler to read their answer? How would I tell the users if they had gotten a guess right?
score: 0

http://stackoverflow.com/comment/43199192
type: Comment
has text: Thanks that seemed to be it however i get another error after stating " ResultSet not positioned properly" .
comment on: http://stackoverflow.com/a/27374336
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43254867
comment on: http://stackoverflow.com/a/27398143
score: 0
type: AnswerComment
type: Comment
has text: Checkout this answer http://stackoverflow.com/a/20756425/3673638 Recently I have started using Gradle instead of Maven http://www.drdobbs.com/jvm/why-build-your-java-projects-with-gradle/240168608

http://stackoverflow.com/q/27334603
has title: Travis-ci ignores caching settings for gradle
tagged with: java
has answer: http://stackoverflow.com/a/27356714
tagged with: gradle
tagged with: caching
type: Question
tagged with: continuous-integration
accepted answer: http://stackoverflow.com/a/27356714
tagged with: travis-ci
answer count: 1
has body: Travis-ci ignores settings that are for caching Gradle directory. HERE is my .travis.yml where I setup caching $HOME/.gradle. That was done many commits ago, but it still downloads all Gradle dependencies. You can see build history if you click build status badge at readme.md. I have tried different things, but Travis still do not cache. I know about environmental variable $GRADLE_USER_HOME which Gradle respects and used it for dependencies. In build setting I set it to $HOME/.gradle and in my .travis.yml I set caching directory to $GRADLE_USER_HOME. But it still not works! What am I doing wrong? And sorry for explicit links, my reputation is not so big to post more than two links
score: 0
type: AnsweredQuestion

http://stackoverflow.com/comment/43929132
has text: possible duplicate of [A javaFX Stage could be both StageStyle.UTILITY and StageStyle.TRANSPARENT?](http://stackoverflow.com/questions/15502451/a-javafx-stage-could-be-both-stagestyle-utility-and-stagestyle-transparent)
comment on: http://stackoverflow.com/q/27468218
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/64429352
has text: I'm not working on this project any more, if Andreas, the guy that posted the bounty says this is okay, I'm happy to accept the answer.
type: Comment
comment on: http://stackoverflow.com/a/38507092
score: 0
type: AnswerComment

http://stackoverflow.com/a/27407924
answers question: http://stackoverflow.com/q/27403948
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27403948
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/43266400
score: 2
downvote count: 0
has body: You're missing a dependency. Neo4j requires a schema index provider which is located in neo4j-lucene-index. Since it's an exchangeable component (you can write your own index provider) it's bundled in a separate artifact. Amend your dependencies in pom.xml with: org.neo4j neo4j-lucene-index 2.1.6 If you only want to have one single dependency for all neo4j stuff in your pom.xml use: org.neo4j neo4j-community 2.1.6

http://stackoverflow.com/q/27460350
has comment: http://stackoverflow.com/comment/43367043
tagged with: java
has body: I found this: http://www.mono-project.com/docs/about-mono/languages/java/ And there it says: Compiling Java Code to x86 Code So you could compile Java Code to an .exe, which could run on any windows machine without having anything to install? I'm just wondering because the term "mono aot" did never occur while searching for compiling java native code. So can I really make a native .exe from a .jar with this? And which Java Version does it fully support?
has comment: http://stackoverflow.com/comment/43357265
type: Question
has title: Create Java native code with Mono (AOT-Compiler)
tagged with: mono
score: 0
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/43095247
type: Comment
type: QuestionComment
has text: Can you duplicate this error with a shorter source code?
comment on: http://stackoverflow.com/q/27317861
score: 1

http://stackoverflow.com/comment/43246994
score: 0
has text: show my jar files which one is including me is that correct ...
type: Comment
comment on: http://stackoverflow.com/q/27398759
type: QuestionComment

http://stackoverflow.com/comment/43505243
type: Comment
score: 0
has text: Well, to answer part of your question: it isn't possible that a minimum spanning tree could span the graph by only touching a few vertices. By definition, a spanning tree must span all the vertices of the graph.
type: QuestionComment
comment on: http://stackoverflow.com/q/27339660

http://stackoverflow.com/comment/43314471
type: Comment
comment on: http://stackoverflow.com/a/27415949
has text: Hi @AndreiVolgin, I added the code you suggested Long time = dateBoxDOB.getValue().getTime(); Date date = new Date(time - time % (24 * 60 * 60 * 1000)); and I still get the same result. Regards, Glyn
type: AnswerComment
score: 0

google-chrome
tags question: http://stackoverflow.com/q/27323481
tags question: http://stackoverflow.com/q/27377293
tags question: http://stackoverflow.com/q/27416628
type: Tag
tag name: google-chrome

http://stackoverflow.com/a/27345783
answers question: http://stackoverflow.com/q/27345759
score: 1
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has body: Try something like: do { System.out.println("Enter the highest fibonacci number: "); fibMaxNum = user_input.next(); if (fibMaxNum &lt; 0) break; //process fibMaxNum. } while (true);
type: Answer
accepted answer of: http://stackoverflow.com/q/27345759

http://stackoverflow.com/q/27436793
tagged with: android-activity
has comment: http://stackoverflow.com/comment/43314290
type: AnsweredQuestion
has body: I am a newbie at programming. I am trying to combine two activities such that NewProductActivity will carry out the functions in CameraActivity. Both uses a link which directs it to a php page to upload the data into the server database. Please help. CameraActivity.java package sp.com; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; public class CameraActivity extends Activity implements OnClickListener{ private TextView messageText; private Button uploadButton, btnselectpic; private ImageView imageview; private int serverResponseCode = 0; private ProgressDialog dialog = null; public static final String cameraUrl = "android.intent.extra.CAMERA_URL"; private String upLoadServerUri = null; private String imagepath=null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.camera_activity); uploadButton = (Button)findViewById(R.id.uploadButton); messageText = (TextView)findViewById(R.id.messageText); btnselectpic = (Button)findViewById(R.id.button_selectpic); imageview = (ImageView)findViewById(R.id.imageView_pic); btnselectpic.setOnClickListener(this); uploadButton.setOnClickListener(this); //upLoadServerUri = "http://192.168.0.100/incidentreport2/UploadToServer.php"; upLoadServerUri = "http://172.20.10.3/incidentreport2/UploadtoServer.php"; } @Override public void onClick(View ar…
has comment: http://stackoverflow.com/comment/43315944
tagged with: java
has comment: http://stackoverflow.com/comment/43315793
accepted answer: http://stackoverflow.com/a/27461771
type: Question
tagged with: database
has comment: http://stackoverflow.com/comment/43314404
has title: How to combine 2 Java classes?
score: 0
has comment: http://stackoverflow.com/comment/43314548
answer count: 2
has comment: http://stackoverflow.com/comment/43314388
possible better answer: http://stackoverflow.com/a/27437354
has answer: http://stackoverflow.com/a/27461771
has answer: http://stackoverflow.com/a/27437354
has comment: http://stackoverflow.com/comment/43314529
tagged with: android
has comment: http://stackoverflow.com/comment/43315088
tagged with: php

store
tags question: http://stackoverflow.com/q/27433299
tags question: http://stackoverflow.com/q/27343347
tag name: store
type: Tag

http://stackoverflow.com/q/27432061
has answer: http://stackoverflow.com/a/27446377
tagged with: android
has comment: http://stackoverflow.com/comment/43305361
has title: CastClassException in custom fragment not working
possible better answer: http://stackoverflow.com/a/27433455
has answer: http://stackoverflow.com/a/27433455
has comment: http://stackoverflow.com/comment/43305331
accepted answer: http://stackoverflow.com/a/27446377
tagged with: classcastexception
type: AnsweredQuestion
tagged with: android-fragments
tagged with: java
has comment: http://stackoverflow.com/comment/43305735
type: Question
has body: So i have this code with the error that appears in the logcat. It shows an error with the cast im using for my custom fragment for some reason. I've searched before asking and i tried everything: Importing the v4.support.fragment Check the Manifest to see if its not declared there Extend Fragmentactivity in my main class I still have it, any ideas pls? Fragment Code: import java.util.Random; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; public class TapFragment extends Fragment { private Button[] _Btns_SinUso; private Button[] _Btns_AUsar; @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View RootView = inflater.inflate(R.layout.fragment_buttons, container, false); setLayout(RootView); return RootView; } public void setLayout(View v) { int Dif = GameManager.readPreferences(getActivity(), GameManager.KEY_DIF); switch (Dif) { case GameManager.GAMEDIF_MED: _Btns_AUsar = new Button[GameManager.SIZE_5X5.length]; _Btns_SinUso = new Button[GameManager.T5X5_UNUSED.length]; for (int i = 0; i &lt; _Btns_AUsar.length; i++) _Btns_AUsar[i] = (Button) v .findViewById(GameManager.SIZE_5X5[i]); for (int i = 0; i &lt; _Btns_SinUso.length; i++) { _Btns_SinUso[i] = (Button) v .findViewById(GameManager.T5X5_UNUSED[i]); _Btns_SinUso[i].setVisibility(View.GONE); } break; } } Main Activity Code: import java.util.Random; import java.util.Timer; import java.util.TimerTask; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.app.Activity; import android.app.FragmentTransaction; import android.content.Intent; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.vi…
answer count: 2
score: 0
has comment: http://stackoverflow.com/comment/43314281

http://stackoverflow.com/q/27444614
has title: Ajax request with header authorization
answer count: 0
tagged with: java
type: Question
tagged with: jquery
score: 0
has body: I am trying to create an ajax request from my site to my server with an authorization parameter. My domains are not the same but this is handled in the java servlet of the server. The problem is if don't include the header parameter of the code below, the request reaches the server but gives an error of missing authorization header (obviously) BUT when I send the request with the header authorization, I get the "No 'Access-Control-Allow-Origin' header is present on the requested resource" error. Any ideas? jQuery.ajax({ url: "someurl", type: "POST", headers: { "Authorization" : "some authorization", }, complete: function(data) { // something } });
linked to: http://stackoverflow.com/q/20035101
has comment: http://stackoverflow.com/comment/43328434
has comment: http://stackoverflow.com/comment/43328361
tagged with: ajax
type: UnansweredQuestion

http://stackoverflow.com/comment/43169168
type: Comment
has text: @tyson See my edit. You must override `equals` and `hashCode`.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27358342

http://stackoverflow.com/q/27456310
has answer: http://stackoverflow.com/a/27470676
has title: How to fetch a list of more than 500 users in Google Directory API?
score: 0
tagged with: java
has body: I have written a code which uses Google Directory API to fetch user accounts information from the server. It specifically fetches user list but by default, the system returns a list of 100 users in the alphabetical order of the user's email address. This can be changed by setting Directory.Users.List.setMaxResults to 500 (which is upper limit). But in case, I set it to more than 500, the call returns an exception. So my question is, in case the server has more than 500 users, is it possible to fetch all the users (more than 500) in a single list? If not, is there any workaround to fetch all the users? NOTE- I am using Java client library of directory api
has answer: http://stackoverflow.com/a/28128229
tagged with: google-directory-api
type: UnansweredQuestion
type: Question
tagged with: google-api
answer count: 2

http://stackoverflow.com/comment/43348528
type: Comment
comment on: http://stackoverflow.com/a/27455377
has text: component-scan is super set of annotation config, I think
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43360092
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27461784
has text: Map<String, List<String>> for lessons
score: 0

gradle
tags question: http://stackoverflow.com/q/27330829
tags question: http://stackoverflow.com/q/27449035
tags question: http://stackoverflow.com/q/27417739
tags question: http://stackoverflow.com/q/27428396
tags question: http://stackoverflow.com/q/27358851
tags question: http://stackoverflow.com/q/27334603
tags question: http://stackoverflow.com/q/27341127
tags question: http://stackoverflow.com/q/27427179
tags question: http://stackoverflow.com/q/27318254
type: Tag
tags question: http://stackoverflow.com/q/27372779
tags question: http://stackoverflow.com/q/27445383
tags question: http://stackoverflow.com/q/27428265
tags question: http://stackoverflow.com/q/27413741
tags question: http://stackoverflow.com/q/27384933
tags question: http://stackoverflow.com/q/27449562
tags question: http://stackoverflow.com/q/27444981
tags question: http://stackoverflow.com/q/27453400
tags question: http://stackoverflow.com/q/27425836
tags question: http://stackoverflow.com/q/27466940
tag name: gradle
tags question: http://stackoverflow.com/q/27366953
tags question: http://stackoverflow.com/q/27347778
tags question: http://stackoverflow.com/q/27438821
tags question: http://stackoverflow.com/q/27348323
tags question: http://stackoverflow.com/q/27319423
tags question: http://stackoverflow.com/q/27459789
tags question: http://stackoverflow.com/q/27409786
tags question: http://stackoverflow.com/q/27359845
tags question: http://stackoverflow.com/q/27346103
tags question: http://stackoverflow.com/q/27314197
tags question: http://stackoverflow.com/q/27392810
tags question: http://stackoverflow.com/q/27375807
tags question: http://stackoverflow.com/q/27354979
tags question: http://stackoverflow.com/q/27335138
tags question: http://stackoverflow.com/q/27344160
tags question: http://stackoverflow.com/q/27373725
tags question: http://stackoverflow.com/q/27337404
tags question: http://stackoverflow.com/q/27438488
tags question: http://stackoverflow.com/q/27464560

http://stackoverflow.com/comment/44415802
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27369596
has text: swapping the wildcard for an "or later" worked perfectly. Thank you for your answer @hasternet.
type: AnswerComment

http://stackoverflow.com/comment/43191306
comment on: http://stackoverflow.com/a/27369604
score: 0
type: AnswerComment
has text: the only problem is i need to keep an arrayList of many different shapes, some of type Rect and some of other types, i just showed one example of the type.
type: Comment

http://stackoverflow.com/a/27317581
has comment: http://stackoverflow.com/comment/43095601
has comment: http://stackoverflow.com/comment/43094884
type: Answer
has comment: http://stackoverflow.com/comment/43095387
has comment: http://stackoverflow.com/comment/95888234
has comment: http://stackoverflow.com/comment/43095320
answers question: http://stackoverflow.com/q/27314651
has comment: http://stackoverflow.com/comment/95888077
has body: You can have your FileHeaderNamingEnricher extend AbstractReplyProducingMesageHandler (put your code in handleRequestMessage()). Or, implement GenericHandler&lt;T&gt; (its handle method gets the payload and headers as parameters and can return a message). Then use the .handle method... ... .handle(myEnricher()) ... @Bean public void MessageHandler myEnricher() { return new FileHeaderNamingEnricher(); }
accepted answer of: http://stackoverflow.com/q/27314651
downvote count: 0
score: 4
upvote count: 4
type: AcceptedAnswer

http://stackoverflow.com/comment/43159307
comment on: http://stackoverflow.com/q/27352794
score: 0
has text: what is the version of struts?.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43363516
type: Comment
comment on: http://stackoverflow.com/a/27463548
type: AnswerComment
has text: It is a problem with your layout. Try removing the `BorderLayout.WEST` from your `add` call in `GameBoard`. For detailed instruction on how to use the BorderLayout, see [How to Use BorderLayout](https://docs.oracle.com/javase/tutorial/uiswing/layout/border.html).
score: 0

http://stackoverflow.com/a/39685202
answers question: http://stackoverflow.com/q/27454025
has comment: http://stackoverflow.com/comment/85647355
downvote count: 0
has comment: http://stackoverflow.com/comment/74568484
type: Answer
has comment: http://stackoverflow.com/comment/116011455
has comment: http://stackoverflow.com/comment/129792111
has comment: http://stackoverflow.com/comment/93511617
upvote count: 99
has body: For what is worth if anyone should read again this topic(like me) the correct answer would be in DateTimeFormatter definition, e.g.: private static DateTimeFormatter DATE_FORMAT = new DateTimeFormatterBuilder().appendPattern("dd/MM/yyyy[ [HH][:mm][:ss][.SSS]]") .parseDefaulting(ChronoField.HOUR_OF_DAY, 0) .parseDefaulting(ChronoField.MINUTE_OF_HOUR, 0) .parseDefaulting(ChronoField.SECOND_OF_MINUTE, 0) .toFormatter(); One should set the optional fields if they will appear. And the rest of code should be exactly the same. Edit : usefull thing from wittyameta comment : Remember to add the parseDefaulting AFTER you have called appendPattern. Otherwise it'll give DateTimeParseException
score: 99

http://stackoverflow.com/a/27343631
accepted answer of: http://stackoverflow.com/q/27343448
has body: My comments in a proper answer: ArrayClass input_array = new ArrayClass(len); for(int i = 0; i &lt;= 10; i++){ System.out.println(input_array[i]); } This does not work because here input_array is an instance of your class ArrayClass (and not an array). Only arrays can be accessed like this: array[i]. So if you want to access the array from your ArrayClass you could either do: ArrayClass input_array = new ArrayClass(len); for(int i = 0; i &lt;= 10; i++){ System.out.println(input_array.input_array[i]); } where the first input_array is the instance of your ArrayClass Object and the second input_array is the actual array inside that class (they have the same name, so it may be a little confusing). Generally speaking it would be myObject.array[i]. However, when you define a class like this, it is better to don't allow access to the classes variables but provide methods for that. So your class could look like that: public class ArrayClass { private int[] input_array; // private means that no access is allowed from outside the class private int nElems; public void insert(int value) { // here you already provide a method to access the array from outside the class input_array[nElems++] = value; } public int get(int index){ // this would be the method to get the value from your array return input_array[index]; } } Now you can access the array like this (in your loop for example): input_array.get(i); Providing such getter/setter methods is recommended, since here you can be sure that you control all access to the array and nothing "bad" can happen. Imagine you would write something like this in your main method: input_array.input_array = new int[0]; Then the array from your ArrayClass would be gone and you could no longer guarantee that the ArrayClass instance would work.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27343448
type: Answer
score: 2
upvote count: 2

http://stackoverflow.com/comment/43330423
has text: Nope, it would split value from json as well
comment on: http://stackoverflow.com/q/27445722
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/27366982
tagged with: java
has answer: http://stackoverflow.com/a/27367308
tagged with: user-interface
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43186224
accepted answer: http://stackoverflow.com/a/27367308
has title: Java Quiz with GUI
tagged with: service
type: AnsweredQuestion
upvote count: 1
type: Question
score: 1
has body: Hey there I am trying to build a quiz program for my English class Christmas party. It has a GUI and all but this is not important there. I have three buttons each bearing the tag of either Answer A, B , or C. I have a Button Go that fills in the first Question from an array. All the other Questions are stores in an array as well but each in a different one. They are named frage 1-10. They contains the Question three possible answers and a string that tells the program which one is the correct one. I need a service called nextQuestion that will fill in the next array into the corresponding fields. I struggle with this service as I can not think of any way to do so. I will post my source code here in the hope that you can help me with this. As I am German the code contains multi language parts. If you are struggling to understand do not hesitate to ask I will try my best to explain my scrubby code. I thank you in advance for your support. import sum.komponenten.*; import sum.werkzeuge.*; import sum.ereignis.*; public class DasQuiz extends EBAnwendung { // Objekte private Etikett hatEtikettHeader; private Knopf hatKnopfAnswerA; private Knopf hatKnopfExit; private Knopf hatKnopfAnswerB; private Knopf hatKnopfAnswerC; private Zeichenbereich hatZeichenbereichQuestion; private Etikett hatEtikett2; private Etikett hatEtikett3; private Etikett hatEtikett4; private Etikett hatEtikettTeamOne; private Etikett hatEtikettTemaTwo; private Etikett hatEtikettPunkte1; private Etikett hatEtikettPunkte2; private Knopf hatKnopfGo; private String[] frage1 = new String[]{"What is traditionally hidden in a Christmas pudding?", "A Coin", "A Watch", "A pair of dice", "A"}; private String[] frage2 = new String[]{"How many days are there on a traditional advent calendar?", "12", "24", "30", "B"}; private String[] frage3 = new String[]{"____pull Santa's sleigh", "Guniea Pigs", "Cats", "Reindeers", "C"}; private String[] frage4 = new String[]{"According to the song, how many days of Christmas a…

http://stackoverflow.com/a/27320448
has comment: http://stackoverflow.com/comment/43100113
type: Answer
has comment: http://stackoverflow.com/comment/43100188
answers question: http://stackoverflow.com/q/27320396
has comment: http://stackoverflow.com/comment/43100131
score: 0
has body: When you try to print an Array normally, you are simply calling to toString() method on an Array object. In Java, this is the default implementation which prints out a result like you saw above [I@43c46747. You should use System.out.println(Arrays.toString(myArray)); to print meaningful values for an Array.

http://stackoverflow.com/a/27389052
answers question: http://stackoverflow.com/q/27388932
type: Answer
has body: When you pop from the stack, op2 is the element at the top and op1 is at top-1. Change it to: op2 = nlist.pop(); op1 = nlist.pop(); To be more clear if your postfix expression is 56 - (so 5-6 in infix) your stack is | 6 | | 5 | and when you get the - you are doing nlist.push(op1 - op2); which pushes 6-5 into the stack while you should push 5-6.
score: 0
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43228671
accepted answer of: http://stackoverflow.com/q/27388932

http://stackoverflow.com/comment/43271947
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27413927
has text: You're sure that resource exists?
score: 0

http://stackoverflow.com/q/27346978
tagged with: java
has title: Toggling border color on JLabel with mouseListener
type: Question
has comment: http://stackoverflow.com/comment/43153513
score: 0
has body: I'm making FreeCell for a project and I've made the cards as Icons for JLabels. I want to highlight a card by putting a border on it when it's clicked and then when it's clicked again or moved, I want the border to disappear. mouseListener = new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { super.mouseClicked(e); Border border = BorderFactory.createLineBorder(Color.BLUE, 2); JLabel label = (JLabel) e.getSource(); label.setBorder(border); } };
tagged with: jlabel
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43148822
answer count: 0

tablemodel
type: Tag
tag name: tablemodel
tags question: http://stackoverflow.com/q/27422830
tags question: http://stackoverflow.com/q/27358576

http://stackoverflow.com/q/27413289
tagged with: listview
has body: I have some doubts. I'm trying to make an application with lists. I made one but with a ListAdapter extends BaseAdapter and ListView. Then I realized that there is also ListFragment. And with the fragments you can easily display messages "empty list". What I want to do is a list of items and each item associated with this single_item.xml for example. I have seen several examples, but there are differences between them and me is not good either choose from. Which is the updated method to do this and has the best performance? Are ListFragment better than ListAdapter extends BaseAdapter? Thanks in advance.
upvote count: 1
tagged with: android
answer count: 1
has title: Handling empty lists - better to use ListFragment or Fragment+ListView?
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27414305
tagged with: fragment
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43270917
type: Question
linked to: http://stackoverflow.com/q/79041428
downvote count: 0
tagged with: adapter

http://stackoverflow.com/comment/43220036
score: 2
comment on: http://stackoverflow.com/q/27385887
type: QuestionComment
type: Comment
has text: You should post your arrays initialization and population as well, with the provided code we can't be sure what's going on

http://stackoverflow.com/comment/62309998
has text: @CostiCiudatu how does it know which delimiter to split on? does this only work for a `,`?
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27390414

http://stackoverflow.com/comment/43244631
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27399347
has text: why package name in `applicationcontext.xml` and actual classes `(Tiger,Color)` is different?
score: 0

http://stackoverflow.com/comment/43342221
has text: Good point. There should be 5.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27451187
score: 0

http://stackoverflow.com/q/27359709
has comment: http://stackoverflow.com/comment/43183765
downvote count: 1
has comment: http://stackoverflow.com/comment/43171590
favorite count: 0
has comment: http://stackoverflow.com/comment/43183697
has comment: http://stackoverflow.com/comment/43171611
has answer: http://stackoverflow.com/a/27359884
has body: I am sitting with a little problem here, and i has been searching for hours for any soultion now, but cant seem to find any, and i hope you can help me. I have these methods: public String getInput(){ //Wait here somehow return "Whatever to return"; } public void keyTrigger(KeyEvent event){ if(event.getCode().equals(KeyCode.ENTER)){ String[] getInput = gameLog.getText().split("\n"); input = getInput[getInput.length - 1]; //Input is a variable in the class //Tell the getInput() to continue from where i waited } } So if anyone can tell me how the make the first method wait for a response from the other method, i woul be very happy, because none i have tried so far has worked EDIT... Sorry guys, i have missed out on some details. 1st: I am developing a GUI in JavaFX, and the gameLog variable is a textarea, and thats why im splitting the String on linebreaks. 2nd: when i call getInput() i want it to wait for the user to press enter, then get the input variable
has answer: http://stackoverflow.com/a/27360148
type: UnansweredQuestion
tagged with: javafx
has title: Java wait for variable to change
has answer: http://stackoverflow.com/a/27360552
type: Question
tagged with: java
score: 0
answer count: 3
upvote count: 1

http://stackoverflow.com/comment/43291013
has text: Whys should it? Its a valid date.
score: 0
comment on: http://stackoverflow.com/q/27424500
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27423100
accepted answer: http://stackoverflow.com/a/27425079
tagged with: java
type: Question
downvote count: 0
answer count: 1
favorite count: 0
has title: Instantiate Selenium webdriver in every class?
has body: This is not specifically a Selenium issue but probably more my lack of Java knowledge. I am writing Selenium tests and trying to do them in an Object Oriented way. As a result every class I have instantiates the current webdriver in the constructor. This means that every single class has the same constructor. Is there a different approach I should use or a more 'Java-esque' solution? public class Foo { WebDriver driver; public Foo(WebDriver driver){ this.driver = driver; } public static String getFoo(){ String newFoo = "example"; } } Then if I call Foo from another Class I have to pass the instantiated driver to it: public class FooB { public static void doSomething(){ Foo foo = new Foo(driver); foo.getFoo(); } }
score: 1
has answer: http://stackoverflow.com/a/27425079
tagged with: selenium
upvote count: 1
type: AnsweredQuestion

http://stackoverflow.com/comment/43339919
has text: If you read the link , he is inserting value using trigger and he just wants the inserted back. I believe why you getting the error was you have fooId has primary key and on error mybatis tries map to an error during which its unable to find error mapping object or something of that kind and throws null pointer error
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27448253
type: Comment

http://stackoverflow.com/q/27402800
tagged with: file
tagged with: methods
has comment: http://stackoverflow.com/comment/43250357
type: Question
has comment: http://stackoverflow.com/comment/43291004
has comment: http://stackoverflow.com/comment/43250325
has comment: http://stackoverflow.com/comment/43252207
has body: I'm trying to make a basic chat program using Java. I want to know if it's possible to make a method that executes code once a certain text file has been edited. Every time somebody types in the chat, the message is sent into a text file. I want it to be able to read a message from the text file every time it's edited. I know how to do everything except the method that could execute every time this certain text file is edited.
type: UnansweredQuestion
has title: Java Method To Execute When a Text File Is Edited
linked to: http://stackoverflow.com/q/6946079
has comment: http://stackoverflow.com/comment/43250303
tagged with: text
has comment: http://stackoverflow.com/comment/43250328
answer count: 0
score: 0
tagged with: java

http://stackoverflow.com/comment/43206547
type: Comment
comment on: http://stackoverflow.com/a/27377531
score: 0
type: AnswerComment
has text: how to define the set? Actually i am new to regular expressions

http://stackoverflow.com/comment/43358916
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27460827
has text: I would go to Project --> Clean --> Clean all projects and then this will rebuild the entire, getting rid of any outdated error markers.

http://stackoverflow.com/a/27400270
downvote count: 0
has body: To answer which wait to use will be very specific beacuse the answer may change depending on the Web-element you are focusing , Platform and many more. But what i can suggest you to use explicit wait in your situation as you specified that you are using multiple browsers and Web-element loading time is varying as per Browser. So the best deal is to use wait with Until. Your can set the WebDriver wait time to the maximum time you have observed so far, Because even if the webelement get click-able/visible it will not wait unnecessarily for the remaining time. Below is the example of one how i implemented in my project. WebDriverWait wait = new WebDriverWait(driver, 20); wait.until(ExpectedConditions.elementToBeClickable(By.xpath(".//*[@id='login']"))).click();
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27398295
answers question: http://stackoverflow.com/q/27398295
upvote count: 3
type: Answer
score: 3

http://stackoverflow.com/a/27356195
accepted answer of: http://stackoverflow.com/q/27356149
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/27356149
downvote count: 0
has body: Its about visibility. Properties are declared outside of constructor, so they can be visible in the class. But they are initialized inside the constructor.
type: AcceptedAnswer

http://stackoverflow.com/comment/43320000
comment on: http://stackoverflow.com/q/27439740
has text: No, the class itself is a Fragment
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27466937
has comment: http://stackoverflow.com/comment/43371221
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43370197
accepted answer of: http://stackoverflow.com/q/27466917
has comment: http://stackoverflow.com/comment/43371158
type: Answer
answers question: http://stackoverflow.com/q/27466917
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43370184
has body: Use Long.parseLong by passing 16 as radix of the number that you are entering as below: long myHexNumber = Long.parseLong("FFFFFB2E", 16); int number = (int)myHexNumber; System.out.println(number);
has comment: http://stackoverflow.com/comment/43371188
has comment: http://stackoverflow.com/comment/43371114

http://stackoverflow.com/comment/43146454
score: 2
has text: What is LetterCount? Your current class doesn't know what class LetterCount is in this context. If you want to use it statically it should be declared as so.
comment on: http://stackoverflow.com/q/27345569
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43177649
score: 3
comment on: http://stackoverflow.com/q/27362812
has text: You need Java 8 to allow static methods in an interface. Make sure your IDE knows that you're using Java 8. If you tell us what IDE you're using, then we can give you more specific help.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43202139
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27375213
score: 0
has text: @JavaDev I will take only arrival_time and sytem_nam ein my list .But I don't know how to put them in tabular format through jsp and jstl.

http://stackoverflow.com/q/27467901
has comment: http://stackoverflow.com/comment/125733664
type: Question
has comment: http://stackoverflow.com/comment/43390909
has comment: http://stackoverflow.com/comment/43375102
score: 4
has answer: http://stackoverflow.com/a/76121405
upvote count: 4
has body: Is there a way to know whether there is any pending transaction in JDBC? I mean the Connection class method. To commit we call Connection con; con.commit(); to rollback con.rollback(); But how to know, if the transaction already began. I'm writing multithreaded application, and transaction may began by other process. I must know it. it may be something like to con.inTransaction();
answer count: 1
downvote count: 0
tagged with: connection
favorite count: 0
has comment: http://stackoverflow.com/comment/43441624
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43441989
tagged with: jdbc
has title: How to know the transaction is active in JDBC?
has comment: http://stackoverflow.com/comment/43394903
tagged with: transactions
tagged with: java

http://stackoverflow.com/comment/43312829
comment on: http://stackoverflow.com/q/27415627
score: 0
type: Comment
type: QuestionComment
has text: Hi @ElliottFrisch, the host has the server set to “Australia/Melbourne” (we are in the same time zone although I am in Sydney). Regards, Glyn.

http://stackoverflow.com/a/27419125
score: 0
has comment: http://stackoverflow.com/comment/43281438
type: Answer
has comment: http://stackoverflow.com/comment/43281573
has body: You should not say like this. Because extends is the key used for both extends and implements in generics. you can say like this public abstract class sdfsadf&lt;T extends Enum&lt;? extends IMyInterface&gt;&gt; { } Here T will be enum as well as it will Implements IMyInterface.
answers question: http://stackoverflow.com/q/27419043

http://stackoverflow.com/comment/43344125
comment on: http://stackoverflow.com/q/27452831
has text: Use a loop from 0 to `d`. It cannot be done in a single `if` statement for arbitrary large `d`s.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43169083
has text: I edited answer so the schema generation script is Oracle-specific.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27357596
type: Comment

http://stackoverflow.com/q/27409107
tagged with: java
has comment: http://stackoverflow.com/comment/43314241
has comment: http://stackoverflow.com/comment/43312240
has answer: http://stackoverflow.com/a/29907289
type: Question
has answer: http://stackoverflow.com/a/27467822
score: 5
has answer: http://stackoverflow.com/a/29541802
linked to: http://stackoverflow.com/q/21279085
tagged with: jar
has body: Before you close this for being a duplicate for one of the below posts, Java changed the requirements for runnable applets in Java 1.8. These requirements make it impossible to run an applet that is not signed by a trusted certificate. The only way to get around this is to add websites to an exception list, which isn't working for me either strangely. Related, but out of date, posts: Java Error: "Your security settings have blocked a local application from running" "application blocked by security settings" prevent applets running using oracle SE 7 update 51 on firefox on Linux mint Run local java applet in browser (chrome/firefox) "Your security settings have blocked a local application from running" Generating our jar file Me and my 'company' have created a game that we want to put on our website. We converted the java app into an Applet. The applet runs in the appletViewer perfectly but it will not run in a webpage. Here is our manifest that we are using: Manifest-Version: 1.0 Application-Name: Battle-Ship Permissions: sandbox Created-By: Chetter-Games // empty line Signing our jar file The jar file is signed using a keystore that we have generated ourselfs (it is not from a trusted certificate distributor). Here is the output from jarsigner: Enter Passphrase for keystore: jar signed. Warning: No -tsa or -tsacert is provided and this jar is not timestamped. Without a timestamp, users may not be able to validate this jar after the signer certificate's expiration date (2015-12-09) or after any future revocation date. I was pretty sure that this error is negligible. This might cause problems later, but we just want to get something up and running right now. HTML page containing our Applet Here is the html for our page with the embedded applet: Here is a server-side ls of our working directory, which contains the applet page battle.html and the applet signed-BattleShip.jar: -rw-rw-r-- 1 www-data www-data 12136 Dec 5 21:57 back.jpg -rw-r--r-- 1 www-data www-data 195 D…
tagged with: http://stackoverflow.com/tag/html
tagged with: applet
linked to: http://stackoverflow.com/q/16196425
answer count: 4
favorite count: 0
has title: Applet refuses to run even with sandbox permissions and with site added to exception list
upvote count: 5
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/16376087
downvote count: 0
has answer: http://stackoverflow.com/a/27438962
has comment: http://stackoverflow.com/comment/43308560

http://stackoverflow.com/q/27445321
has comment: http://stackoverflow.com/comment/43330031
has title: Restarting a JFrame
has comment: http://stackoverflow.com/comment/43329488
answer count: 0
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
linked to: http://stackoverflow.com/q/3066590
has body: I am making a game and I have a Restart-function. I have looked around and found this: How to restart a JFrame when creating a multiple level game? but in my program I extend JFrame so I can't just simply .remove(). Anyone got any idea on how to solve this? Thanks.
tagged with: java
has comment: http://stackoverflow.com/comment/43331623
type: Question
has comment: http://stackoverflow.com/comment/43330301
linked to: http://stackoverflow.com/q/18114622
has comment: http://stackoverflow.com/comment/43329848
has comment: http://stackoverflow.com/comment/43329805
score: 0

http://stackoverflow.com/comment/43135423
has text: @PTheCoolGuy of course - that's the way it'll be for your first year. It's good to learn that way, figuring out how stuff works instead of calling some method to do it for you.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27339393

http://stackoverflow.com/comment/43203827
score: 0
type: AnswerComment
has text: I did what you suggested and had the same result. Then, since this is a very small project, I decided to remove it from JBoss and delete its deployment folder, deleted all the sources and wiped out the project completely from the Eclipse Workspace. There was nothing left of it. Then I started again, adding piece by piece and checking the result. When I finally added the contents of src/test/java and built the war for the first time. After the deploy in JBoss, all the contents of the test folder where there. So, we are back to the starting point.
type: Comment
comment on: http://stackoverflow.com/a/27360627

http://stackoverflow.com/q/27336391
linked to: http://stackoverflow.com/q/18093928
has answer: http://stackoverflow.com/a/27463188
has comment: http://stackoverflow.com/comment/43129671
linked to: http://stackoverflow.com/q/7485670
downvote count: 1
type: AnsweredQuestion
tagged with: java
score: -1
accepted answer: http://stackoverflow.com/a/27463188
type: Question
tagged with: find
upvote count: 0
tagged with: program-entry-point
answer count: 1
has title: Java - could not find or load main class error
favorite count: 0
has comment: http://stackoverflow.com/comment/43129544
tagged with: load
has body: I just added some code to a project and suddenly I get these errors. The class in question does have a main method and the other class ClientLauncher in the client package exists. I checked and the classes have the correct package listed in them. Any suggestions on what I should check? Thanks. Error: Could not find or load main class client.ClientLauncher selection does not contain a main type
has comment: http://stackoverflow.com/comment/43131098

http://stackoverflow.com/comment/43319729
has text: the app crashes nevertheless ?
comment on: http://stackoverflow.com/q/27439740
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43374794
comment on: http://stackoverflow.com/q/27469718
has text: I see. Okay, I'll surely try using HashMap. Thank you!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43221329
has text: Yup. It's my fault guys. I feel dumb now lol. Thanks for answers anyway. :(
comment on: http://stackoverflow.com/q/27386467
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43271114
type: QuestionComment
has text: What fields from your FIOCurrently object do you want to save on Preferences, exactly?
score: 0
comment on: http://stackoverflow.com/q/27412937
type: Comment

http://stackoverflow.com/q/27427171
has comment: http://stackoverflow.com/comment/43319894
downvote count: 0
has comment: http://stackoverflow.com/comment/43320251
has answer: http://stackoverflow.com/a/27440616
has comment: http://stackoverflow.com/comment/43316111
has comment: http://stackoverflow.com/comment/43316063
accepted answer: http://stackoverflow.com/a/27440616
answer count: 1
favorite count: 0
has title: TCP Hole Punching Java Example
upvote count: 2
has comment: http://stackoverflow.com/comment/43319825
tagged with: sockets
has comment: http://stackoverflow.com/comment/43296077
tagged with: hole-punching
has body: I am using the following code on a local machine : import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintWriter; import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; /** * Just for testing socket SO_RESUEADDR. If set SO_RESUEADDR to true, we can use * a single local port to listen for incoming TCP connections, and to initiate * multiple outgoing TCP connections concurrently. By this way we can implement * TCP hole punching(establish P2P connection traversal through NAT over TCP). */ public class TcpPeer2 { // TCP port is a different source from UDP port, it means you can listen on // same port for both TCP and UDP at the same time. private int localport = 7890; private ServerSocket peerSock; private Socket serverSocket; public TcpPeer2(final String serverHost, final int serverPort, final int localPort) throws Exception { this.localport = localPort; Thread server = new Thread(new Runnable() { @Override public void run() { try { peerSock = new ServerSocket(); System.out.println(peerSock.isBound()); peerSock.setReuseAddress(true); System.out.println(peerSock.isBound()); peerSock.bind(new InetSocketAddress("localhost", localport)); System.out.println("[Server]The server is listening on " + localport + "."); System.out.println(peerSock.isBound()); System.out.println(peerSock.isClosed()); System.out.println(peerSock.getLocalSocketAddress().toString()); //peerSock. while (true) { try { serverSocket = peerSock.accept(); // just means finishing handshaking, and connection // established. System.out.println("[Server]New connection accepted" + serverSocket.getInetAddress() + ":" + serverSocket.getPort()); BufferedReader br = getReader(serverSocket); PrintWriter pw = getWriter(serverSocket); String req = br.readLine(); System.out.println("[Server][REQ]" + req); pw.println(req); // pw.close(); // br.close(); } catch (IOException …
tagged with: bind
score: 2
type: AnsweredQuestion
tagged with: tcp
tagged with: java
has comment: http://stackoverflow.com/comment/43320670
has comment: http://stackoverflow.com/comment/43296300
type: Question

http://stackoverflow.com/comment/43387971
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27349011
has text: Yes, I added an answer so that anyone interested can learn about this problem.

http://stackoverflow.com/q/27344671
tagged with: timer
accepted answer: http://stackoverflow.com/a/27346745
tagged with: swing
type: AnsweredQuestion
tagged with: java
type: Question
has title: Resizing a JLabel with an setted Icon in a Panel when resizing the Window
tagged with: resize
has answer: http://stackoverflow.com/a/27346745
score: 0
answer count: 1
has body: I have a certain question about resizing an JLabel with a setted Icon. My Solution was create a Timer which resizes the Label by invoking the actionperformed()-method of an ActionListener-Interface. Is there any better solution? package examples; import images.MyImage; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Graphics; import java.awt.GridBagLayout; import java.awt.Image; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; import javax.swing.Box; 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 examples2 { private static JFrame frame = new JFrame(); private static JPanel panel = new JPanel(new BorderLayout()); private static class ButtonHandler implements ActionListener { @Override public void actionPerformed(ActionEvent e) { Image image = resizeImage(MyImage.IMAGE_BLUE_BLACKGROUND, panel.getWidth(), panel.getHeight()); label.setIcon(new ImageIcon(image)); } } private static ActionListener buttonhandler = new ButtonHandler(); private static Timer timer = new Timer(100, buttonhandler); private static JLabel label = new JLabel(new ImageIcon(resizeImage( MyImage.IMAGE_BLUE_BLACKGROUND, 1600, 100))); public static void main(String[] args) { JPanel northPanel = new JPanel(new BorderLayout()); JLabel text = new JLabel("Hakan Kiyar"); frame.setLayout(new BorderLayout()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().add(northPanel, BorderLayout.NORTH); frame.getContentPane().add(new JButton(), BorderLayout.CENTER); frame.setVisible(true); northPanel.add(Box.createVerticalStrut(10), BorderLayout.NORTH); northPanel.add(Box.createHorizontalStrut(10), BorderLayout.WEST); northPanel.add(Box.createHorizontalStrut(10), BorderLayout.EAST); northPanel.add(Box.createVerticalStrut(10), BorderLayout.SOUTH); northPanel.add(panel, BorderLayout.C…
tagged with: jlabel

http://stackoverflow.com/comment/43155443
score: 0
has text: Have a 'closest time' and assign it as you go through the list
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27350515

http://stackoverflow.com/comment/43119060
comment on: http://stackoverflow.com/a/27330378
type: AnswerComment
score: 0
type: Comment
has text: your explanation helped me a lot better than the websites thanks

http://stackoverflow.com/comment/43343267
comment on: http://stackoverflow.com/a/27449512
type: AnswerComment
score: 0
type: Comment
has text: They could implement the Map/List interface, but I don't see how that would help you get type safety, they would be Maps/Lists that you would need to cast anything you get out of it

http://stackoverflow.com/q/27337480
type: AnsweredQuestion
has body: I have a working app that would take a text file, modify it in stages until it was neat and usable. every stage would take in a file and modify it, then spit out a file that the next one would buffer in. i am trying to make it cleaner so i want stop pulling in files, except the first one, and pass the output down the app as a string. Using this code, how would i do that? this is the second stage. try { BufferedReader bufferedReader = new BufferedReader(new FileReader(new File("C:/Stage_Two.txt"))); StringBuffer stringBuffer = new StringBuffer(); String line; while ((line = bufferedReader.readLine()) != null) { Pattern pattern = Pattern.compile("ALL|MESSAGE|Time|PAPER_MAIN|GSP"); if (pattern.matcher(line).find()) { continue; } stringBuffer.append(line); stringBuffer.append("\n"); } BufferedWriter bwr = new BufferedWriter(new FileWriter(new File("C:/Stage_Three.txt"))); bwr.write(stringBuffer.toString()); bwr.flush(); bwr.close(); // to see in console //System.out.println(stringBuffer); } catch (IOException e) { } i have looked into InputStream, InputStreamReader, and Reader...but if its one of those i cant seem to make headway.
tagged with: java
tagged with: inputstream
type: Question
has title: Change from using a BufferedReader for a file, to a String
has comment: http://stackoverflow.com/comment/43131828
answer count: 1
tagged with: bufferedreader
has answer: http://stackoverflow.com/a/27337909
has comment: http://stackoverflow.com/comment/43131694
score: 0
accepted answer: http://stackoverflow.com/a/27337909
has comment: http://stackoverflow.com/comment/43131711
has comment: http://stackoverflow.com/comment/43131736

http://stackoverflow.com/comment/43153835
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27349585
type: Comment
has text: @Takendarkk No it doesn't have to be a square, it could be a rectangle. But the point is each row is going to have the same width and each column will have the same height.

http://stackoverflow.com/q/27363840
accepted answer: http://stackoverflow.com/a/27364013
has comment: http://stackoverflow.com/comment/45170090
score: 0
has body: My program is trying to match strings surrounded by curly braces recursively - i.e when given {example1 {example2}} {example3} {example4} it will match example1 {example2}, example3 and example4. I tried using \{.+\}, but that will match example1 {example2}} {example3} {example4. \{.+?\} matches example1 {example2, example3 and example4. Is there an easy way to do what I want with a regex, or alternatively simply in Java? I am not very well-versed on regular expressions, as you can probably tell.
answer count: 1
tagged with: regex
has comment: http://stackoverflow.com/comment/43179701
has title: How to properly regex nested strings
has comment: http://stackoverflow.com/comment/45170100
tagged with: match
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/3918681
tagged with: java
has answer: http://stackoverflow.com/a/27364013
duplicate of: http://stackoverflow.com/q/3918681
type: Question

jboss5.x
tag name: jboss5.x
tags question: http://stackoverflow.com/q/27320086
type: Tag

http://stackoverflow.com/comment/43232964
type: Comment
has text: But if I put in, let's say, 205 first, wouldn't that get placed into array [0][0]? I would need it to be placed into array[2][0].
comment on: http://stackoverflow.com/a/27391906
type: AnswerComment
score: 0

http://stackoverflow.com/q/27446975
has comment: http://stackoverflow.com/comment/43332936
has body: I have added in a Relative Layout some ImageViews with some Buttons and gave them some width and high values.I have tested the application on a nexus 7 and everything looks great but when I tested on other devices some functions like a popUpWindow or even some Views look wrong.Is there a way how to resise a layout with all his views dynamically to fit every device I test on ?
has answer: http://stackoverflow.com/a/27447053
score: 0
answer count: 1
has title: Android resize entirely layout with all his views dynamically
tagged with: android
accepted answer: http://stackoverflow.com/a/27447053
type: AnsweredQuestion
type: Question
tagged with: java

http://stackoverflow.com/a/27346841
type: AcceptedAnswer
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27346818
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27346818
score: 1
has body: Just grab the characters after the ": " String string = "Grid X: 32" int indexOFColon = string.indexOf(":"); String endNumber = string.subString(indexOFColon + 2); So you get the index of the colon, which is 6 in this case, and then grab the substring starting 2 after that, which is where your number starts.

http://stackoverflow.com/a/27360448
downvote count: 0
has comment: http://stackoverflow.com/comment/43173820
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27360351
type: Answer
has body: The purpose is that you don't need to construct new instances of immutable empty datastructures. You can simply reuse the existing ones. These fields had been introduced before Generics. With Generics you want to use the accessor methods instead because they are type-safe in a Generics way. I.e. instead of Collections.EMPTY_SET you want to use Collections.emptySet(). Fields cannot declare type parameters, but methods can. Here's an example where an empty collection comes in handy. Let's assume you have a function which returns the sum of a List of Integers, and you want to test that when you pass the empty list, it returns 0. The test would look like this: public class IntSumTest { @Test public void givenEmptyList_whenSumming_thenReturnsZero() { assertEquals(0, sum(Collections.emptyList()); } } I rarely use empty collections outside test classes, so I couldn't think of another example yet.
accepted answer of: http://stackoverflow.com/q/27360351
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/43173753
has comment: http://stackoverflow.com/comment/43174150
has comment: http://stackoverflow.com/comment/43173872

filesystems
tags question: http://stackoverflow.com/q/27390922
tag name: filesystems
type: Tag
tags question: http://stackoverflow.com/q/27355904

http://stackoverflow.com/comment/43239730
type: Comment
type: QuestionComment
has text: I have added the pom.xml
score: 0
comment on: http://stackoverflow.com/q/27372940

akka
type: Tag
tags question: http://stackoverflow.com/q/27318289
tags question: http://stackoverflow.com/q/27445955
tags question: http://stackoverflow.com/q/27374339
tag name: akka
tags question: http://stackoverflow.com/q/27360810
tags question: http://stackoverflow.com/q/27373703

http://stackoverflow.com/comment/43230904
score: 0
type: QuestionComment
has text: What exactly is your question? Are you saying that you can't use the `PriorityQueue<E>` that is already part of Java collections?
comment on: http://stackoverflow.com/q/27391634
type: Comment

http://stackoverflow.com/comment/43159918
has text: @Abraham Yes, that works; but you should [Write Dumb Code](http://www.oracle.com/technetwork/articles/javase/devinsight-1-139780.html). What advantage does using `--j >= 0` have? Also, if you prefer that style why not use `while (--j >= 0)`?
type: AnswerComment
comment on: http://stackoverflow.com/a/27348334
score: 0
type: Comment

http://stackoverflow.com/q/27314791
favorite count: 0
tagged with: playframework-2.0
has body: We have decided to handle log management through SPLUNK. The project is using java-play framework. How do I incorporate SPLUNK logging into play framework with java. Please assist with some example.
type: UnansweredQuestion
tagged with: bigdata
tagged with: splunk
downvote count: 1
tagged with: logging
tagged with: java
score: -1
type: Question
upvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27364529
has comment: http://stackoverflow.com/comment/43089917
has title: How can I incorporate Splunk logging into play framework with java?

http://stackoverflow.com/a/27416010
has comment: http://stackoverflow.com/comment/43276710
has comment: http://stackoverflow.com/comment/43276281
has comment: http://stackoverflow.com/comment/43276460
type: Answer
has comment: http://stackoverflow.com/comment/43276342
score: 1
upvote count: 1
has body: The code is very brittle. I suggest the following changes. I think there is a MalformedURLException and you are hiding it. public void readFlightData(String[] urls) { for (int x = 0; x &lt; urls.length; x++) { if (!(urls[x].equals(""))) { try { Worker w = new Worker(new URL(urls[x])); Thread work = new Thread(w); work.start(); } catch (MalformedURLException e) { System.err.print(e); } } } }
downvote count: 0
has comment: http://stackoverflow.com/comment/43297735
answers question: http://stackoverflow.com/q/27415122

http://stackoverflow.com/comment/43303132
type: AnswerComment
type: Comment
has text: http://localhost/CoreServletsTestCart/servlet/coreservlets.TechBooksPage and when I stick this code in web.xml I have: Element type "web-app" must be followed by either attribute specifications, ">" or "/>".
comment on: http://stackoverflow.com/a/27429173
score: 0

http://stackoverflow.com/q/27409922
tagged with: performance
score: 1
has title: Fastest way to import data from one database to other in mysql using Java
tagged with: java
tagged with: mysql
upvote count: 1
has body: DBMS - mysql Language - Java I have two databases Database One - I have only SELECT access. Database Two - Complete access. Exact Requirement : - I have to import many TABLES from Database One to Database Two. Current Solution :- I am SELECTING all rows from table and storing result in ResultSet. String sql = "SELECT * FROM " + tableName +" ;"; Result Set res = runSql(sql); Write each row from the ResultSet into a CSV file. OutputStreamWriter writer = null; writer = new OutputStreamWriter(new FileOutputStream(fileName), "UTF-8"); while (res.next() ){ for (int j = 1; j &lt;= noOfColumns.size(); j++) { if(j != 1) writer.append(","); writer.append("\""+res.getString(j)+"\""); } writer.append("\n"); } Use LOAD DATA INFILE to fill database Two from CSV file. String sql = "LOAD DATA LOCAL INFILE '"+fileName+"' INTO TABLE "+tableName+ " CHARACTER SET UTF8 "+" COLUMNS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY \"\n\";"; return runSql(sql); Repeating this process for all tables. My Question :- Can I do better as some tables have more than millions of rows? I find out that most of time is used by step 2 ( ResultSet to CSV writing ).
tagged with: import
type: Question
tagged with: export-to-csv
has answer: http://stackoverflow.com/a/27414316
has comment: http://stackoverflow.com/comment/43301668
has comment: http://stackoverflow.com/comment/43264172
has comment: http://stackoverflow.com/comment/43276615
downvote count: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43264272
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43391127

http://stackoverflow.com/comment/43296024
comment on: http://stackoverflow.com/q/27427136
score: 0
type: QuestionComment
type: Comment
has text: @DaveNewton careful you don't get infected when you go in. Otherwise before you know it you'll be designing Christmas cards in PowerPoint.

http://stackoverflow.com/comment/43169581
comment on: http://stackoverflow.com/q/27356920
score: 0
type: QuestionComment
type: Comment
has text: import java.util.Base64; this is the import statement which i used

http://stackoverflow.com/comment/43307337
score: 0
has text: ok, il reformulate the question. Give me a minute
comment on: http://stackoverflow.com/q/27432859
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27467822
downvote count: 0
score: 1
has body: Finally got my applet to work after hours and hours of messing around with it. Hopefully this works for you and saves others from hours of frustration: My Manifest file includes the following: Manifest-Version: 1.0 Permissions: sandbox Application-Name: Your Application Name Goes Here (Blank Line) My HTML file includes: And as for adding the domain to the Site Exception List, NOTHING worked until I added it in this format: http://mywebsite.com/ (note that it doesn't have the www. and includes a forward slash at the end. No other combination worked for me.) Make sure to include the manifest file in your jar. I used Eclipse Juno and this function is found when you export to a JAR. I placed my manifest.txt file in the src directory where the main classes were. I tried other manifest attributes like Codebase and Entry-Point, etc. but those gave me problems as well, so I removed them. My game currently runs perfectly aside from one problem - sound. No sound plays on the web version, though they play fine when run through eclipse. I'm satisfied with it as it stands, currently, and got an A for the project anyway... so i'll fix the sound issue later. Hope this helps! Posted the following previously, but it was removed due to not being an answer (but i did return with an answer, as promised). Mods, remove this if you want, but I think a little background might help other visitors identify with the issues they're having. I'm in the exact same position. I have a final project (also a game) due this week and I can't get my applet to load. Been researching for hours now and am still stuck. The weird thing is, I tested a simple "Hello World" applet that just prints the string on the screen, and that worked fine. I also tried running an applet with multiple classes to see if that was causing any issues, yet that ran fine, too. Then I tried running that same applet in a jar file, and that also worked. Tried loading my game with high hopes but was crushed to see that java blocked i…
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/27409107

http://stackoverflow.com/comment/43385066
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27441447
has text: @will only with an alignment of bottom ... baseline is just fine. Again: you can't _expect_ text to be aligned except in baseline, if it is for others, you are just lucky. So: good luck :-)
type: AnswerComment

http://stackoverflow.com/a/27462314
has comment: http://stackoverflow.com/comment/43369562
upvote count: 1
has comment: http://stackoverflow.com/comment/43361653
answers question: http://stackoverflow.com/q/27462260
downvote count: 0
score: 1
has body: Thread pool internally has list which is a place holder for threads which is being used as and when there are requirements and adds them to this list when it completes the execution or creates a new one when one terminates and maintains them by growing in number or reducing based on whether you asked for cached or fixed thread pool.
type: Answer

http://stackoverflow.com/comment/43160954
type: QuestionComment
comment on: http://stackoverflow.com/q/27341855
score: 0
has text: @Elmar, sadly, but the interface resides in a third-party library, and moreover, the class is also supposed to be used by that library.
type: Comment

http://stackoverflow.com/comment/43109814
has text: Enter an Expression: ADD(DIV(SIN(FACT(3)),CEIL(TAN(MUL(1.5,FIB(4))))),GCD(2,10)) //this what user enters or input
comment on: http://stackoverflow.com/a/27319587
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27339576
type: AnsweredQuestion
tagged with: java
tagged with: android-linearlayout
has answer: http://stackoverflow.com/a/27339659
type: Question
score: 0
answer count: 2
has title: onFling and LinearLayouts
accepted answer: http://stackoverflow.com/a/27339659
has body: My Linear Layout: main_linear_layout contains four Linear Layouts: ll1 ll2 ll3 ll4. Each LinearLayout contains Buttons. I am trying to implement the onFling method on main_linear_layout. I want to be able to swipe anywhere on the Layout of Buttons and call an action. Currently I am able to swipe anywhere on the screen except for the Layout of Buttons. I tried using the following code to fix the problem: swipeLayout = (LinearLayout) findViewById(R.id.main_linear_layout); //swipeLayout is the main Layout that contains 4 other linear layouts swipeLayout.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub gestureScanner.onTouchEvent(event); return true; } }); But I am still not able to swipe on the Layout of Buttons. Does anybody know why this is? Is there something else I need to implement? Am I supposed to implement an OnTouchListener to every Linear Layout inside the main Linear Layout? Or to every Button in each Layout? And in the xml I added a bunch of code to the main Linear Layout: android:clickable="true" android:focusable="true" android:focusableInTouchMode="true" android:longClickable="true" But this did not work either. Can someone please help?
possible better answer: http://stackoverflow.com/a/27339772
has answer: http://stackoverflow.com/a/27339772
tagged with: android
tagged with: onfling

bukkit
tag name: bukkit
tags question: http://stackoverflow.com/q/27325391
tags question: http://stackoverflow.com/q/27467550
tags question: http://stackoverflow.com/q/27451375
tags question: http://stackoverflow.com/q/27326588
type: Tag
tags question: http://stackoverflow.com/q/27325247
tags question: http://stackoverflow.com/q/27325278

http://stackoverflow.com/comment/43373315
comment on: http://stackoverflow.com/a/27464799
has text: Thank you so much! All I did was this " WHERE ENCOMENDA = "+ num +" "; I swapped that and it works!! thank you one more time! I'll try to do the same but between two different prices :)
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27375632
favorite count: 0
upvote count: 2
has body: I'm trying to put username and password to appropriate text field in a web page. first I find the element by id for email and put the email for it and then find the element by id for password and put the password for it, but before fill out the email field in text box it jump to the password field and complete the task, I needed to wait for fill the email and after that jump to the password field. I tried implicit and explicit wait, but both are not working please help me I am using firefox with selenium 2.44 // Enter Email driver.findElement(By.id("Email")).sendKeys("xxxxxxxx@gmail.com"); WebElement myDynamicElement = (new WebDriverWait(driver, 10)).until(ExpectedConditions.presenceOfElementLocated(By.id("Email"))); //driver.manage().timeouts().pageLoadTimeout(5, TimeUnit.SECONDS); //Enter pwd driver.findElement(By.id("Passwd")).sendKeys("xxxxx"); driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS); // Click the sign in button driver.findElement(By.id("signIn")).click(); Edited: here is my complete code import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; public class Sample { public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.get("https://www.google.com/"); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.manage().window().maximize(); driver.findElement(By.id("gbqfq")).sendKeys("gmail"); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.findElement(By.id("gbqfb")).click(); driver.findElement(By.xpath("//*[@id=\"rso\"]/div[2]/li[1]/div/h3/a[1]")).click(); // Click the sign in button driver.findElement(By.id("gmail-sign-in")).click(); driver.manage().timeouts().…
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43206293
has answer: http://stackoverflow.com/a/36697867
has comment: http://stackoverflow.com/comment/43205110
has answer: http://stackoverflow.com/a/27376067
tagged with: selenium-webdriver
score: 2
has answer: http://stackoverflow.com/a/27378625
has comment: http://stackoverflow.com/comment/43201348
tagged with: java
has comment: http://stackoverflow.com/comment/43204708
has comment: http://stackoverflow.com/comment/43201744
tagged with: selenium
has comment: http://stackoverflow.com/comment/43203433
has comment: http://stackoverflow.com/comment/43205946
tagged with: webdriver
has title: before fill out the text field, jump to next text field in selenium
type: Question
has comment: http://stackoverflow.com/comment/43201350
has comment: http://stackoverflow.com/comment/43204248
answer count: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/43202735

http://stackoverflow.com/q/27432256
tagged with: java
has title: OpenCV imread from Hadoop/HDFS
tagged with: image-processing
type: Question
tagged with: hadoop
score: 5
has comment: http://stackoverflow.com/comment/43306555
has comment: http://stackoverflow.com/comment/43306972
tagged with: hdfs
linked to: http://stackoverflow.com/q/36270351
has comment: http://stackoverflow.com/comment/60427131
has comment: http://stackoverflow.com/comment/43306923
favorite count: 0
answer count: 0
upvote count: 5
type: UnansweredQuestion
has body: I have successfully tested opencv in hadoop to read and analyze images from local filesystem in a mapreduce job. But how to enable opencv to read images from HDFS instead of local filesystem?
tagged with: opencv
downvote count: 0

http://stackoverflow.com/a/27317323
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27317066
has body: One option is sort your array and get the first element: import java.util.Arrays; ... int ints[] = {30,5,7,4,10}; Arrays.sort(ints); int min = ints[0]; int max = ints[ints.length - 1];
type: Answer

http://stackoverflow.com/comment/43131410
has text: It's likely that the selection hasn't changed yet, as your MouseListener is probably been called before the tables, resulting in the incorrect cell been retrieved
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27337395

http://stackoverflow.com/comment/43131629
has text: Evidently you don't understand time complexity at all. This is an _asymptotic_ result. The constant factors are ignored, the smaller factors are dropped. `HashMap` will (almost) always be faster, it simply does less work. In any case, the answer will depend on your particular objects, your particular `compareTo` and `equals` and `hashCode` implementations. Your particular usage of the constructs. **BENCHMARK**.
comment on: http://stackoverflow.com/q/27337508
type: Comment
type: QuestionComment
score: 3

http://stackoverflow.com/a/27372174
has body: The condition you are validating returns you only the numbers that are not divisible by 3 to make for finding the prime numbers you need to at least check for all the numbers less than its square root . ie. boolean chkPrime(int num) { for(int i=2;i&lt;(sqrt(num));i++) if(num % i==0) return false; return true; }
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27372028

http://stackoverflow.com/comment/43295212
comment on: http://stackoverflow.com/q/27415926
type: Comment
has text: No they are not entering. I tried to do a Gdx debug print and checked on the console. It didn't print even for `tap` method.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43280287
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27418590
type: AnswerComment
has text: This seems a little inefficient. I am trying to maintain linear time.

http://stackoverflow.com/q/27338392
tagged with: compiler-errors
has comment: http://stackoverflow.com/comment/43133345
has body: I'm new to java, and I've been trying to get my program to compile using Netbeans. HelloWorldApp.java uses the Greeter class in Greeter.java. I keep getting errors and I can't figure it out. I understand that you have to include "packages" or something. I don't have a lot of experience with Netbeans either. But I would love for this to work. Here is the HelloWorldApp.java: package helloworldapp; import Greeter public class HelloWorldApp { public static void main(String[] args) { Greeter myGreeterObject = new Greeter(); myGreeterObject.sayHello(); } } And here is Greeter.java: public class Greeter { public void sayHello() { System.out.println("Hello, World!"); } }
type: AnsweredQuestion
tagged with: netbeans
has comment: http://stackoverflow.com/comment/43133427
has comment: http://stackoverflow.com/comment/43133468
tagged with: java
has comment: http://stackoverflow.com/comment/43133481
possible better answer: http://stackoverflow.com/a/27338429
type: Question
accepted answer: http://stackoverflow.com/a/27338457
has comment: http://stackoverflow.com/comment/43133335
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27338457
has answer: http://stackoverflow.com/a/27338429
has answer: http://stackoverflow.com/a/27347558
has title: Getting Netbeans Java program to compile

binary-tree
tag name: binary-tree
tags question: http://stackoverflow.com/q/27383504
type: Tag
tags question: http://stackoverflow.com/q/27332953
tags question: http://stackoverflow.com/q/27470810
tags question: http://stackoverflow.com/q/27325970
tags question: http://stackoverflow.com/q/27419337

http://stackoverflow.com/comment/43281019
type: Comment
has text: Ah yes, silly mistake there. Still getting the Arrayindexoutofbound error on the main method, however...
type: AnswerComment
comment on: http://stackoverflow.com/a/27418920
score: 0

http://stackoverflow.com/q/27324189
tagged with: java
type: Question
has body: Sorry in advance for my english. I want to import images folder of my smartphone. I want used these images to do a gallery. My problem is when I put the images in an array, after I can't put each images of the array in a ImageView. It's my code for using the gallery public class SeeGallery extends Activity { File[] listFile ; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_see_gallery); File folder = new File(Environment.getExternalStorageDirectory() + "/ProjectKozaImages"); listFile = folder.listFiles(); // Note that Gallery view is deprecated in Android 4.1--- Gallery gallery = (Gallery) findViewById(R.id.gallery1); gallery.setAdapter(new ImageAdapter(this)); gallery.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View v, int position,long id) { // display the images selected ImageView imageView = (ImageView) findViewById(R.id.image1); imageView.setImageResource(listFile[position]); } }); } public class ImageAdapter extends BaseAdapter { private Context context; private int itemBackground; public ImageAdapter(Context c) { context = c; // sets a grey background; wraps around the images TypedArray a =obtainStyledAttributes(R.styleable.MyGallery); itemBackground = a.getResourceId(R.styleable.MyGallery_android_galleryItemBackground, 0); a.recycle(); } // returns the number of images public int getCount() { return listFile.length; } // returns the ID of an item public Object getItem(int position) { return position; } // returns the ID of an item public long getItemId(int position) { return position; } // returns an ImageView view public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView = new ImageView(context); imageView.setImageResource(listFile[position]); imageView.setLayoutParams(new Gallery.LayoutParams(100, 100)); imageView.setBackgroundResource(itemBackground); return imageView; } } Thank you in advance…
has title: Android Images Folder in a ImageView
score: 0
tagged with: android
answer count: 1
has answer: http://stackoverflow.com/a/27324412
type: UnansweredQuestion

http://stackoverflow.com/a/27320202
type: Answer
answers question: http://stackoverflow.com/q/27320101
score: 0
has body: It's more about style. makeEvent does not access any fields of BeatBox1, and static uses the compiler to ensure that claim. As far as performance is concerned, there will be little to no difference. The complier will add a this as the first parameter of non-static methods, which is how fields are accessed, but this shouldn't make a real impact on performance.

http://stackoverflow.com/q/27469607
type: Question
type: AnsweredQuestion
has title: sleep between two function in android java?
score: 0
answer count: 1
has body: I Have class to record sound in my android project . In this class i have 2 function : start() and stop() and i have a main class I want run it from other activity such : record(second) and record some time and stop aoutomaticly after those second ! Like this : start(); //sleep(second) stop(); How I can do this ? this is my code : package com.example.voicerec; import java.io.IOException; import android.media.MediaPlayer; import android.media.MediaRecorder; import android.os.Environment; import android.view.View; public class VoiceR { private MediaRecorder myRecorder; private MediaPlayer myPlayer; private String outputFile = null; public void Record() { outputFile = Environment.getExternalStorageDirectory().getAbsolutePath() + "/momeni.3gpp"; myRecorder = new MediaRecorder(); myRecorder.setAudioSource(MediaRecorder.AudioSource.MIC); myRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); myRecorder.setAudioEncoder(MediaRecorder.OutputFormat.THREE_GPP); myRecorder.setOutputFile(outputFile); } public void start(View view) { try { myRecorder.prepare(); myRecorder.start(); } catch (IllegalStateException e) { // start:it is called before prepare() // prepare: it is called after start() or before setOutputFormat() e.printStackTrace(); } catch (IOException e) { // prepare() fails e.printStackTrace(); } } public void stop(View view) { try { myRecorder.stop(); myRecorder.release(); myRecorder = null; } catch (IllegalStateException e) { // it is called before start() e.printStackTrace(); } catch (RuntimeException e) { // no valid audio/video data has been received e.printStackTrace(); } } public void play(View view) { try { myPlayer = new MediaPlayer(); myPlayer.setDataSource(outputFile); myPlayer.prepare(); myPlayer.start(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } public void stopPlay(View view) { try { if (myPlayer != null) { myPlayer.stop(); myPlayer.release(); myPlayer = null; } } catch (Exception e) { // TODO Auto-gene…
tagged with: android
has answer: http://stackoverflow.com/a/27469652
accepted answer: http://stackoverflow.com/a/27469652
tagged with: java

http://stackoverflow.com/comment/43110606
has text: yes, I added the project "FibonacciServlet" by right clicking on the server instance and adding the project but the problem still persists.
comment on: http://stackoverflow.com/q/27319524
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27397326
type: Question
has answer: http://stackoverflow.com/a/27397493
answer count: 1
tagged with: jsp
tagged with: javascript
has body: I wanna close the pop up child window and reload the parent window after hitting the servlet in java. Is there any example that helps me to do this?
score: 0
favorite count: 0
has title: How to close a windows opener after hitting the servlet
type: UnansweredQuestion
upvote count: 1
downvote count: 1
tagged with: java
tagged with: servlets

http://stackoverflow.com/comment/43297286
comment on: http://stackoverflow.com/q/27427892
score: 0
has text: Can you clarify what you hope to accomplish with this? I can't tell exactly what you're asking, but a MD5 of two MD5 inputs is possible (and would be a unique new hash value).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43474964
score: 0
type: Comment
has text: Is OAuth2RestTemplate used in Client? What if my Client also as Resource Server (so it accesses itself and return the jsp page)? Can OAuth2RestTemplate used?
comment on: http://stackoverflow.com/a/27399301
type: AnswerComment

http://stackoverflow.com/q/27438450
score: -1
type: Question
answer count: 1
downvote count: 1
has title: Cannot play the video
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/43316864
has answer: http://stackoverflow.com/a/27438921
upvote count: 0
has comment: http://stackoverflow.com/comment/43317146
type: UnansweredQuestion
has body: I am trying to play the video file .But it gives me error(1,-1004).I am not able to find what problem is . Kindly help import android.media.MediaPlayer; import android.media.MediaPlayer.OnPreparedListener; import android.net.Uri; import android.os.Bundle; import android.app.Activity; import android.view.Menu; import android.widget.MediaController; import android.widget.VideoView; public class MainActivity extends Activity { VideoView videoView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); videoView= (VideoView)findViewById(R.id.video_view); videoView.setVideoURI(Uri.parse("http://192.168.1.234/hls-live/livepkgr/_definst_/liveevent/livestream.m3u8")); videoView.start(); } }
tagged with: java

http://stackoverflow.com/q/27323421
type: Question
score: -2
tagged with: combobox
has answer: http://stackoverflow.com/a/27325327
has title: Problems loading data into combobox
tagged with: java
downvote count: 2
tagged with: swing
has comment: http://stackoverflow.com/comment/43106338
answer count: 1
has comment: http://stackoverflow.com/comment/43107014
has comment: http://stackoverflow.com/comment/43106182
has comment: http://stackoverflow.com/comment/43106805
has comment: http://stackoverflow.com/comment/43109754
has body: public void muestraRegistro(JTextField t1 ,JTextField t2 , JTextField t3 , JTextField t4 , JTextField t5,JTextField t6 , JComboBox cmb) { try { int row = ProductoGUI.tblDetalle.getSelectedRow(); String muestra = ProductoGUI.tblDetalle.getModel().getValueAt(row, 0).toString(); //String muestra = ProductoGUI.tblDetalle.getValueAt(ProductoGUI.tblDetalle.getSelectedRow(), 0).toString(); rs = cargaRegistro(); while (rs.next()) { t1.setText(rs.getString(1)); t2.setText(rs.getString(2)); cmb.setSelectedItem(rs.getString(3)); System.out.print(cmb); t3.setText(rs.getString(4)); t4.setText(rs.getString(5)); t5.setText(rs.getString(6)); t6.setText(rs.getString(7)); habilitaTexto(false, t2, t3, t4, t5, t6); } } catch (SQLException | HeadlessException ex) { JOptionPane.showMessageDialog(null,ex); Logger.getLogger(ProductoDAO.class.getName()).log(Level.SEVERE, null, ex); } } I have the code, but I have trouble throws me the following message when loading the data from the combobox jtable javax.swing.JComboBox[,113,91,200x18,layout=com.sun.java.swing.plaf.windows.WindowsComboBoxUI$3,alignmentX=0.0,alignmentY=0.0,border=,flags=328,maximumSize=,minimumSize=,preferredSize=,isEditable=false,lightWeightPopupEnabled=true,maximumRowCount=8,selectedItemReminder=1]javax.swing.JComboBox[,113,91,200x18,layout=com.sun.java.swing.plaf.windows.WindowsComboBoxUI$3,alignmentX=0.0,alignmentY=0.0,border=,flags=328,maximumSize=,minimumSize=,preferredSize=,isEditable=false,lightWeightPopupEnabled=true,maximumRowCount=8,selectedItemReminder=1]javax.swing.JComboBox[,113,91,200x18,layout=com.sun.java.swing.plaf.windows.WindowsComboBoxUI$3,alignmentX=0.0,alignmentY=0.0,border=,flags=328,maximumSize=,minimumSize=,preferredSize=,isEditable=false,lightWeightPopupEnabled=true,maximumRowCount=8,selectedItemReminder=1]
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43114355
has comment: http://stackoverflow.com/comment/43106403
has comment: http://stackoverflow.com/comment/43106108
upvote count: 0
favorite count: 0

http://stackoverflow.com/comment/43308113
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27433481
has text: Does your app have an Activity with LAUNCHER category?
type: QuestionComment

http://stackoverflow.com/q/27463951
has body: I need some help with creating a grid in java AWT. You get a certain number of columns, for now let's say 13. for(int i = 0; i &lt; 13; i++) { Graphics.fillRect((i * 15), 10, 10, 10); } Graphics takes in x, y, width, height. This results in; XXXXXXXXXXXXX This will put all cubes next to each other. This is not what I want. I need the y position to go down by 15 pixels every time 4 cubes have been drawn. The result would be XXXX XXXX XXXX X Thanks for your time!
tagged with: awt
has answer: http://stackoverflow.com/a/27464141
answer count: 3
favorite count: 0
downvote count: 2
accepted answer: http://stackoverflow.com/a/27464141
has title: Java AWT graphics for loop grid
has comment: http://stackoverflow.com/comment/43364059
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27463997
tagged with: java
has answer: http://stackoverflow.com/a/27463997
has comment: http://stackoverflow.com/comment/43364072
type: Question
tagged with: for-loop
has answer: http://stackoverflow.com/a/27464035
upvote count: 0
score: -2

http://stackoverflow.com/a/27363577
has body: It's up to the driver. It could return 0, it could return null or it could throw an Exception. Different drivers might (and probably will) behave differently. The moral is, use the correct call for the underlying type.
answers question: http://stackoverflow.com/q/27363490
type: Answer
score: 2
downvote count: 0
upvote count: 2

http://stackoverflow.com/comment/43180611
score: 0
type: Comment
has text: `throws` in your `submethod()` is to let the calling block know that there is an Exception that has not been caught. In your `main()` method you need to surround the call of `submethod()` in a `try-catch` block. `throws` on your `main()` method is almost never a good idea (possibly just never).
type: QuestionComment
comment on: http://stackoverflow.com/q/27364351

http://stackoverflow.com/comment/43134137
has text: I mean Use `id = Integer.parseInt(scnr.next());` Auto correction on mobiles can be really annoying sometimes:)
comment on: http://stackoverflow.com/a/27338767
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/27454000
favorite count: 0
type: UnansweredQuestion
tagged with: android
upvote count: 1
tagged with: android-sqlite
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27454366
has title: Table is not being created using SQLite in Android application
downvote count: 0
answer count: 1
score: 1
has body: I try to create a table using sqlite in my application. Here is my code: public class DatabaseHandler extends SQLiteOpenHelper { // All Static variables // Database Version private static final int DATABASE_VERSION = 1; // Database Name private static final String DATABASE_NAME = "android_api"; // Login table name private static final String TABLE_LOGIN = "login"; // Login Table Columns names private static final String KEY_ID = "id"; private static final String KEY_NAME = "name"; private static final String KEY_EMAIL = "email"; private static final String KEY_UID = "uid"; private static final String KEY_CREATED_AT = "created_at"; private static final String KEY_TOTAL_USAGE = "total_usage"; public DatabaseHandler(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); } // Creating Tables @Override public void onCreate(SQLiteDatabase db) { String CREATE_LOGIN_TABLE = "CREATE TABLE " + TABLE_LOGIN + "(" + KEY_ID + " INTEGER PRIMARY KEY," + KEY_NAME + " TEXT," + KEY_EMAIL + " TEXT UNIQUE," + KEY_UID + " TEXT," + KEY_CREATED_AT + " TEXT," + KEY_TOTAL_USAGE + " TEXT);"; db.execSQL(CREATE_LOGIN_TABLE); } // Upgrading database @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // Drop older table if existed db.execSQL("DROP TABLE IF EXISTS " + TABLE_LOGIN); // Create tables again onCreate(db); } /** * Storing user details in database * */ public void addUser(String name, String email, String uid, String created_at) { SQLiteDatabase db = this.getWritableDatabase(); ContentValues values = new ContentValues(); values.put(KEY_NAME, name); // Name values.put(KEY_EMAIL, email); // Email values.put(KEY_UID, uid); // Email values.put(KEY_CREATED_AT, created_at); // Created At // values.put(KEY_TOTAL_USAGE, total_usage); // Total_usage // Inserting Row db.insert(TABLE_LOGIN, null, values); db.close(); // Closing database connection } /** * Storing user details in database * */ public void updateUser(String email, String total_usa…

http://stackoverflow.com/comment/43183686
score: 0
comment on: http://stackoverflow.com/q/27362475
has text: Thank you for the answer, i didn't realize.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43260914
has text: [Programming With Assertions](http://docs.oracle.com/javase/8/docs/technotes/guides/language/assert.html#usage-control) discusses how to use this, including for pre-conditions, post-conditions, and control flow invariants.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27408216
type: Comment

http://stackoverflow.com/q/27437390
favorite count: 0
has answer: http://stackoverflow.com/a/27437658
tagged with: android
has body: So with this code I am getting the desirable results where as there are 3 buttons created each time the if statement is executed with an on click. The first button has a var name and takes up the majority of the space. The second 2 buttons, remove and change, are both the same size and small to the right of the name button. However I have my weight set as such: LinearLayout.LayoutParams newLayout = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams newTroopParam = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1f); LinearLayout.LayoutParams rmvBtnParam = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 3.5f); LinearLayout.LayoutParams chngNameParam = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 3.5f); I was under the impression that the first button that has the 1f would be the smallest if the number was smaller. Here is my full if statement. Like I said I get desirable results but I would like to further understand this and if I am doing this right or not. Thanks if (count &lt;= 5) { //CREATE NEW LINEAR LAYOUT LinearLayout addTroopLayout = new LinearLayout(this); //CREATE LAYOUT PARAMS FOR LAYOUT LinearLayout.LayoutParams newLayout = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); newLayout.bottomMargin = 10; //STYLE NEW LINEAR LAYOUT addTroopLayout.setId(count); addTroopLayout.setLayoutParams(newLayout); addTroopLayout.setOrientation(LinearLayout.HORIZONTAL); //CREATE NEW BUTTONS Button newTroop = new Button(this); Button remove = new Button(this); Button change = new Button(this); //CREATE LAYOUT PARAMS FOR BUTTONS LinearLayout.LayoutParams newTroopParam = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT, 1f); LinearLayout.LayoutParams rmvBtnParam = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CO…
has title: Completely lost on weight. Maybe my code isnt right
score: -1
has comment: http://stackoverflow.com/comment/43315270
accepted answer: http://stackoverflow.com/a/27437658
downvote count: 1
type: AnsweredQuestion
tagged with: java
type: Question
upvote count: 0
answer count: 1

http://stackoverflow.com/q/27460180
accepted answer: http://stackoverflow.com/a/27460520
has comment: http://stackoverflow.com/comment/43356828
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43357128
tagged with: reflection
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/43357018
type: Question
has comment: http://stackoverflow.com/comment/43356851
has comment: http://stackoverflow.com/comment/43357174
has comment: http://stackoverflow.com/comment/43356809
has answer: http://stackoverflow.com/a/27460520
has body: I try to analyze runtime information with reflections. The class I try to analyze has a static array of type me.instrumentor.InstrumentStackElem and I want to access and copy it using reflections. The code looks like this: final Field stack = this.object.getClass().getDeclaredField("ise_array"); stack.setAccessible(true); final Object arr = stack.get(null); final InstrumentStackElem[] tmp = new InstrumentStackElem[Array.getLength(arr)]; for (int i = 0; i &lt; tmp.length; i++) { tmp[i] = (InstrumentStackElem) Array.get(arr, i); } When I try to run it, I get java.lang.ClassCastException: me.instrumentor.InstrumentStackElem cannot be cast to me.instrumentor.InstrumentStackElem at the line in the for loop. Can anyone help me?
has comment: http://stackoverflow.com/comment/43356913
answer count: 1
has comment: http://stackoverflow.com/comment/43357900
has comment: http://stackoverflow.com/comment/43356899
downvote count: 0
has comment: http://stackoverflow.com/comment/43356873
favorite count: 0
has comment: http://stackoverflow.com/comment/43356897
has comment: http://stackoverflow.com/comment/43357285
has title: ClassCastException with Reflections

http://stackoverflow.com/q/27470890
tagged with: ant
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27471339
favorite count: 0
upvote count: 2
has title: macrodef not conveying the exit status correctly
has body: I am calling an Ant task defined using macrodef but I find that the fail task's exit status is not properly conveyed to the shell. The following is a SSCCE: Ant file: &lt;project&gt; &lt;macrodef name="ff"&gt; &lt;sequential&gt; &lt;fail message="some failure" status="3"/&gt; &lt;/sequential&gt; &lt;/macrodef&gt; &lt;ff/&gt; &lt;/project&gt; Invocation: $ ant Buildfile: /[...]/build.xml BUILD FAILED [...]build.xml:10: The following error occurred while executing this line: [...]build.xml:5: some failure Total time: 0 seconds The build failed as expected; yet the exit status is not correct: $ echo $? 1 I.e Ant exited with a status of 1 instead of 3. This only happens when the fail task is wrapped inside a macrodef.
score: 2
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27471339
type: Question

http://stackoverflow.com/a/27396349
answers question: http://stackoverflow.com/q/27395877
upvote count: 1
type: Answer
downvote count: 0
score: 1
has body: This should work txtMailbox.setText(txtName.getText())

http://stackoverflow.com/a/27420610
accepted answer of: http://stackoverflow.com/q/27406044
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The problem was that I've "btoken" maven's project stracture .... Once I've build the module as it should be by maven , works like a charm :) http://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
score: 1
answers question: http://stackoverflow.com/q/27406044
upvote count: 1

http://stackoverflow.com/a/27451411
has comment: http://stackoverflow.com/comment/43342476
has comment: http://stackoverflow.com/comment/43341934
type: Answer
accepted answer of: http://stackoverflow.com/q/27451266
upvote count: 1
has comment: http://stackoverflow.com/comment/43341345
answers question: http://stackoverflow.com/q/27451266
type: AcceptedAnswer
downvote count: 0
has body: ArrayList&lt;Member&gt; results = null; initializes an array of type Member try { results = MemberSQL.member(); MemberSQL.member is a function that returns an ArrayList of type Member } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } Object[] header = { "name","lastname", "ID", "Phone", "Race", "Member", "Divorced", "Married", "Single", "Location" }; creates an array of Objects with the string values shown in between the { } Object[][] data = new Object[results.size()][9]; creates a two dimensional array of Objects. int i = 0; for (Member member : results) { loop through each item in the results array. data[i] = member.toObjectArray(); member.toObjectArray() is a function that returns an object array. data[i] is set to this value. i++; }
score: 1

http://stackoverflow.com/a/27348908
type: Answer
accepted answer of: http://stackoverflow.com/q/27348785
score: 1
upvote count: 1
has body: In order to move towards a certain destination point by a certain amount, you have to compute the direction from the current point towards the target point, and multiply this direction with the speed that you want to use, before adding it to the original point: public Vector2 getNextPointTowardOther(Vector2 dest, int speed) { if (dest == null) return this; double deltaX = dest.getX() - this.x; double deltaY = dest.getY() - this.y; // Compute the distance double distance = Math.sqrt(deltaX*deltaX+deltaY*deltaY); // Compute the (normalized) direction double dirX = deltaX / distance; double dirY = deltaY / distance; // (The vector (dirX, dirY) now has length 1.0) double x = this.x + speed * dirX; double y = this.y + speed * dirY; return new Vector2(x, y); }
answers question: http://stackoverflow.com/q/27348785
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27453846
has body: I found my problem in the model class (Foo.java): public int getFooId() { return fooId; } fooId is an Integer and not an int. By changing the getter return type to an Integer, I was able to insert a null primary key and get the trigger-created sequence id back
answers question: http://stackoverflow.com/q/27435039
type: Answer
has comment: http://stackoverflow.com/comment/57522182
accepted answer of: http://stackoverflow.com/q/27435039
upvote count: 2
downvote count: 1
score: 1
type: AcceptedAnswer

http://stackoverflow.com/comment/43193999
type: QuestionComment
type: Comment
has text: If you're description is accurate, then the error is probably in `ForgotPasswordActivity`. Please post that class and your logcat.
score: 1
comment on: http://stackoverflow.com/q/27371266

http://stackoverflow.com/q/27337655
tagged with: date-sorting
type: AnsweredQuestion
score: 2
downvote count: 0
tagged with: sorting
has body: I have input of multiple strings where I parse each one to fetch certain data and then display them accordingly. The point is I need to sort them accodring to some parameters before displaying them. To clarify: String s1 = "a1 5 2014-12-05"; String s2 = "a2 10 2014-12-06"; String s3 = "a3 5 2014-12-04": After pasring each string, I need to sort them descendingly first according to the second parameter and then according to the date whenever I reach a tie for example. Output should be: a2, a1, a3 Any idea how can this be achieved or if I could change the way to a more efficient one?!
favorite count: 0
has comment: http://stackoverflow.com/comment/43132238
type: Question
has answer: http://stackoverflow.com/a/27337777
has title: sort descendingly based on multiple parameters in Java
upvote count: 2
has comment: http://stackoverflow.com/comment/43131969
answer count: 1
accepted answer: http://stackoverflow.com/a/27337777
has comment: http://stackoverflow.com/comment/43131968
tagged with: java
has comment: http://stackoverflow.com/comment/43131943

http://stackoverflow.com/q/27328994
type: Question
tagged with: r.java-file
score: 0
linked to: http://stackoverflow.com/q/1318712
answer count: 1
has body: When I create a new class using the above menu ,a new java file is created for each class and as you can see this leads to a lot of .java files very quickly(Why does ellipse show a .class structure inside a .java file, ) , is this a good design practice considering the fact that sometimes I only want classes to be very small such as class Name { String firstName; String lastName; } I'm new to Eclipse and Java IDE's , can you also tell me a shortcut to create a new class .
tagged with: class
has comment: http://stackoverflow.com/comment/43116574
accepted answer: http://stackoverflow.com/a/27329542
has title: Is it a good practise to create a seperate java file for each class in Eclipse?
has comment: http://stackoverflow.com/comment/43116540
tagged with: design-patterns
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27329542
tagged with: java
has comment: http://stackoverflow.com/comment/43117390
tagged with: eclipse

http://stackoverflow.com/q/27462758
has answer: http://stackoverflow.com/a/27462843
accepted answer: http://stackoverflow.com/a/27462843
has body: So I have an image file that has a volcano on it. Everything else is 0xFFFF00FF (opaque magenta). I want to replace every pixel that contains that color with 0 (transparent). So far my method looks like this: public static BufferedImage replace(BufferedImage image, int target, int preferred) { int width = image.getWidth(); int height = image.getHeight(); BufferedImage newImage = new BufferedImage(width, height, image.getType()); int color; for (int i = 0; i &lt; width; i++) { for (int j = 0; j &lt; height; j++) { color = image.getRGB(i, j); if (color == target) { newImage.setRGB(i, j, preferred); } else { newImage.setRGB(i, j, color); } } } return newImage; } This works fine but seems VERY slow. I have seen someone do this another way, but I have no idea what was going on. If someone knows a better way to do this, I would very much like to hear it.
tagged with: colors
upvote count: 4
tagged with: bufferedimage
possible better answer: http://stackoverflow.com/a/27464772
type: AnsweredQuestion
tagged with: java
has title: How to replace color with another color in BufferedImage
tagged with: image
tagged with: replace
type: Question
answer count: 3
downvote count: 0
has answer: http://stackoverflow.com/a/27462890
score: 4
has answer: http://stackoverflow.com/a/27464772
favorite count: 0

http://stackoverflow.com/a/27426370
type: AcceptedAnswer
has body: I believe you are looking for something like, Random rand = new Random(); BigInteger val = BigInteger.ONE; for (int i = 0; i &lt; 100; i++) { int v = rand.nextInt(301) + 200; // 0-300 + 200, is the range 200-500. val = val.multiply(BigInteger.valueOf(v)); System.out.printf("Random number %d: %d%n", i + 1, v); } System.out.println(val);
type: Answer
accepted answer of: http://stackoverflow.com/q/27426253
upvote count: 4
answers question: http://stackoverflow.com/q/27426253
has comment: http://stackoverflow.com/comment/43294629
has comment: http://stackoverflow.com/comment/43294651
has comment: http://stackoverflow.com/comment/43294742
downvote count: 0
score: 4
has comment: http://stackoverflow.com/comment/43294701

http://stackoverflow.com/q/27341572
has body: I am attempting to run a RESTful service from apache 7.0.57 on OS X 10.10 with Jersey 2.13, JDK 8. I have deployed Apache and it starts ok. I have written a simple RESTful service and deployed it to the WEB-INF/classes. The web.xml is configured. However, when I attempt to start the tomcat the restful resource errors with the following error SEVERE: Servlet /resttest threw load() exception java.lang.ClassNotFoundException: org.glassfish.jersey.servlet.ServletContainer at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571) at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:506) at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:488) at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:115) at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1148) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1087) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5231) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5518) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:649) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1245) at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1895) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecut…
answer count: 1
downvote count: 0
favorite count: 0
type: UnansweredQuestion
tagged with: tomcat7
score: 3
has answer: http://stackoverflow.com/a/30796906
tagged with: java
has title: Tomcat 7 ClassNotFoundException:org.glassfish.jersey.servlet.ServletContainer
type: Question
tagged with: jersey
tagged with: glassfish
upvote count: 3
tagged with: rest

http://stackoverflow.com/q/27371051
has answer: http://stackoverflow.com/a/27371095
favorite count: 0
tagged with: return
downvote count: 2
type: AnsweredQuestion
tagged with: java
has title: Returning a value from a Method
tagged with: methods
type: Question
has body: I am Trying to make a code to return a value back into Main class, however when i do the answer comes back as 0.0 Why is that and how would I fix it? BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[]temp = new String[7]; int[] arr = new int[7]; for (int i = 0; i &lt; 7; i++) { System.out.println("Please enter the temperature for the " + (i + 1)+" day of the week"); //Not the most gramatically correct. But i did what i could while using the loop. temp[i] = br.readLine(); } System.out.println("The temperature for Monday is: " + temp[0]); System.out.println("The temperature for Tuesday is: " + temp[1]); System.out.println("The temperature for Wednesday is: " + temp[2]); System.out.println("The temperature for Thursday is: " + temp[3]); System.out.println("The temperature for Friday is: " + temp[4]); System.out.println("The temperature for Saturday is: " + temp[5]); System.out.println("The temperature for Sunday is: " + temp[6]); double avg = averageValue(arr); System.out.println("Avg Temp for the week is: \t\t " + avg); public static double averageValue(int[] arr) { double average = 0; for (int i = 0; i&lt; arr.length; i++) { average += arr[i] } return average / arr.length; }
answer count: 2
upvote count: 0
score: -2
has answer: http://stackoverflow.com/a/27371096
has comment: http://stackoverflow.com/comment/43193591
accepted answer: http://stackoverflow.com/a/27371096
has comment: http://stackoverflow.com/comment/43193597
possible better answer: http://stackoverflow.com/a/27371095

http://stackoverflow.com/comment/43097366
comment on: http://stackoverflow.com/q/27318943
has text: `new Thread(this);` but wait for the answers; there still might be something to say.
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27466774
has comment: http://stackoverflow.com/comment/43370031
accepted answer: http://stackoverflow.com/a/27467121
favorite count: 0
tagged with: exception
has body: There are so many exceptions, and it is not easy to remember. Is there any rule to know which kinds of exception will fall in which type (runtime vs checked), so that we know in which case we need to catch and in which case we just throw an exception? Thanks!
upvote count: 1
has comment: http://stackoverflow.com/comment/43377827
possible better answer: http://stackoverflow.com/a/27466790
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27466790
has comment: http://stackoverflow.com/comment/43369421
tagged with: java
has title: Runtime exception and Checked exception
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27467121
score: 0
has answer: http://stackoverflow.com/a/27466860
answer count: 3

http://stackoverflow.com/comment/43266736
type: AnswerComment
comment on: http://stackoverflow.com/a/27410528
type: Comment
has text: Does reading the file in fact produce any `SensorInfo` objects? Does `SensorInfo.asData()` produce a non-empty `String`? Is the `String` returned by `createStringFromInfo()` the one you are passing to `writeFile()`? Your program is probably falling down in one of these places.
score: 0

http://stackoverflow.com/comment/43363501
type: QuestionComment
has text: what exactly are you asking ? the title isn't enough you have to also add the main question in your post please .
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27463630

http://stackoverflow.com/comment/43109053
type: Comment
score: 0
has text: Yes I can access this via TCP. The hanging is due to using Self Signed Certificates, which are being treated as invalid. Is there any way to turn down the validation (or off) so that I can ignore self signed cert errors?
comment on: http://stackoverflow.com/q/27322557
type: QuestionComment

http://stackoverflow.com/comment/43178378
comment on: http://stackoverflow.com/a/27362707
score: 0
type: Comment
type: AnswerComment
has text: Thank you VERY much! I do have one small problem though. I'm getting an error stating: FATAL EXCEPTION: main android.database.sqlite.SQLiteException: near "s": syntax error (code 1): , while compiling: SELECT _id FROM view_events WHERE (lastSynced = 0 AND (dtstart = '1417815000000' AND dtend = '1417818600000' AND title = 'User's')) ...which I believe is due to an apostrophe in the title field - is there anything I might be able to do to resolve this - or should I post a separate question?

http://stackoverflow.com/comment/43161848
comment on: http://stackoverflow.com/q/27354019
has text: I am using JAX-RS in a weblogic server. Default provider is Jersey in weblogic.
type: Comment
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43259667
has text: Are you able to compile or is the error in syntax? Does your AsyncTask implement the LocationListener interface?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27407432

http://stackoverflow.com/a/27420609
has comment: http://stackoverflow.com/comment/43291852
upvote count: 3
has body: Try commenting conf.setCombinerClass(WordCountReducer.class); and run. It is because the Data buffer may get full. Spill error Also include job.setMapOutputKeyClass(Text.class); job.setMapOutputValueClass(IntWritable.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(Text.class); as Map and Reducer emits different Key-value datatypes. If both are emitting same datatypes then job.setOutputKeyClass(); job.setOutputValueClass(); is enough.
score: 3
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27411950
answers question: http://stackoverflow.com/q/27411950
type: Answer

http://stackoverflow.com/q/27441651
has comment: http://stackoverflow.com/comment/43328917
tagged with: substring
type: Question
tagged with: split
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43322814
has comment: http://stackoverflow.com/comment/43322783
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: I am trying to recreate a folder structure in Windows system using JAVA program.I am getting the intended filepath from another system as String argument in my java program and am supposed to spilit the filepath String to identify folder names at each level. The '\'(part of filepath string in windows systems) when used along with other legit characters in a string behaves differently. It is combining with the following characters in the string and produces different results(generates different characters because ascii value of \00 is different from that of \ separately and 0 separately). String WindowsFilePath="drivename\folderName1\00000innerFolderName\03thefileName.fileExtension"; Is possible to spilit this String using JAVA code to "drivename","folderName1","00000innerFolderName","03thefileName.fileExtension" Additional Information on root cause of this issue: I have a old directory structure where someone created folders with names like '001thImageFolder' 'firstImageFolder' etc in filesystem. Now if I get the filepath of a file that is inside a directory named in the above fashion the '\' that comes in filepath got appended with the first or first and second characters of the folder name and gets automatically converted to a escape sequence. I want to eliminate this escape sequence conversion.
has title: Unable to spilit a String with '\' character using JAVA
score: 2
has answer: http://stackoverflow.com/a/27441675
tagged with: java
has comment: http://stackoverflow.com/comment/43329119
tagged with: directory-structure

http://stackoverflow.com/comment/136518668
has text: This helped me with gradle 8.1.2, thanks, so perhaps it still has some affect, or it was just pot luck.
score: 2
comment on: http://stackoverflow.com/a/46804190
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43305599
type: Comment
type: QuestionComment
has text: well then, if the user inputs "ABC" and "aBc", how do you know which one they want retained?
score: 0
comment on: http://stackoverflow.com/q/27431162

http://stackoverflow.com/comment/47327694
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27333423
has text: @ultracoms, I appear to be cursed with IDEs. I am now evaluating Netbeans and am having the exact same problem. If you have any ideas about how to help, I've described it here in very *very* similar wording. http://stackoverflow.com/questions/29574103/in-netbeans-8-0-2-how-to-have-a-project-replace-a-class-in-a-different-dependen
type: Comment

http://stackoverflow.com/q/27319240
tagged with: hash
has body: According to what I have read, to use an object as the key to a hashMap, it has to provide a correct override and implementation of the equals and hashCode method. HashMap get(Key k) method calls hashCode method on the key object and applies returned hashValue to its own static hash function to find a bucket location(backing array) where keys and values are stored in form of a nested class called Entry (Map.Entry). HashMap's internal hash Method defends against poor quality hash functions. To test these contracts, I have written a bean class with incorrect but legal implementations of the equals and hashCode method. The class: public class HashVO { private String studentName; private int age; private boolean isAdult; public HashVO(String studentName, int age, boolean isAdult) { super(); this.studentName = studentName; this.age = age; this.isAdult = isAdult; } public String getStudentName() { return studentName; } public void setStudentName(String studentName) { this.studentName = studentName; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public boolean isAdult() { return isAdult; } public void setAdult(boolean isAdult) { this.isAdult = isAdult; } @Override public String toString() { return studentName + " : " + age + " : " + isAdult; } @Override public boolean equals(Object obj) { return false; } @Override public int hashCode() { return 31; } } In this case, the hash method of the HashMap, static final int hash(Object key) { int h; return (key == null) ? 0 : (h = key.hashCode()) ^ (h &gt;&gt;&gt; 16); } should also return same value everytime because the hashcode always returns 31. So if objects of class HashVO are used as key of a hashMap, the get method should not work, as it should go to the same bucket to retrieve the objects and the equals method always returns false so it will not be able to able to find a match for the key object. But when I am using this method, public static void main(String[] args) { HashMap&lt;HashV…
upvote count: 4
has answer: http://stackoverflow.com/a/27319706
type: AnsweredQuestion
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/27319281
accepted answer: http://stackoverflow.com/a/27319281
type: Question
answer count: 2
tagged with: hashmap
score: 4
possible better answer: http://stackoverflow.com/a/27319706
has title: HashMap with incorrect equals and HashCode implementation
favorite count: 0

http://stackoverflow.com/q/27328745
upvote count: 1
has title: convert pdf to html pagewise using pdfbox
has comment: http://stackoverflow.com/comment/43166394
has comment: http://stackoverflow.com/comment/43168522
has comment: http://stackoverflow.com/comment/43166133
favorite count: 0
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/43164232
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43163966
has comment: http://stackoverflow.com/comment/43163457
has comment: http://stackoverflow.com/comment/43163771
has body: I am converting pdf to html by overriding processTextPosition method in PDFTextStripper know I am getting entire text in to a single .html but I want every pdfpage as .html is there any way to do it through processTextPosition method my code is: here "f" is path processTextPosition is called from its sub class PDFText2Html protected void processTextPosition( TextPosition text ) { boolean showCharacter = true; PositionWrapper p =new PositionWrapper(text); TextPosition t=p.getTextPosition(); try { f.createNewFile(); bw= new BufferedWriter(new FileWriter(f, true) ); float a; a = t.getTextPos().getYPosition(); b=compare(a,b,t); System.out.println(b); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { try { bw.flush(); bw.close(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } if(suppressDuplicateOverlappingText) { showCharacter = false; String textCharacter = text.getCharacter(); float textX = text.getX(); float textY = text.getY(); TreeMap&lt;Float, TreeSet&lt;Float&gt;&gt; sameTextCharacters = characterListMapping.get( textCharacter ); if(sameTextCharacters == null ) { sameTextCharacters = new TreeMap&lt;Float, TreeSet&lt;Float&gt;&gt;(); characterListMapping.put( textCharacter, sameTextCharacters ); } boolean suppressCharacter = false; float tolerance = (text.getWidth()/textCharacter.length())/3.0f; SortedMap&lt;Float, TreeSet&lt;Float&gt;&gt; xMatches = sameTextCharacters.subMap(textX - tolerance, textX + tolerance); for(TreeSet&lt;Float&gt; xMatch : xMatches.values()) { SortedSet&lt;Float&gt; yMatches = xMatch.subSet(textY - tolerance , textY + tolerance); if (!yMatches.isEmpty()) { suppressCharacter = true; break; } } if( !suppressCharacter ) { TreeSet&lt;Float&gt; ySet = sameTextCharacters.get(textX); if (ySet == null) { ySet = new TreeSet&lt;Float&gt;(); sameTextCharacters.put( textX, ySet ); } ySet.add( textY ); showCharacter = true; } } if( showCharacter ) { int foundArticleDivis…
has comment: http://stackoverflow.com/comment/43164625
has comment: http://stackoverflow.com/comment/43120972
has comment: http://stackoverflow.com/comment/43168754
score: 1
has comment: http://stackoverflow.com/comment/43167814
tagged with: java
has comment: http://stackoverflow.com/comment/43168017
tagged with: pdfbox
has comment: http://stackoverflow.com/comment/43156678
has comment: http://stackoverflow.com/comment/43164720
type: Question
has comment: http://stackoverflow.com/comment/43160099
has comment: http://stackoverflow.com/comment/43161969
has comment: http://stackoverflow.com/comment/43167281
has comment: http://stackoverflow.com/comment/43167943
has comment: http://stackoverflow.com/comment/43169685
has comment: http://stackoverflow.com/comment/43168591

http://stackoverflow.com/q/27356540
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/43165739
tagged with: video
tagged with: java
has title: Portrait video in Android VideoView will not take up whole width of the screen
tagged with: android-videoview
has answer: http://stackoverflow.com/a/27358762
type: Question
has comment: http://stackoverflow.com/comment/43165955
has body: I have a VideoView in my layout and in this VideoView I'm attempting to play a vertically-oriented video. I was under the impression that this being a portrait video intended to be displayed in a portrait orientation, things couldn't be easier. Boy, was I wrong. This is my Java code: videoView1 = (VideoView) findViewById(R.id.videoView1); videoView1.setVideoPath("android.resource://" + getPackageName() + "/" + R.raw.video); videoView1.setOnCompletionListener(new OnCompletionListener() { @Override public void onCompletion(MediaPlayer mp) { videoView1.start(); } }); videoView1.start(); And this is my .xml for the videoview element (which is inside a RelativeLayout, btw): &lt;VideoView android:id="@+id/videoView1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentBottom="true" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_alignParentRight="true" android:layout_centerInParent="true" android:layout_marginLeft="0dp" android:layout_marginRight="0dp" /&gt; The most surprising thing I have encountered on what I honestly expected to be a walk in the park is the fact that whatever I do, the video will indeed stretch to fill the height of the screen (so layout_alignParentTop and layout_alignParentBottom are obviously working) but the damn thing just won't fill the width of the screen! (yep, I'm frustrated) so there's this already vertical video stretched to a ribbon-like construct down the middle of the screen. I added the marginLeft and marginRight attributes in a desperate attempt to see if it would work but nothing! Flabbergasted, I removed the centerInParent attribute but again, nothing. I even created a custom VideoView, overrode onMeasure and still nothing. I tried to programatically set the LayoutParams of the VideoView. Guess what, didn't work.
has answer: http://stackoverflow.com/a/43374530
answer count: 2
downvote count: 0
score: 1
tagged with: android
has comment: http://stackoverflow.com/comment/43165718
favorite count: 0

http://stackoverflow.com/a/27336588
type: Answer
score: 2
answers question: http://stackoverflow.com/q/27336547
downvote count: 0
has body: Try: URL url = new URL("http://www.url.com/image.jpg"); Image image = ImageIO.read(url); jlabel.setIcon(new ImageIcon(image)); jlabel.setText("the text");
upvote count: 2
has comment: http://stackoverflow.com/comment/43130749

http://stackoverflow.com/comment/43604547
has text: Thank you, that's what I did at last.
type: AnswerComment
comment on: http://stackoverflow.com/a/27387278
type: Comment
score: 0

http://stackoverflow.com/a/27448795
has comment: http://stackoverflow.com/comment/43336371
has comment: http://stackoverflow.com/comment/43336365
score: 6
accepted answer of: http://stackoverflow.com/q/27448779
answers question: http://stackoverflow.com/q/27448779
type: AcceptedAnswer
downvote count: 0
has body: Void is a reference type. void is a language primitive. You don't need a return statement when your return type is void.
type: Answer
upvote count: 6

http://stackoverflow.com/a/27453172
downvote count: 0
has body: Just wrap the input stream in a ProgressMonitorInputStream. It will manage its own JProgressBar for you.
type: Answer
answers question: http://stackoverflow.com/q/27449596
upvote count: 2
has comment: http://stackoverflow.com/comment/43349692
score: 2

http://stackoverflow.com/comment/43336556
has text: gave you a plus one for at least leading me to a new error, which technically answered my question but did not solve the entire problem yet, if this thread drifts more towards HSQL then I'll mark as answered and post a new question.
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27431381
score: 0

http://stackoverflow.com/comment/43388777
comment on: http://stackoverflow.com/a/27473251
score: 0
type: Comment
type: AnswerComment
has text: Is there any extra class that I have to add to WebSphere or to change any security parameters? I am using version 7.X

http://stackoverflow.com/a/27342315
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27340938
type: Answer
has body: You have typo for &lt;c:forEach&gt; tag , its foreach in your code . Also you can simply use variables declared in the model class as ${statuslist.screen} and ${statuslist.show}. see How to avoid Java code in JSP files?
accepted answer of: http://stackoverflow.com/q/27340938

http://stackoverflow.com/q/27427892
has comment: http://stackoverflow.com/comment/43297286
type: AnsweredQuestion
tagged with: algorithm
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27428461
has comment: http://stackoverflow.com/comment/43298270
has title: MD5Algorithm-Add 2 md5 values
has comment: http://stackoverflow.com/comment/43298254
score: 0
has body: Is there a algorithm to add 2 md5 values We process data in parts. Currently I have the algorithm from Jon Howell . Here is what I do now Calculate the message digest of the 1st part which is private int buf[]; // These were originally unsigned ints. // This Java code makes an effort to avoid sign traps. // buf[] is where the hash accumulates. long bits; // This is the count of bits hashed so far. byte in[]; // This is a buffer where we stash bytes until we have // enough (64) to perform a transform operation. I can store the combination of these 3 values in my DB and then recreate this object again and process the 2nd part This creates a sequential order of processing content which we dont want. I want to process all the parts in parallel, which means I need to be able to calculate the md5 value adding 2 of the message digest algorithms. Do anyone have tried such an algorithm
has answer: http://stackoverflow.com/a/27428461
answer count: 1
tagged with: hash

http://stackoverflow.com/q/27323505
type: AnsweredQuestion
score: 3
tagged with: java
has body: So, let's say I got my regular expression String regex = "\d*"; for finding any digits. Now I also got a inputted string, for example String input = "We got 34 apples and too much to do"; Now I want to replace all digits with "", doing it like that: input = input.replaceAll(regex, ""); When now printing input I got "We got apples and too much to do". It works, it replaced the 3 and the 4 with "". Now my question: Is there any way - maybe an existing lib? - to get what actually was replaced? The example here is very simple, just to understand how it works. Want to use it for complexer inputs and regex. Thanks for your help.
tagged with: replace
accepted answer: http://stackoverflow.com/a/27323697
linked to: http://stackoverflow.com/q/375420
answer count: 1
downvote count: 0
tagged with: replaceall
has title: Get what was removed by String.replaceAll()
tagged with: string
tagged with: regex
has comment: http://stackoverflow.com/comment/43106410
favorite count: 0
has answer: http://stackoverflow.com/a/27323697
upvote count: 3
type: Question

http://stackoverflow.com/a/27559716
answers question: http://stackoverflow.com/q/27457663
type: AcceptedAnswer
downvote count: 0
score: 1
type: Answer
has body: The js code required for the purpose is not complex. trying Adding these in scripts, $(document).ready(function () { $("td", this).on("click", function () { var tds = $(this).parents("tr").find("td"); $.each(tds, function (i, v) { $($(".data-form input")[i]).val($(v).text()); }); }); }); Moreover your form happens to be in table tag.Bring it out of the table tag.Only thing that remains in your table tag is your table.
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27457663

http://stackoverflow.com/q/27408806
has title: HashMap MySQL - Best Practice
has comment: http://stackoverflow.com/comment/43262270
type: AnsweredQuestion
tagged with: cidr
has answer: http://stackoverflow.com/a/45627642
accepted answer: http://stackoverflow.com/a/45627642
type: Question
tagged with: hashmap
has comment: http://stackoverflow.com/comment/57427857
tagged with: java
tagged with: mysql
has comment: http://stackoverflow.com/comment/43276455
tagged with: ip
answer count: 1
has body: I have faced a scenario, the task was to read a file which contains 3 Millions IP Address. There is MySQL Table which contains Id,PrimaryIP, PrimaryIP can by multiple IP separated by #, more over that PrimaryIP can also contain CIDR IP. So totally, there are 8000 records, each record with multiple IP and CIDR IP. Now, my task was to read that file, check it against with database and write the matching IP,ID to a file. Initially, when i run my program, my program failed because: java.lang.OutOfMemoryError: Java heap space, so i have increased it by 3GB, still it was failing, then later i split the file into 6 subfiles, as 0.5 Millions each. To find CIDR IP List, i have used Apache SubnetUtils. Below is my code : public static void main(String[] args) { String sqlQuery = "SELECT id,PrimaryIP from IPTable where PrimaryIP != '' limit 100000;"; Connection connection = null; Statement statement = null; File oFile = new File("output.txt"); System.out.println(new Date()); try{ List&lt;String&gt; fileData = FileUtils.readLines(new File("input.txt")); System.out.println("File Data Size : "+fileData.size()); Class.forName("com.mysql.jdbc.Driver"); connection = DriverManager.getConnection("jdbc:mysql://localhost/db?user=root&amp;password=pwd"); statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery(sqlQuery); System.out.println("Started with MySQL Querying"); Map&lt;String, Integer&gt; primaryIPIDMap = new HashMap&lt;String, Integer&gt;(); while (resultSet.next()) { primaryIPIDMap.clear(); int recordID = resultSet.getInt(1); if (resultSet.getString(2).contains("#")) { String primaryIP[] = resultSet.getString(2).split("#"); for (int i = 0; i &lt; primaryIP.length; i++) { if (primaryIP[i].contains("/")) { String allIP[] = getAllIP(primaryIP[i]); for (int allIPi = 0; allIPi &lt; allIP.length; allIPi++) { primaryIPIDMap.put(allIP[allIPi].intern(), recordID); } } else { primaryIPIDMap.put(primaryIP[i].intern(), recordID); } } } else { primaryIPIDMap.p…
score: 0

http://stackoverflow.com/q/27456884
downvote count: 1
has body: So, I am making a basic tip calculator and I need to know how to change the users input of 15%, 23%, etc. into 0.15, 0.23, etc. This is my current code: import java.util.Scanner; public class TipCalc { public static void main(String args[]) { Scanner meal = new Scanner(System.in); double food, tax, tip, fin; System.out.println("How much was the meal?"); food = meal.nextDouble(); System.out.println("How much was the tax?"); tax = meal.nextDouble(); System.out.println("How much would you like to tip? I recomend 15%"); tip = meal.nextDouble(); } } Please help! Thanks!
tagged with: calculator
favorite count: 0
upvote count: 0
has comment: http://stackoverflow.com/comment/43351028
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27456913
tagged with: java
has title: How to change 15% into 0.15 in Java?
type: Question
has answer: http://stackoverflow.com/a/27457088
answer count: 2
score: -1
has comment: http://stackoverflow.com/comment/43351018

http://stackoverflow.com/comment/55897461
type: Comment
comment on: http://stackoverflow.com/a/27431996
score: 0
has text: Sorry for the late reply. Here is a [link](http://pastebin.com/GxMBhx7j) to a fxml, created with Scene Builder. Hope it will be helpful.
type: AnswerComment

http://stackoverflow.com/comment/43112228
has text: @CBredlow Yes that's the only part of the key
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27326576

http://stackoverflow.com/q/27438236
tagged with: chef-infra
tagged with: ruby
has body: The source for question can be easy found this question. So I run knife cookbook site install maven and then knife cookbook upload myCookbook --include-dependencie But after run knife bootstrap 192.168.1.37 --ssh-user root --ssh-password '123456' --sudo --use-sudo-password --node-name node-with-maven-run --run-list 'recipe[myCookbook]' I got No such file or directory - mvn org.apache.maven.plugins:maven-dependency-plugin:2.4:get -DgroupId=org.springframework -DartifactId=spring-context -Dversion=4.0.4.RELEASE -Dpackaging=jar -Ddest=/tmp/chef_maven_lwrp20141212-27453-ocmoxb/spring-context-4.0.4.RELEASE.jar -DremoteRepositories=http://repo.maven.apache.org/maven2/ -Dtransitive=false It turns out that maven simply not installed on 192.168.1.37. How can I install maven before run maven cookbook? P.S. It is very strange that cookbook does not test itself whether maven is installed or not.
tagged with: maven
answer count: 1
score: 0
tagged with: java
has title: How configure cookbook maven in chef node?
tagged with: cookbook
linked to: http://stackoverflow.com/q/27420956
has answer: http://stackoverflow.com/a/27439652
type: Question
accepted answer: http://stackoverflow.com/a/27439652
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43317642

http://stackoverflow.com/q/27338589
upvote count: 3
type: Question
score: 3
has body: What I'm trying to do: I'm creating a class hierarchy that represents and has utilities for a lot of linear algebra concepts (both to practice linear algebra and to practice Java, which I'm learning right now). All went pretty well until I decided to add the different types of numbers, that is, integers, rationals, reals and complex (for now). What I want is to be able to operate with them (for example, inside a Matrix class) without having to care about which number type I'm operating with, and implement all the operations inside different classes representing each number type. What I thought/tried: I thought it was a good idea to make an interface called "AnyNumber" (since Number is already taken by the Java API) on which I'd define all the necessary abstract methods, and then implement that interface on each number type class. The problem is, I can't figure out how to handle class types. Here is what the interface declaration would look like: public interface AnyNumber { public AnyNumber add(AnyNumber other); public AnyNumber subtract(AnyNumber other); public AnyNumber multiply(AnyNumber other); public AnyNumber divide(AnyNumber other); } This way, I'd be able to operate with any objects that implement the interface by simple calling methods like: number1 = number1.add(number2) The problems I had The problem comes when trying to implement the interface methods on a particular class. I thought Java understood that the type "AnyNumber" could be any type that implements the interface, so I tried declaring the methods like this: public IntegerNumber add(IntegerNumber other) { return new IntegerNumber(this.value + other.value); } But Eclipse complained that I did not not implement the following method: AnyNumber add(AnyNumber other) Then I though that I could just change the return and argument types to "AnyNumber", but soon realized I couldn't access the variable "value" inside "other" because the interface doesn't define it. So I thought maybe what I needed was an a…
tagged with: java
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27338656
accepted answer: http://stackoverflow.com/a/27338656
favorite count: 0
tagged with: interface
has title: Modelling number types and arithmetic operations between them in Java
type: AnsweredQuestion
tagged with: numbers

http://stackoverflow.com/comment/43270471
has text: Ok, will post as little workaround for passing an array as URL parameter. See EDIT2 in a few minutes
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27412606
type: Comment

http://stackoverflow.com/comment/43320783
has text: @steenbergh yeah that case is excluded for the time being.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27440496

http://stackoverflow.com/q/27423892
favorite count: 0
has comment: http://stackoverflow.com/comment/43417937
has comment: http://stackoverflow.com/comment/43418871
score: 2
has comment: http://stackoverflow.com/comment/43418681
answer count: 0
type: UnansweredQuestion
has body: I am working with Apache Shiro security framework and I have to apply different access policies to Roles (like effectiveFrom date which means this role is active only after a specific date). And given the API, the best way i could achieve this was to overinding the protected USER_ROLES_QUERY query string to return me only the roles that have comply with this "effectiveFrom" date. And I added this "effectiveFrom" field to ROLES_PERMISSIONS table. Is there any other more effective way to achieve this?
has comment: http://stackoverflow.com/comment/43418799
tagged with: java
type: Question
upvote count: 2
tagged with: shiro
has title: Which is the better way to create access policies for a Role in Apache Shiro
has comment: http://stackoverflow.com/comment/43418598
downvote count: 0

http://stackoverflow.com/comment/43202161
type: AnswerComment
has text: it is not completely enter the email, before complete the email it goes to the password field. so when I get text on email field, it always false
type: Comment
comment on: http://stackoverflow.com/a/27376067
score: 0

http://stackoverflow.com/a/27482649
has body: Finally I came up with a solution, Rather than creating ServiceObject and saving to DB in the test method, I have done it before the test method and deletion of the created objects done after the transaction. So that my test class looks like, @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations = "classpath:service-test.xml") public class ServiceHandlerTest { @Before public void setup() { //Create ServiceObject and save to DB } @Test public void testServiceMethod() { //Call serviceMethod() //Read DB for updatedServiceObject assertEquals("Test: Object should be in updated state", new Short(3), updatedServiceObject.getObjectstatus(), 0); } @After public void teardown() { //Delete created ServiceObject from DB } } And I found that test method or test class does not necessary to be transactional in such a case.
score: 4
accepted answer of: http://stackoverflow.com/q/27394473
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/27394473
downvote count: 1
upvote count: 5

http://stackoverflow.com/comment/43271716
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27413746
has text: yes so you can have more informative answer I have already +1 u

http://stackoverflow.com/comment/43308328
comment on: http://stackoverflow.com/a/27433586
type: Comment
has text: @SotiriosDelimanolis Answer abstracted to better accommodate indecisiveness. :)
score: 0
type: AnswerComment

http://stackoverflow.com/q/27343500
score: -1
upvote count: 0
tagged with: sqlite
answer count: 1
tagged with: insert
has body: I am creating an android application that has two databases. One is offline SQLite database directly on the device and another one on public server that is used for update the offline one. This is the way I'm inserting data into my SQLite database: My activity: package com.empekapp; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.content.DialogInterface.OnClickListener; import android.content.Intent; import android.database.Cursor; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; import android.widget.SimpleCursorAdapter; public class Linie extends Activity { DBAdapter db @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.linie); openDB(); } private void openDB(){ db = new DBAdapter(this); db.open(); db.insertLineRecord("1"); db.insertLineRecord("2"); } And in my database adapter: public static final String KEY_LINE_ROWID = "_id"; public static final String KEY_LINE_NAME = "line_name"; public static final int COL_LINE_ROWID = 0; public static final int COL_LINE_NAME = 1; public static final String[] ALL_LINE_KEYS = new String[] {KEY_LINE_ROWID, KEY_LINE_NAME}; private static final String TABLE_LINE = "lines"; private static final String TABLE_LINE_CREATE = "create table if not exists " + TABLE_LINE + "(" + KEY_LINE_ROWID + " integer primary key autoincrement, " + KEY_LINE_NAME + " VARCHAR not null unique);"; private final Context context; private DatabaseHelper DBHelper; private SQLiteDatabase db; public DBAdapter (Context ctx){ this.context = ctx; DBHelper = new DatabaseHelper(context); } private static class DatabaseHelper extends SQLiteOpenHelper{ DatabaseHelper(Context context){ super(context, DATABASE_NAME, null, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { db.execSQL(TABLE_L…
favorite count: 0
has title: Android SQLite data inserting
type: UnansweredQuestion
tagged with: android
tagged with: java
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27343547
tagged with: database

http://stackoverflow.com/a/27402830
score: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27384829
type: Answer
has comment: http://stackoverflow.com/comment/43272241
has body: Here's a regex that will match your sample data, splitting it into the four parts: ^((?:[A-Z]{3})?\d{9})\s+(.+?),\s+(\S+)\s+(.+)$ See it work on regex101. I would be surprised if each line is as similar as you say. I agree with the comment by @adamdc78 that there's no way to determine what's part of a multi-word first name versus middle name. My regex also makes these assumptions: the ID and name are the entire line there's always a comma separating the last name from the other names there's always a middle name
upvote count: 1

http://stackoverflow.com/a/27348668
accepted answer of: http://stackoverflow.com/q/27348625
answers question: http://stackoverflow.com/q/27348625
score: 20
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43152552
has body: This is typically what a mocking framework can do for you. With Mockito for instance: // imports ommited for brevity @Test public void callbackIsCalled() { final CallBack callBack = mock(CallBack.class); method(callBack); verify(callBack, only()).handle(any()); } Of course, this is an example of verification mode (only()) and value matcher (any()). You can do more... (other mocking frameworks exist, but I personally find Mockito the easiest to use, in addition to being one of the most powerful)
upvote count: 21
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/43152214

http://stackoverflow.com/q/27405985
type: UnansweredQuestion
tagged with: multithreading
tagged with: swing
tagged with: repaintmanager
has comment: http://stackoverflow.com/comment/43258104
has comment: http://stackoverflow.com/comment/43257930
has comment: http://stackoverflow.com/comment/43258959
has title: Java animation and the Repaint Manager
tagged with: java
has answer: http://stackoverflow.com/a/27421145
type: Question
answer count: 1
has body: Just hoping people can help me understand properly how the RepaintManager works when trying to create animations. Basically I am creating a program that draws and updates creatures/images to a JFrame. Each creature object contains all the information for paint to be able to draw it such as x,y coordinates and an BufferedImage. Currently every time a creature object moves it calls repaint(), which as you will see below in my paint/paintComponent (not sure which is is best) method will run a loop through all existing creatures and update their position &amp; graphics on the screen. So my query, is this the best way to do this as I am concerned that the RepaintManager is redrawing everything on the screen, which is not very efficient. I have a read a few posts/articles about clipping or overriding update methods but just cant quite get my head around them - so is it possible to every time repaint is called it only updates objects/creatures that have changed? Some code of what I am talking about: public void paintComponent (Graphics g) { super.paintComponent(g); //setDoubleBuffered(true); //Probably not needed? Graphics2D g2d = (Graphics2D) g; //Draws the land area for penguins. g2d.setColor(new Color(121,133,60)); g2d.fill3DRect(land.x, land.y, land.width, land.height, true); //OR g2d.fill(land); g2d.setColor(Color.BLUE); g2d.fill(sea); drawCreatures(g2d); } All graphics in the paint method won't change and shouldnt need to be repainted, however the method below will... private void drawCreatures(Graphics2D g2d) { try { for (Creature c : crlist) { g2d.drawImage(c.createImage(txs,tys), c.getPos(1).width, c.getPos(1).height, this); //g2d.drawImage(cImg,c.getPos(1).width,c.getPos(1).height,this); if (c instanceof Fish &amp;&amp; c.getMating().equals(Mating.WBABY)) { int xos=0; for (Creature fb : c.getChildren()) { if (fb.getMating().equals(Mating.BABY)) g2d.drawImage(fb.createImage(txs,tys),c.getPos(1).width+xos,c.getPos(1).height+50,txs/2,tys/2,this); xos+=25; } } if (c.…
score: 0
has comment: http://stackoverflow.com/comment/43256934
tagged with: paint
has comment: http://stackoverflow.com/comment/43257684
has comment: http://stackoverflow.com/comment/43256799

http://stackoverflow.com/q/27435808
downvote count: 0
has body: I am trying to make a quadratic equation solver on android. I have a basic setup working but unless I enter a perfect quadratic it will output NaN. TextView answerField1 = (TextView) findViewById(R.id.answer1); TextView answerField2 = (TextView) findViewById(R.id.answer2); EditText fieldA = (EditText) findViewById(R.id.aTextField); EditText fieldB = (EditText) findViewById(R.id.bTextField); EditText fieldC = (EditText) findViewById(R.id.cTextField); Double aString = Double.parseDouble(fieldA.getText().toString()); Double bString = Double.parseDouble(fieldB.getText().toString()); Double cString = Double.parseDouble(fieldC.getText().toString()); Double answer1 = ((-1 * bString) + Math.sqrt(((bString * bString) - (4 * aString * cString))))/(2 * aString); Double answer2 = ((-1 * bString) - Math.sqrt(((bString * bString) - (4 * aString * cString))))/(2 * aString); answerField1.setText("" + answer1); answerField2.setText("" + answer2); Is there a way to output a raw value w/ decimals?
has comment: http://stackoverflow.com/comment/43312596
has answer: http://stackoverflow.com/a/27435894
answer count: 1
linked to: http://stackoverflow.com/q/7461803
favorite count: 0
has comment: http://stackoverflow.com/comment/43312496
upvote count: 2
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43312478
has title: Android Studio Quadratic Equation NaN
score: 2
has comment: http://stackoverflow.com/comment/43312505
tagged with: java
has comment: http://stackoverflow.com/comment/43312582
type: Question

http://stackoverflow.com/comment/43257646
comment on: http://stackoverflow.com/a/27402841
score: 0
has text: Yes, for that you can use localAdress.
type: Comment
type: AnswerComment

http://stackoverflow.com/a/27331329
upvote count: 4
has body: temp is not a keyword, it is just a name for a local variable. You can call it temp, blub or better: entry or value (to have a meaningful name for this variable). for(int temp: a) means literally: take each element from array (or any other Iterable) a separately and write it in the variable temp of type int, so the loop body can use that variable / array element. The code in your example then use this variable to print it to the console.
type: AcceptedAnswer
score: 4
has comment: http://stackoverflow.com/comment/43120493
has comment: http://stackoverflow.com/comment/43120572
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27331274
accepted answer of: http://stackoverflow.com/q/27331274

http://stackoverflow.com/comment/43304027
type: Comment
comment on: http://stackoverflow.com/a/27431013
type: AnswerComment
has text: i don't understand how does it matters, i'm using java7 and tomcat7
score: 0

http://stackoverflow.com/comment/43166520
score: 0
type: Comment
has text: As in your question you are saying that your project gives you `404` error this means your project has not deployed properly on web server.
type: QuestionComment
comment on: http://stackoverflow.com/q/27356508

http://stackoverflow.com/q/27342571
type: Question
has comment: http://stackoverflow.com/comment/43140973
has comment: http://stackoverflow.com/comment/43140951
has answer: http://stackoverflow.com/a/27342743
accepted answer: http://stackoverflow.com/a/27342743
answer count: 1
has comment: http://stackoverflow.com/comment/43140942
score: 0
tagged with: android
has body: So i was searching threw all the getHeight/widht problems-posts, and tried the different methods to solve the problem(like the globalLayoutListener, or Runnable) , to wait, till the FrameLayout has been created... but still my getHeight returns 0. So this is my code right now: private void zurechtruecken() { int n=1; spB =(FrameLayout) findViewById(R.id.spielbereich); spB.post(new Runnable(){ @Override public void run(){ spielBh=spB.getMeasuredHeight(); spielBb=spB.getMeasuredWidth(); } }); This was my code with the GlobalLayoutListener: private void zurechtruecken() { int i=24; int n=1; mView = findViewById(R.id.spielbereich); mView.getViewTreeObserver().addOnGlobalLayoutListener( new OnGlobalLayoutListener(){ @Override public void onGlobalLayout() { mView.getViewTreeObserver().removeGlobalOnLayoutListener(this); spielBh=mView.getHeight(); spielBb=mView.getWidth(); Log.i("!",Integer.toString(spielBh)); Log.i("!",Integer.toString(spielBb)); } }); the "removeGlobalLayoutListener(this)" was crossed.(it was deprecated) It could be important, that im measuring a Frame Layout Thanks for any help!! Botti560
tagged with: runnable
tagged with: return
tagged with: measurement
has comment: http://stackoverflow.com/comment/43140890
has comment: http://stackoverflow.com/comment/43141097
type: AnsweredQuestion
tagged with: java
has title: getHeight and getMeasuredHeight return 0, even in Runnable

http://stackoverflow.com/comment/43214674
type: Comment
has text: Then you could return the list and do what ever you like with it
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27383027

http://stackoverflow.com/a/27345029
has comment: http://stackoverflow.com/comment/52959725
has comment: http://stackoverflow.com/comment/43146418
upvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/43147310
has comment: http://stackoverflow.com/comment/43145745
answers question: http://stackoverflow.com/q/27344868
has comment: http://stackoverflow.com/comment/43149582
downvote count: 0
has comment: http://stackoverflow.com/comment/43147150
has comment: http://stackoverflow.com/comment/43146816
has comment: http://stackoverflow.com/comment/43146072
has comment: http://stackoverflow.com/comment/43148767
has comment: http://stackoverflow.com/comment/43146000
has comment: http://stackoverflow.com/comment/43151409
has comment: http://stackoverflow.com/comment/43146989
has comment: http://stackoverflow.com/comment/43146673
has body: If this list is different for each user , then keep in session scope. Else if it is common across the application , you can have singleton scope. Best amoung all the solutioins availabe , you can use below steps :- 1.For acessing the list throughout the application , keep it in your singleton service class, as class variable and acess in controller by autowiring your service. For displaying it in header, you need to add it in model, either you have to add it in model again and again from each controller method. Or you can add it as session attribue in model by using annotatoin @sessionattribute. Yes, for perfect design, there should be some way , to add the attribute as application level. however, spring goes not have such support.
has comment: http://stackoverflow.com/comment/43147256
score: 1

http://stackoverflow.com/q/27328073
tagged with: java
has answer: http://stackoverflow.com/a/27329255
has comment: http://stackoverflow.com/comment/43115606
has comment: http://stackoverflow.com/comment/43115039
has comment: http://stackoverflow.com/comment/43115056
linked to: http://stackoverflow.com/q/3059489
tagged with: jtable
accepted answer: http://stackoverflow.com/a/27329255
score: 2
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43116084
has comment: http://stackoverflow.com/comment/43115874
favorite count: 0
tagged with: tablecelleditor
has title: JButton in single table cell java, not entire column
type: AnsweredQuestion
upvote count: 2
has body: I have been researching JTables fairly thoroughly, and have found some brilliant resources that explain how to set the CellRenderer and CellEditor for columns, but have found that trying to set the Renderer and Editor of a single cell is a little less forthcoming. The general idea of my table is to have two columns, where the left column displays variable names, and the right column allows for the modification of the associated variables. Most cells I have been able to perform validation on, and even found out how to use the DefaultCellRenderer and DefaultCellEditor the way that I required, but trying to do this with custom renderers and editors I am struggling with. Below I have tried to indicate how a table under my design would look: (Left hand value is the variable name, the right hand is the value) x 0 y 0 isDestructable [checkbox] image [clickable cell] The image value should allow the user to click the cell, which will then bring up a JFileChooser, and extract the response and render a String representation inside the cell. I have numerous snippets of code written, but trying to link them together is the bit that I am really lost on. Below I have provided the code I have so far relating to these functions: /* Code that creates the table and passes a custom model to it. Code for setting the other types of renderers and editors I have already got working have been omitted */ table = new JTable(new MyDataModel(columnNames, values)) { public TableCellRenderer getCellRenderer(int row, int col) { if(col == 1) { if(table.getModel().getValueAt(row, 0).equals("image")) { //This is where I would want to set my renderer I believe } } return super.getCellRenderer(row, col); } public TableCellEditor getCellEditor(int row, int col) { if(col == 1) { if(table.getModel().getValueAt(row, 0).equals("image")) { //This is where I would want to set my editor I believe } } return super.getCellEditor(row, col); } }; /* As an inner class, I have created the following editor that shou…
tagged with: swing
tagged with: tablecellrenderer
type: Question

http://stackoverflow.com/comment/43628091
type: Comment
has text: @tanmoy Did you find any? If not there's no usage available.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27420348

http://stackoverflow.com/comment/43376760
has text: May be some more workout with the text bounds could help with some alternate.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27470088
type: AnswerComment

http://stackoverflow.com/comment/43186503
comment on: http://stackoverflow.com/a/27366720
type: AnswerComment
score: 0
has text: @Allen I posted the web.xml and the script tag link. I want to note that you should host the client application and the webservice application on the same server or even just make them into one application. If you host a webservice on one server and access using jquery ajax on another server you will run into cross domain problems if you don't use jsonp or cors or something which is more advanced than you should need.
type: Comment

http://stackoverflow.com/a/27345590
answers question: http://stackoverflow.com/q/27345550
has comment: http://stackoverflow.com/comment/43146978
score: 0
has body: -1 is a sentinel value. That is, it's an invalid value for your program's purpose, and in particular, it's not the value of anything returned by (int) (Math.random() * 101) (which, BTW, generates a number between 0 and 100, not 1 and 100). One way to avoid the "double duty" of guess is to change the loop to unconditionally loop, and then use break to break out of the loop if the guess is correct. Like so: while (true) { System.out.print("\nEnter your guess: "); int guess = input.nextInt(); if (guess == number) { System.out.println("you are correct, the number is " + number); break; } else if (guess &gt; number) { System.out.println("your guess is too high"); } else { System.out.println("your guess is too low"); } } (Notice that I've added braces to your if block so that there can be multiple statements in the branches.) This is probably the cleanest way to do it.
has comment: http://stackoverflow.com/comment/43147202
has comment: http://stackoverflow.com/comment/43146837
has comment: http://stackoverflow.com/comment/43147111
has comment: http://stackoverflow.com/comment/43146517
has comment: http://stackoverflow.com/comment/43146526
type: Answer
has comment: http://stackoverflow.com/comment/43146904

http://stackoverflow.com/q/27435956
tagged with: java
answer count: 1
downvote count: 0
has body: I am creating a number of buttons with a method and I would like to assign a string to an id to help me keep track of it. Right now I have this: if (count &lt;= 5) { //CREATE NEW BUTTONS Button newTroop = new Button(this); Button remove = new Button(this); //STYLE NEW BUTTONS newTroop.setId(count); newTroop.setText("Button Number " + count); remove.setId(count + 1); remove.setText("-"); //CREATE NEW LINEAR LAYOUT LinearLayout addTroopLayout = new LinearLayout(this); //STYLE NEW LINEAR LAYOUT addTroopLayout.setId(count); addTroopLayout.setOrientation(LinearLayout.HORIZONTAL); addTroopLayout.setBackgroundColor(Color.BLACK); //ADD VIEWS TO NEW LAYOUT addTroopLayout.addView(newTroop); //ADD NEW LAYOUT TO mainPage LAYOUT mainPage.addView(addTroopLayout); //Increment Counter count++; } I would like to change the line: remove.setId(count + 1); to remove.setId("removeBtn" + count) So each time the buttons are created they would be assigned removeBtn1, removeBtn2, etc etc. Is this possible or should I go about this another way.
has title: Is there a way to set a id of a view programatically with a string
favorite count: 0
tagged with: android
has answer: http://stackoverflow.com/a/27436035
type: AnsweredQuestion
upvote count: 1
type: Question
score: 1
accepted answer: http://stackoverflow.com/a/27436035

http://stackoverflow.com/q/27433515
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27433604
upvote count: 3
has comment: http://stackoverflow.com/comment/43308195
has comment: http://stackoverflow.com/comment/43308376
has comment: http://stackoverflow.com/comment/43308315
type: Question
has title: Cannot resolve certain symbols in android studio
score: 3
has body: I've been having this error where this class(DataProvider) for my project that I just created will not seem to accept .add or .put. But my MainActivity class accepts them just fine. I’ve already done the Invalidate Caches and Restart. Can someone explain to me why this is happening and what I can do to fix it? DataProvider: import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class DataProvider { public static HashMap&lt;String, List&lt;String&gt;&gt; getInfo() HashMap&lt;String, List&lt;String&gt;&gt; MoviesDetails = new HashMap&lt;String, List&lt;String&gt;&gt;(); List&lt;String&gt; Action_Movies = new ArrayList&lt;String&gt;(); //'.add' would be an error in red. Cannot resolve symbol 'add'. Action_Movies.add(""); List&lt;String&gt; Romantic_Movies = new ArrayList&lt;String&gt;(); Romantic_Movies.add(""); List&lt;String&gt; Horror_Movies = new ArrayList&lt;String&gt;(); Horror_Movies.add(""); List&lt;String&gt; Comedy_Movies = new ArrayList&lt;String&gt;(); Comedy_Movies.add(""); } MainActivity: import android.app.Activity; import android.os.Bundle; import android.widget.ExpandableListView; import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class MainActivity extends Activity { HashMap&lt;String, List&lt;String&gt;&gt; Movies_categories; List&lt;String&gt; Movies_list; ExpandableListView Exp_list; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); List&lt;String&gt; Test = new ArrayList&lt;String&gt;(); Test.add("Test"); } }
tagged with: java
tagged with: class
has answer: http://stackoverflow.com/a/27433897
answer count: 3
has answer: http://stackoverflow.com/a/27433604
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/27433897
has comment: http://stackoverflow.com/comment/43308387
tagged with: android
has answer: http://stackoverflow.com/a/61313032

http://stackoverflow.com/a/27461659
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27461640
has body: Define BufferedReader at instance level just after declaring your path variable like BufferedReader buff; And in your method open, initialize it like buff = new BufferedReader(read);
answers question: http://stackoverflow.com/q/27461640

http://stackoverflow.com/q/27434943
has answer: http://stackoverflow.com/a/27435058
has answer: http://stackoverflow.com/a/27435030
accepted answer: http://stackoverflow.com/a/27435058
favorite count: 0
has comment: http://stackoverflow.com/comment/43310845
has comment: http://stackoverflow.com/comment/43310792
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/43310769
answer count: 2
has title: Thread not starting?
has body: Im working on a project and is confused at why the thread wont start when I call .start() int count = 0; while (count &lt; urls.length) { try { Thread thread = new Thread(new read(urls[count])); thread.start(); } catch (Exception e) { } count++; } but if I add public void start() { run(); } in the read class and change the code to int count = 0; while (count &lt; urls.length) { try { read thread = new read(urls[count]); thread.start(); } catch (Exception e) { } count++; } it works fine. EDIT : here is my read class code its reading data from url and calling some other methods i have in the class to store data etc. public class read implements Runnable { URL url; public read(String str) throws IOException { url = new URL(str); } public void run() { try { URLConnection connect = url.openConnection(); BufferedReader reader = new BufferedReader(new InputStreamReader(connect.getInputStream())); String input; String[] temp; int x = 0; while (x &lt; 10) { reader.readLine(); x++; } while ((input = reader.readLine()) != null) { temp = input.split(" "); temp[2].replaceAll("&lt;br&gt;", ""); String name = temp[0]; int flightNum = Integer.parseInt(temp[1]); String des = temp[2]; if (Airport.containsKey(flightNum) != true) { addFlight(flightNum, des); addPassengerReservation(flightNum, name); } else { addPassengerReservation(flightNum, name); } } reader.close(); }catch (Exception e) {} } }
possible better answer: http://stackoverflow.com/a/27435030

http://stackoverflow.com/q/27393685
has title: Apparently strange behavior of |= assignment if the RHS expression is a method call that modifies the LHS by side effect
downvote count: 0
has answer: http://stackoverflow.com/a/27393713
has comment: http://stackoverflow.com/comment/43235155
has answer: http://stackoverflow.com/a/27393949
has body: I have this very simple piece of code in java: anyMoreDelayedExplosion |= performEffect(getPanelMap(), getGameState(), this, x, y, effect, true); anyMoreDelayedExplosion is a boolean field of the class that contains this statement. performEffect is a static method that returns either true or false. Now, I debugged this (with Android-studio debugger), and I made sure that before executing the =| operation, anyMoreDelayedExplosion is "true". Then, after the operation, it becomes "false". If I change the code to: boolean res = performEffect(getPanelMap(), getGameState(), this, x, y, effect, true); anyMoreDelayedExplosion |= res; And check again, it correctly stays "true". How is this possible? My guesses: The debugger is not reliable. Still, this results in an evident bug in the application, that unbelievably gets FIXED by the above correction. There is an optimization issue of some kind with the compiler. I am totally, completely and utterly missing some truth here. If anyone has any guess or ideas about how to isolate this kind of behavior, I would be happy to hear them out. Thanks. EDIT: Here are the declarations, for type completeness: boolean anyMoreDelayedExplosion; public static boolean performEffect(PanelMap pm, GameState state, GameSceneHittable scene, int x, int y, SpecialEffect effect, boolean playFX)
favorite count: 0
has comment: http://stackoverflow.com/comment/43235108
has comment: http://stackoverflow.com/comment/43235153
has comment: http://stackoverflow.com/comment/43234942
type: Question
has comment: http://stackoverflow.com/comment/43234953
has answer: http://stackoverflow.com/a/27394232
score: 4
has comment: http://stackoverflow.com/comment/43235248
has comment: http://stackoverflow.com/comment/43235006
has comment: http://stackoverflow.com/comment/43235218
answer count: 3
has comment: http://stackoverflow.com/comment/43235191
has comment: http://stackoverflow.com/comment/43234919
has comment: http://stackoverflow.com/comment/43235065
linked to: http://stackoverflow.com/q/1724205
has comment: http://stackoverflow.com/comment/43234966
tagged with: java
accepted answer: http://stackoverflow.com/a/27394232
has comment: http://stackoverflow.com/comment/43234925
has comment: http://stackoverflow.com/comment/43235207
upvote count: 4
has comment: http://stackoverflow.com/comment/43235257
possible better answer: http://stackoverflow.com/a/27393713
type: AnsweredQuestion

http://stackoverflow.com/comment/43098636
type: QuestionComment
has text: I can't figure out how to get it to only add the strings and not the ints.
score: 0
comment on: http://stackoverflow.com/q/27319529
type: Comment

http://stackoverflow.com/a/27375465
has comment: http://stackoverflow.com/comment/43201086
downvote count: 0
has body: You're using non-existing endpoints. There is no /{post_id}/likes/user_likes, and you cannot get this info from the Graph API as from FQL. Except you read all the likes, and make a lookup if the current user_id is among them. See https://developers.facebook.com/docs/graph-api/reference/v2.2/object/likes https://developers.facebook.com/docs/graph-api/reference/v2.2/post#fields Graph API v2.0 and therefore FQL will be usable until August 7th 2016, see https://developers.facebook.com/docs/apps/changelog (first table) https://developers.facebook.com/docs/apps/versions#howlong
has comment: http://stackoverflow.com/comment/43201193
upvote count: 2
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27375033
answers question: http://stackoverflow.com/q/27375033
type: Answer
score: 2

http://stackoverflow.com/comment/43113105
type: QuestionComment
comment on: http://stackoverflow.com/q/27327030
has text: This is an example of what's being called "microservices". The best approach is in fact generally to just use a JSON REST API; Spring `@ResponseBody`/`@RestController` and `RestTemplate` make that sort of communication painless.
score: 0
type: Comment

http://stackoverflow.com/comment/43208124
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27378971
has text: What error you getting?
score: 0

http://stackoverflow.com/a/27465231
type: AcceptedAnswer
score: 0
type: Answer
has body: function decreaseTime(score:Int) { var time:float = 500 * (1/score) //ap from your other code _t1.stop(); //&lt;---- member variable _t1 = new Timer(time, ap); _t1.start(); } The higher the score the faster the timer will go The point is you need to decide how much your time speeds up. You could also do something like each point decreases time by 10, in which case you'd have var time:float = 500 - (score*10)
accepted answer of: http://stackoverflow.com/q/27465169
answers question: http://stackoverflow.com/q/27465169

http://stackoverflow.com/q/27465683
has comment: http://stackoverflow.com/comment/43367840
type: UnansweredQuestion
has body: What I am trying to do is to create a JLabel dependent of the selection in the combo box, i.e. if "History Book" is selected create a label "Enter period", if "Fictional Book" is selected create label "Enter genre". The thing is no matter what I select the Label is not visible, the place it should be stays empty. Any ideas where I am wrong ? Here is my code: JComboBox comboBox = new JComboBox(bookTypes); comboBox.setModel(new DefaultComboBoxModel(new String[] {"History Book", "Fictional Book", "Textbook"})); comboBox.setToolTipText("Choose the type of book here!"); comboBox.setBounds(196, 48, 156, 20); ActionListener cbActionListener = new ActionListener(){ @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub String s = (String) comboBox.getSelectedItem(); if(s.equals("History Book")){ JLabel lblWriteThePeriod = new JLabel("Write the Period:"); lblWriteThePeriod.setBounds(10, 317, 142, 14); dialog.getContentPane().add(lblWriteThePeriod); }else if(s.equals("Fictional Book")){ JLabel lblWriteTheGenre = new JLabel("Write the genre:"); lblWriteTheGenre.setBounds(10, 317, 142, 14); dialog.getContentPane().add(lblWriteTheGenre); } } }; comboBox.addActionListener(cbActionListener); dialog.getContentPane().add(comboBox); dialog.setVisible(true);
tagged with: swing
tagged with: combobox
linked to: http://stackoverflow.com/q/17874717
has comment: http://stackoverflow.com/comment/43368264
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/5621338
has title: Creating a JLabel via ComboBox
score: 0
has comment: http://stackoverflow.com/comment/43367837
has comment: http://stackoverflow.com/comment/43368748
tagged with: jlabel
answer count: 0

http://stackoverflow.com/comment/43117723
comment on: http://stackoverflow.com/a/27329413
type: AnswerComment
score: 0
type: Comment
has text: System.out.println("good instances"+countA); System.out.println("bad instances"+ countB);

http://stackoverflow.com/q/27348577
downvote count: 5
has answer: http://stackoverflow.com/a/27348639
answer count: 3
linked to: http://stackoverflow.com/q/1984464
has comment: http://stackoverflow.com/comment/43151779
favorite count: 0
has comment: http://stackoverflow.com/comment/43151733
linked to: http://stackoverflow.com/q/5981460
upvote count: 6
has comment: http://stackoverflow.com/comment/43151731
type: AnsweredQuestion
duplicate of: http://stackoverflow.com/q/1984464
score: 1
has answer: http://stackoverflow.com/a/27348687
possible better answer: http://stackoverflow.com/a/27348763
has comment: http://stackoverflow.com/comment/43151795
type: Question
has answer: http://stackoverflow.com/a/27348763
has body: Is there an advantage to declaring a private method as "final" in Java? If my understanding is correct, the "final" Modifier makes sure I cannot override a method in a subclass and so this may make this method more efficient during runtime. Some literature says it can be inlined if it is final for example which may make the method call faster. Also, the Java runtime won't have to go look for other method in the inheritance hierarchy if it is declared final. However, private functions cannot be overriden, so are they implicitly "final" as well? Is there a difference between the following two declarations: private void myFun() and private final void myFun();
accepted answer: http://stackoverflow.com/a/27348687
tagged with: java
has title: Is there an advantage to declaring a private method "final" in Java?

http://stackoverflow.com/a/27449551
has comment: http://stackoverflow.com/comment/43337891
type: Answer
has body: You can also split the string and access the last element String[] split = s.split(":"); System.out.println(split[1].trim()); // ^-this is just an example, as an exercise try // to figure out index of last element yourself
downvote count: 0
answers question: http://stackoverflow.com/q/27449466
score: 1
has comment: http://stackoverflow.com/comment/43337822
upvote count: 1

http://stackoverflow.com/comment/43311671
has text: @Emz The backslash will not work. This is a format string, not a regex.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27435345

http://stackoverflow.com/a/27322064
score: 2
has body: Just register a ContextLoaderListener in your web.xml which loads your applicationContext.xml. The process is described in the documentation, here. Your @Controller bean will be loaded by your DispatcherServlet which will use the beans in the ApplicationContext loaded by the ContextLoaderListener.
upvote count: 2
answers question: http://stackoverflow.com/q/27321970
accepted answer of: http://stackoverflow.com/q/27321970
has comment: http://stackoverflow.com/comment/43184023
has comment: http://stackoverflow.com/comment/43183863
has comment: http://stackoverflow.com/comment/43182876
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43184431
downvote count: 0
type: Answer

http://stackoverflow.com/q/27328866
type: Question
has comment: http://stackoverflow.com/comment/43129717
tagged with: graphics
tagged with: jpanel
has title: GUI Using JFrame, & JPanel drawing custom shapes
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/27328884
has body: Pretty much I create a Shape class, with Rectangle, Circle, Triangle extending Shape, and a Square class extending Circle. I have the code working with this main class, but I'm having a tough time converting it into GUI because I'm not sure how to do number 3 to make this come together and how to make a g.drawOval(with given x,y &amp; radius) and draw triangle(given x,y, base and height). Project6 class will have to extend the JFrame class Project6 constructor will have to set up the GUI window. A new abstract method: public void display(Graphics g); should be added to the base and derived classes. A custom JPanel must be set up with a paintComponent method The new display(Graphics g) method will have to draw the shapes on the GUI window and be called from a loop in the paintComponent method. import javax.swing.*; import java.awt.*; import javax.swing.JFrame; import javax.swing.JPanel; public class Project6 extends JFrame { private Shape [] thearray = new Shape[100]; public static void main (String [] args) { Project6 tpo = new Project6(); tpo.run(); } public void run () { int count = 0; thearray[count++] = new Circle(20, 20, 40); thearray[count++] = new Triangle(70, 70, 20, 30); thearray[count++] = new Rectangle(150, 150, 40, 40); thearray[count++] = new Square(100, 100, 50, 75); for (int i = 0; i &lt; count; i ++ ) { thearray[i].display(); } int offset = 0; double totalarea = 0.0; while (thearray[offset] != null) { totalarea = totalarea + thearray[offset].area(); offset++; } System.out.println("The total area for " + offset + " Shape objects is " + totalarea); } public Project6() { JFrame frame = new JFrame(); frame.setSize(800, 700); frame.setTitle("Shapes: Circle, Triangle, Rectangle, Square"); frame.setLocationRelativeTo(null); //Center Frame frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } public static class MyPanel extends JPanel { public static JPanel showJPanel(Graphics g) { panel = new MyPanel(); return panel; } @Override pu…
tagged with: jframe
type: UnansweredQuestion
tagged with: java
tagged with: swing

http://stackoverflow.com/comment/43135146
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27338808
has text: *"However, this will likely be too slow,.."* On what evidence do you base that statement?
type: Comment

http://stackoverflow.com/a/27477005
upvote count: 1
type: Answer
has body: Guava can be your choice: ImmutableSet&lt;Integer&gt; set = ImmutableSet.copyOf(listInts); The API is extremely optimized. It is FASTER than listInts.stream().distinct() and new LinkedHashSet&lt;&gt;(listInts).
downvote count: 0
answers question: http://stackoverflow.com/q/27464781
has comment: http://stackoverflow.com/comment/43388106
score: 1
has comment: http://stackoverflow.com/comment/43389025

http://stackoverflow.com/a/27428640
answers question: http://stackoverflow.com/q/27428563
downvote count: 0
has comment: http://stackoverflow.com/comment/43300378
score: 6
accepted answer of: http://stackoverflow.com/q/27428563
has body: Those are not aliases, they are references. IntObject x = new IntObject(2); // &lt;-- 2 IntObject y = new IntObject(7); // &lt;-- 7 IntObject a = y; // &lt;-- 7 x = someMethod(y); // &lt;-- 8 a = someMethod(x); // &lt;-- 9. When you call someMethod, IntObject ans = obj; // ans points to obj. ans.increment(); // same as obj.increment(); return ans; I think you expected IntObject ans = obj.clone(); // ans points to a copy of obj. ans.increment(); // now it won't modify obj. return ans;
upvote count: 6
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/43311509

http://stackoverflow.com/q/27340202
type: UnansweredQuestion
score: 2
tagged with: java
tagged with: post
type: Question
tagged with: shiro
tagged with: jersey
downvote count: 0
has body: My first attempt at developing a simple authentication based REST services. I am trying to develop a RESTful web application using Jersey on Tomcat 8. I am using Apache Shiro for session management and authorization. Only HTTPS is supported. All services require authentication, neither guest nor anonymous access is allowed. The request can be authenticated two ways. If the user belongs to the list of users in web application, then the user logs in from a Web browser and Shiro simply validates if the current user is logged in and allows request to proceed. This is for the custom UI provided by the application itself. If the request is from third party application, the username/password token are passed into the HTTP header authorization field for every service request. The users are managed by third party app and the app uses a common username/password for its users to access the web service. Such common users are prevented from logging in. All service requests are filtered (web.xml): REST Service com.sun.jersey.spi.container.servlet.ServletContainer com.sun.jersey.spi.container.ContainerRequestFilters com.unisys.cpf.ffm.filter.AuthenticationFilter `enter code here` REST Service /service/* The AuthenticationFilter class implements ContainerRequestFilter for authentication: @Override public ContainerRequest filter(ContainerRequest cr) { Subject currentUser = SecurityUtils.getSubject(); if (!currentUser.isAuthenticated()) { //User is not logged in so get the authorization from header and authenticate String auth = cr.getHeaderValue("authorization"); //Do Shiro authentication here. } return cr; } I have a web service which accepts form parameters and creates a resource. The Form parameters are dynamic based on what user selects. So I cannot use @FormParam to get all the parameters. Also there may be more contents to form as new features are added so I do not want to touch the Service again for each new/removed parameter. I am using the Chrome Advanced REST Client plugin…
favorite count: 0
answer count: 0
has title: RESTful Web Service with Jersey and Apache Shiro
upvote count: 2

hql
tag name: hql
tags question: http://stackoverflow.com/q/27368877
tags question: http://stackoverflow.com/q/27457477
tags question: http://stackoverflow.com/q/27314299
type: Tag
tags question: http://stackoverflow.com/q/27473880
tags question: http://stackoverflow.com/q/27443748

http://stackoverflow.com/comment/43255281
has text: Just add a colon (`:`) after the `public`.
score: 1
comment on: http://stackoverflow.com/q/27405284
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27442553
has title: ScrollPane inner size limits
score: 1
tagged with: java
tagged with: javafx
has body: I have fxml view like this: <MenuItem mnemonicParsing="false" text="Close" /> <MenuItem mnemonicParsing="false" text="Delete" /> <MenuItem mnemonicParsing="false" text="About" /> <Pagination fx:id="paginator" /> It's my Controller for this view: @Override public void initialize(URL location, ResourceBundle resources) { paginator.setPageFactory(new Callback<Integer, Node>() { @Override public Node call(Integer param) { return createPage(param); } }); } private Node createPage(Integer param){ VBox rootVBox = new VBox(); List<Ad> stories = null; try { stories = JSoupHelper.getStories(param); for (Ad ad: stories){ Label title = new Label(ad.getTitle()); Label text = new Label(ad.getText()); VBox vBox = new VBox(title, text); HBox hBox = new HBox(new ImageView(new Image("file:trayicon.png")), vBox); hBox.setMaxSize(USE_COMPUTED_SIZE, USE_COMPUTED_SIZE); rootVBox.getChildren().add(hBox); } } catch (IOException e) { return new Label("Подключиться не удалось"); } return rootVBox; } When I run my app, I see this : But I want see like this: Any widget, whitch was inside my ScrollPane takes maximum size (. HBarPolicy = AS_NEEDED|NEVER don't help me with my problem.
upvote count: 1
type: Question
downvote count: 0
has answer: http://stackoverflow.com/a/27456794
tagged with: javafx-8
answer count: 1
favorite count: 0
type: UnansweredQuestion

http://stackoverflow.com/a/76539659
has body: From Gson README.md ℹ️ Gson is currently in maintenance mode; existing bugs will be fixed, but large new features will likely not be added. If you want to add a new feature, please first search for existing GitHub issues, or create a new one to discuss the feature and get feedback. so I'd say it IS deprecated. I agree with the other answer that Jackson is a pretty popular one.
answers question: http://stackoverflow.com/q/27441249
score: 0
has comment: http://stackoverflow.com/comment/138474274
type: Answer

thymeleaf
tags question: http://stackoverflow.com/q/27325538
tag name: thymeleaf
type: Tag
tags question: http://stackoverflow.com/q/27401424

http://stackoverflow.com/comment/43151148
comment on: http://stackoverflow.com/a/27348203
type: AnswerComment
has text: I assumed it's Java. The textbook doesn't clealy state Java or C++. The book is Programming Logic and Design.
score: 0
type: Comment

http://stackoverflow.com/a/27575671
has body: In this block : if (b.getContentType().contains("multipart")) { mp = (Multipart)b.getContent(); j = 0; continue; } You set j to 0 and ask the loop to continue, hoping it will start again at zero. But the increment operation j++ will come before and your loop will start at 1, not 0. Set j to -1 to solve your issue. if (b.getContentType().contains("multipart")) { mp = (Multipart)b.getContent(); j = -1; continue; }
answers question: http://stackoverflow.com/q/27387202
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/43795556
has comment: http://stackoverflow.com/comment/43795496
has comment: http://stackoverflow.com/comment/43795461
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27387202
has comment: http://stackoverflow.com/comment/43795570
has comment: http://stackoverflow.com/comment/43795535
type: Answer
has comment: http://stackoverflow.com/comment/43802344

http://stackoverflow.com/a/27441592
type: Answer
has body: Actually it was very easy. I just needed to create an instance of SqlQuery to create a raw query: SqlQuery rawQuery = Ebean.createSqlQuery("SELECT journal_id from journal_predecessor where journal_id=" + successorId + " AND predecessor_id=" + predecessorId); And because i just needed to check weather a row exists or not, I find the size of the set of the results returned by the query: Set&lt;SqlRow&gt; sqlRow = rawQuery.findSet(); int rowExists = sqlRow.size();
accepted answer of: http://stackoverflow.com/q/27427059
answers question: http://stackoverflow.com/q/27427059
score: 0
type: AcceptedAnswer

http://stackoverflow.com/comment/43206471
type: QuestionComment
comment on: http://stackoverflow.com/q/27378459
has text: why you want to remove it?
score: 0
type: Comment

http://stackoverflow.com/comment/43255373
type: Comment
type: QuestionComment
has text: @pheromix It may not be a bad idea to follow a good C++ book all the way to the end; this question would have been answered in there somewhere.
comment on: http://stackoverflow.com/q/27405284
score: 1

http://stackoverflow.com/comment/43103676
type: QuestionComment
comment on: http://stackoverflow.com/q/27316473
score: 0
type: Comment
has text: Try avoiding reserved database specific keywords like 'USER' for table name.

http://stackoverflow.com/comment/43141481
type: AnswerComment
score: 0
type: Comment
has text: @Tom Yeah ... I did not recognize that.
comment on: http://stackoverflow.com/a/27342918

http://stackoverflow.com/comment/43095876
comment on: http://stackoverflow.com/a/27318174
score: 0
type: AnswerComment
has text: Thanks! I love itext, it is my favorite java pdf lib. But as far as i can see from the code, this would simple put the String of the Body into the pdf. My main problem is rendering the email (html, css, embedded images) which is why i wanted to use an existing email client and "misuse" it.
type: Comment

http://stackoverflow.com/a/27361360
score: 1
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27361215
has body: The synchronized keyword requires an Object. DecibelSample is a classname, not an Object. The Object will be used to ensure synchronization : i.e. when a thread need to execute the code inside the synchronized block : the thread must acquire a lock on the Object. if the lock can be aquired by the thread then the code inside the block is executed and the lock is released so that another thread can acquire it. if the lock cannot be acquired : the thread wait until the lock (owned by another thread) is released. In your case, you need an Object to support the locking mechanism: //used for locking only // don't consume useless memory : a zero-sized array is fine // ensure that the LOCK is shared between all threads : let's make it static // ensure that the object used for locking cannot be changed by anyone : let's make it final // at first sight : we don't need to synchronize on this Object in another class : keep it private. private static final Object[] LOCK = new Object[0]; ... if (mDecibelSample == null) { synchronized (LOCK) { if (mDecibelSample == null) { mDecibelSample = new DecibelSample(); } } }
type: Answer

http://stackoverflow.com/q/27385292
tagged with: keytool
favorite count: 0
answer count: 0
has title: jarsigner keystore error
type: UnansweredQuestion
tagged with: jarsigner
upvote count: 1
has body: I created a key to java program with the keytool command: keytool –genkey –alias chave –validity 10000 –keypass 000005 –keystore “c:\Documents\chave\chave” –storepass 000005; Then, I sign with the command: jarsigner –keypass 000005 –storepass 000005 –keystore “c:\Documents\chave\chave” “c:\Projeto\Autenticacao\Autenticacao\dist\Autenticacao.jar” chave; But is occurring the following error: jarsigner error: java.lang.RuntimeException: keystone load: keystore was tampared with, or password was incorrect. I can not understand what is wrong.
score: 1
tagged with: java
type: Question
downvote count: 0

http://stackoverflow.com/comment/43126191
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27333904
score: 0
has text: Try commenting out everything except the setContentView and setSupportActionBar (and corresponding code) and see if it works.

http://stackoverflow.com/comment/43118012
type: QuestionComment
has text: *"contentPane.setLayout(null);"* - There's a problem...
comment on: http://stackoverflow.com/q/27329876
score: 0
type: Comment

http://stackoverflow.com/a/27337513
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27336947
has body: I'm a little stuck on what the number pattern is to be able to complete this problem. Lets try to analyse the sequence using some function f f(1) = 1 (Total digits = 1) f(2) = 1 2 1 ( Total digits = 3) f(3) = 121 3 121 (Total digits = 7) f(4) = 1213121 4 1213121 (Total digits = 15) f(5) = 121312141213121 5 121312141213121 (Total digits = 31) So as you can observe total digits sequence looks like 1,3,7,15,31,....2^n-1 Now we can express this logic as mentioned below(Note : in order to help you to better understand how the program works i am printing sequence at every level) public class SequenceGenerator { public static void main(String[] args) { generate(7); } static void generate(int depth) { recursiveGenerator(1, null, depth); } static void recursiveGenerator(int num, String prev, int limit) { if (num &lt;= limit) { if (prev != null) { System.out.println(); } if (prev != null) { System.out.printf("%s %d %s", prev, num, prev); } else { prev = ""; System.out.printf("%d", num); } if (prev.equals("")) { prev += num + prev; } else { prev += " " + num + " " + prev; } recursiveGenerator(++num, prev, limit); } } } Outputs 1 1 2 1 1 2 1 3 1 2 1 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 6 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 6 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 7 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 6 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1 5 1 2 1 3 1 2 1 4 1 2 1 3 1 2 1

http://stackoverflow.com/comment/58198366
score: 1
type: AnswerComment
has text: Thanks. @Rushang Prajapati I wish posters would supply **complete** information, rather than dribble it out... So I followed up, without giving in to my desire to criticize them for not being adequate. And Android Studio has such a zoo of files all over the place, poorly documented, it's a prime example of the need to supply complete info.
type: Comment
comment on: http://stackoverflow.com/a/32661577

http://stackoverflow.com/q/27464184
tagged with: libgdx
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43525031
has title: Libgdx NullPointerException when trying to update viewport
has body: I'm trying to update the game's viewport when the game resizes, but when I start the game, I get a java.lang.NullPointerException: Exception in thread "LWJGL Application" java.lang.NullPointerException at com.badlogic.gdx.utils.viewport.Viewport.apply(Viewport.java:49) at com.badlogic.gdx.utils.viewport.ExtendViewport.update(ExtendViewport.java:90) at com.badlogic.gdx.utils.viewport.Viewport.update(Viewport.java:57) at me.chrisjosten.testgame.screens.MainScreen.resize(MainScreen.java:82) at com.badlogic.gdx.Game.setScreen(Game.java:62) at me.chrisjosten.testgame.create(MainScreen.java:13) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:136) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:114) In the class, that implements Screen, I have in the resize method, the place where the exception occurs, the following code: @Override public void resize(int w, int h) { viewport.update(w, h); } where the viewport is an ExtendViewport created in the constructor of the class. I've tried putting that in the show method to, but then I get the same result. The full code of the class: package me.chrisjosten.testgame.screens; import me.chrisjosten.testgame.MyGame; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.Screen; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Vector3; import com.badlogic.gdx.utils.viewport.ExtendViewport; import com.badlogic.gdx.utils.viewport.FillViewport; import com.badlogic.gdx.utils.viewport.Viewport; public class MainScreen implements Screen{ private MyGame game; private BitmapFont font; private SpriteBatch batch; private OrthographicCamera camera; private Viewport viewport; private boolean goingUp = false; private float alpha = 1; private int gameWidth = 100; private int game…
has comment: http://stackoverflow.com/comment/43524787
score: 0
answer count: 1
has answer: http://stackoverflow.com/a/57081086
has comment: http://stackoverflow.com/comment/43364649
has comment: http://stackoverflow.com/comment/43524134
accepted answer: http://stackoverflow.com/a/57081086
type: AnsweredQuestion

http://stackoverflow.com/comment/43310130
type: Comment
score: 0
has text: sol4me but for me i get 197?
type: AnswerComment
comment on: http://stackoverflow.com/a/27434621

http://stackoverflow.com/comment/43104840
score: 0
comment on: http://stackoverflow.com/a/27322007
has text: Thank you this helped me a lot. But I didn't use arrays and loops. this code worked for me, I added codes this way to my interface button. //2nd line `int distance = Integer.parseInt(txt_km.getText());` `if (distance > 21) { fare += (distance - 21) * 25; distance = 21; lblout.setText(""+fare);` // added at the end to every IF statement
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27364098
has comment: http://stackoverflow.com/comment/43181730
type: Question
type: AnsweredQuestion
tagged with: java
tagged with: jpanel
has comment: http://stackoverflow.com/comment/43180229
possible better answer: http://stackoverflow.com/a/27364130
linked to: http://stackoverflow.com/q/7229226
answer count: 2
has answer: http://stackoverflow.com/a/27364130
downvote count: 0
has answer: http://stackoverflow.com/a/27364526
favorite count: 0
has title: How to resize a JPanel
score: 1
accepted answer: http://stackoverflow.com/a/27364526
upvote count: 1
has body: I am trying to resize the JPanels but there is a space under it . Here is a link to show : And this is the code : import java.awt.*; import javax.swing.*; public class Ex1 extends JFrame{ private JTextArea textarea = new JTextArea (); private JTextField field = new JTextField ();`` private JButton buton = new JButton ("Trimite"); public Ex1(){ JPanel panel = new JPanel (new BorderLayout(2,2)); JPanel panel1 = new JPanel (new BorderLayout(2,2)); JPanel panel2 = new JPanel (new BorderLayout(2,2)); JLabel label1 = new JLabel ("Mesaje"); JLabel label2 = new JLabel ("Scrieti un mesaj"); panel1.setPreferredSize(new Dimension(350,100)); panel2.setPreferredSize(new Dimension(350,25)); panel1.add(label1, BorderLayout.NORTH); panel1.add(textarea, BorderLayout.CENTER); panel2.add(label2, BorderLayout.WEST); panel2.add(field, BorderLayout.CENTER); panel2.add(buton, BorderLayout.EAST); setLayout(new GridLayout(2,1,1,1)); panel.add(panel1, BorderLayout.NORTH); panel.add(panel2, BorderLayout.CENTER); add(panel); } public static void main(String[] args) { JFrame frame = new Ex1(); frame.pack(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocationRelativeTo(null); frame.setVisible(true); } }
tagged with: swing

http://stackoverflow.com/comment/43278086
type: QuestionComment
comment on: http://stackoverflow.com/q/27416473
has text: Yes, I do want to search for parts, that's why I'm asking the question. I think I will need to store the actor/tags info in a linked table somehow, so I can search for movies with a certain actor, etc.
score: 0
type: Comment

http://stackoverflow.com/comment/43332983
has text: Thanks Kapep, I updated my tests to include this one, however I do not get the same results as you. The switch does not appear to be faster than the array method. Maybe I am missing something...
comment on: http://stackoverflow.com/a/27444750
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27400488
answer count: 2
has answer: http://stackoverflow.com/a/27400751
tagged with: sockets
possible better answer: http://stackoverflow.com/a/27400751
type: AnsweredQuestion
has title: Reading a POST in java
tagged with: java
has body: I'm having troubles trying to capture a POST request in a java web server (I'm not allowed to use specific HTTP libraries). Reading the socket: this.socketIn = new BufferedReader(new InputStreamReader(this.socket.getInputStream())); String inputLine; StringBuilder requestString = new StringBuilder(); int lines = 0; while ((inputLine = this.socketIn.readLine()) != null &amp;&amp; inputLine.length() &gt; 0 &amp;&amp; lines &lt; 100) { requestString.append(inputLine + "\n"); lines++; } // if (requestString.toString().split("\\n")[0].startsWith("POST")){ // System.out.println(this.socketIn.readLine()); //} after that, if I do requestString.toString() I get the following: POST {{uselessDir}}/ HTTP/1.1 Host: {{myIP}} User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:34.0) Gecko/20100101 Firefox/34.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate Referer: http://{{myIP}}/{{uselessDir}}/ Connection: keep-alive Content-Type: application/x-www-form-urlencoded Content-Length: 42 so, I tried adding a if at the end of the loop, because of there is a empty line between Content-Length: 42 and the line I'm looking for, and it blocked reading. In order to ensure using tcpdump I was able to capture also the last line. testData1=someText&amp;testData2=someOtherText maybe the solution is very silly, and I'm not seing it. Thanks.
has answer: http://stackoverflow.com/a/27403054
accepted answer: http://stackoverflow.com/a/27403054
type: Question
has comment: http://stackoverflow.com/comment/43246462
tagged with: post
score: 0

http://stackoverflow.com/a/27460434
answers question: http://stackoverflow.com/q/27460387
upvote count: 1
has body: HashSet doesn't provide any order guarantees. That doesn't mean that order can't emerge, for some data sets, as a by-product of how it is implemented. Just that you cannot rely on that, and it may change from implementation to implementation, etc.
type: Answer
downvote count: 0
score: 1

http://stackoverflow.com/comment/43151201
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27347534
has text: Please provide full build.gradle to see what is going there.
score: 0

http://stackoverflow.com/a/61635790
score: 0
type: Answer
has body: add Bearer or basic 'Authorization': 'Bearer AB11588770007gXsEtCmJfNsyIpquocg2k2tXmUoeCrw5I0YIASACSHHHHHDSDSDDDDDDDDDDDDDDDDDDDDDDDDDDDDD'
answers question: http://stackoverflow.com/q/27471212

http://stackoverflow.com/comment/43227855
has text: Thanks Luiggi. I eventually do not intend to. The end goal is to write a Yarn application, so this is incremental. I felt i could deal with that inefficiency as i have a 12gb pc i'm working with. Just want to test out my solution locally before i go on to write it to run on a hadoop cluster. I will look into cache but pressed for time. Do you see the RAM as the reason here ?
comment on: http://stackoverflow.com/q/27389882
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43122704
score: 0
type: Comment
type: QuestionComment
has text: @curiousinternals I am not setting it equal to itself, myArray is filled with 0s first, then it is filled with values so that I can get all the unique multiplications. How would you suggest me filling an array with the unique multiplications?
comment on: http://stackoverflow.com/q/27332056

apache-storm
tags question: http://stackoverflow.com/q/27414600
type: Tag
tags question: http://stackoverflow.com/q/27318172
tags question: http://stackoverflow.com/q/27354438
tag name: apache-storm
tags question: http://stackoverflow.com/q/27469933

http://stackoverflow.com/a/27460624
has body: Looking at the code, for HashMap you find (in HashIterator class): final Entry&lt;K,V&gt; [More ...] nextEntry() { if (modCount != expectedModCount) throw new ConcurrentModificationException(); Entry&lt;K,V&gt; e = next; if (e == null) throw new NoSuchElementException(); if ((next = e.next) == null) { Entry[] t = table; while (index &lt; t.length &amp;&amp; (next = t[index++]) == null) ; } current = e; } For LinkedHashMap you find (in LinkedHashIterator class): Entry&lt;K,V&gt; [More ...] nextEntry() { if (modCount != expectedModCount) throw new ConcurrentModificationException(); if (nextEntry == header) throw new NoSuchElementException(); Entry&lt;K,V&gt; e = lastReturned = nextEntry; nextEntry = e.after; return e; } This seems to confirm your statements. Regarding to Apache's LinkedMap: public Object [More ...] firstKey() { if (size == 0) { throw new NoSuchElementException("Map is empty"); } return header.after.getKey(); } public Object [More ...] lastKey() { if (size == 0) { throw new NoSuchElementException("Map is empty"); } return header.before.getKey(); } Seems to be O(1).
answers question: http://stackoverflow.com/q/27460279
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/126420557
score: 1
upvote count: 1

google-cloud-messaging
tags question: http://stackoverflow.com/q/27464303
tags question: http://stackoverflow.com/q/27471141
tags question: http://stackoverflow.com/q/27361148
tags question: http://stackoverflow.com/q/27314459
tag name: google-cloud-messaging
type: Tag

http://stackoverflow.com/a/27451823
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27451375
has body: If I'm reading this right, your code doesn't match your statement of what you want to happen. The code says, in effect, if (!op || !buildMode). Your statement after the code says if (!(op || buildMode)). Applying DeMorgan's Law to that, the code should be if (!op &amp;&amp; !buildMode). @EventHandler public void blockBreakWithBuilder(BlockBreakEvent e) { if (onWorld(e.getPlayer()) &amp;&amp; !e.getPlayer().isOp() &amp;&amp; !buildMode.hasBuildMode(e.getPlayer())) { e.getPlayer().sendMessage("True"); e.setCancelled(blockBreak); return; } e.getPlayer().sendMessage("False"); }
score: 1

http://stackoverflow.com/comment/43502275
type: Comment
has text: @Tom i don't even understand about what you are taking
comment on: http://stackoverflow.com/a/27340971
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43348991
comment on: http://stackoverflow.com/a/27455553
type: Comment
has text: sorry, I don't have the author of MediaPlayer. You know what? The `MediaPlayer` is in source of android
score: 0
type: AnswerComment

http://stackoverflow.com/q/27394473
has title: JUnit testing transactional methods
tagged with: transactional
answer count: 1
tagged with: junit
downvote count: 0
has body: I am new to JUnit and trying to test a spring web service which uses JPA DAOs. I need to test a service method similar to below. Service method is annotated with @Transactional(propagation=Propagation.REQUIRED) and ServiceObjectRepository.update() method calls a native sql query to update the db. @Transactional(propagation=Propagation.REQUIRED) public void serviceMethod(){ //Read DB for ServiceObject to update //Call ServiceObjectRepository.update() method to update DB } ServiceObjectRepository public interface ServiceObjectRepository extends JpaRepository&lt;ServiceObject, Integer&gt; { @Query(value ="UPDATE serviceobjcet AS c SET c.objectstatus= :os WHERE c.objid = :oi", nativeQuery = true) public Integer update(@Param("os")short objStatus,@Param("oi")int objId); } TestClass @TransactionConfiguration(defaultRollback=true) @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration( locations = "classpath:service-test.xml") @Transactional public class ServiceHandlerTest { @Test public void testServiceMethod() { //Create ServiceObject and save to DB //Call serviceMethod() //Read DB for updatedServiceObject assertEquals("Test: Object should be in updated state", new Short(3), updatedServiceObject.getObjectstatus(), 0); } } My test runs and rollback the db transactions. But the problem is when I read the updatedServiceObject after calling the serviceMethod it does not return the updated object. So my test fails with a NullPointerException at the assertEquals. Any idea to overcome this issue?
favorite count: 0
accepted answer: http://stackoverflow.com/a/27482649
tagged with: spring
type: AnsweredQuestion
tagged with: java
type: Question
score: 5
has answer: http://stackoverflow.com/a/27482649
upvote count: 5

http://stackoverflow.com/q/27465466
tagged with: jcombobox
tagged with: swing
has answer: http://stackoverflow.com/a/27466583
has comment: http://stackoverflow.com/comment/43368174
type: Question
type: AnsweredQuestion
tagged with: java
has body: What I only want is to implement correctly the sixth column of my Jtable with an JComboBox. When I click on the field the combobox suddenly appears, but without clicking I have the JComponent reference as String. I defined an own tableModel and tableCellrenderer. here is my Code: package examples; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Font; import java.util.EventObject; import javax.swing.DefaultCellEditor; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.ListSelectionModel; import javax.swing.SwingUtilities; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; import javax.swing.event.CellEditorListener; import javax.swing.event.TableModelListener; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableCellEditor; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableModel; public class MyTableExample2 { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager .getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { e.printStackTrace(); } @SuppressWarnings("unused") JFrame frame = new MyFrame(); } }); } } class MyFrame extends JFrame { private static final long serialVersionUID = 1L; private JComboBox&lt;String&gt; comboBox = new JComboBox&lt;String&gt;(new String[] { "Me", "You", "They" }); private String[] columnNames = { "First Name", "Last Name", "Sport", "# of Years", "Vegetarian", "ComboBox" }; private Object[][] data = { { "Kathy", "Smith", "Snowboarding", new Integer(5), new Boolean(true), comboBox }, { "John", "Doe", "Rowing", new Int…
tagged with: jtable
accepted answer: http://stackoverflow.com/a/27466583
answer count: 1
has title: How to implement correctly an JComboBox in a JTable?
score: 0

http://stackoverflow.com/q/27466644
tagged with: java
tagged with: otto
has body: I seem to be fighting with a race condition, the cause of which I can't seem to pin down. When executing the below code, I intermittently get the stack trace below. Is there some obvious rule of the Fragment lifecycle I am disobeying? I am not clear on what would explicitly forbid me from performing a transaction here to handle the event. I am using a WebViewClient to detect external URLs clicked within a local .html document - as in, URLs which point to a non-local host. I am using Otto's EventBus to post those actions to an Activity. When the Activity receives those events, I want to show those external URLs in a different Fragment, by calling FragmentTransaction.replace() DefaultWebViewClient.java @Override public boolean shouldOverrideUrlLoading(final WebView view, final String url) { boolean shouldOverride; if (urlIsLocal(url)) { shouldOverride = super.shouldOverrideUrlLoading(view, url); } else { // trigger an event for the fragment to swap out // return true to tell the webview not to load it... EventBus.getInstance().post(new LoadExternalUrlEvent(url)); shouldOverride = true; } return shouldOverride; } FragmentActivity.java @Subscribe public void onLoadExternalUrlEvent(LoadExternalUrlEvent externalLoadEvent) { final BrowserFragment browserFragment = new BrowserFragment(); Bundle args = new Bundle(); args.putSerializable(BrowserFragment.ARG_LOAD_EXTERNAL_URL_EVENT, externalLoadEvent); browserFragment.setArguments(args); getSupportFragmentManager().beginTransaction() .replace(R.id.fragment_container, browserFragment, BrowserFragment.FRAGMENT_TAG) .addToBackStack(null).commit(); } LoadExternalUrlEvent.java public class LoadExternalUrlEvent implements Serializable { private static final long serialVersionUID = 1L; public final String url; public LoadExternalUrlEvent(String url) { this.url = url; } @Override public String toString() { return "LoadExternalUrlEvent [url=" + url + "]"; } } EventBus.java import com.squareup.otto.Bus; public class EventBus { private s…
has title: FragmentTransaction in WebViewClient.shouldOverrideUrlLoading throws IllegalStateException
score: 2
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27476023
type: Question
upvote count: 2
tagged with: android
answer count: 1
accepted answer: http://stackoverflow.com/a/27476023
tagged with: android-fragments

http://stackoverflow.com/q/27441694
score: 0
has comment: http://stackoverflow.com/comment/43323582
favorite count: 0
has comment: http://stackoverflow.com/comment/43323192
tagged with: java.util.scanner
accepted answer: http://stackoverflow.com/a/27441924
upvote count: 1
downvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43323011
has answer: http://stackoverflow.com/a/27441924
tagged with: java
has comment: http://stackoverflow.com/comment/43322997
type: Question
has comment: http://stackoverflow.com/comment/43322877
answer count: 1
tagged with: arrays
has title: How To Read Per Specific Word With Scanner Java?
has comment: http://stackoverflow.com/comment/43323261
has body: Hello I Have Filename save, for save game in My Java program. And this file like this = B . . . . . W . B . W . B . . . B W W B . . . . . == 1 0 0 0 0 0 1 0 1 0 1 0 1 0 0 0 1 1 1 1 0 0 0 0 0 === 9 ==== 2 ===== 5 I'm confused, how to read this file, and store value of this file per specific into 2D array and other variable, currently i have 5 variable arrMove[5][5], arrProc[5][5], forTurn, seconds, totalSeconds i have this code for loadgame, and currently just 1 array that i can store from this file and that's with error int x = 0; int y = 0; Scanner inFile1 = new Scanner(new File("save.txt")); while (inFile1.hasNext()) { // find next line if (inFile1.hasNext("=")){ ActivityBoard.arrMove[x][y] = inFile1.next(); y++; if (y &gt; 4) { y = 0; x++; } } } inFile1.close(); and this is my savegame if (e.getSource().equals(SaveMenu)) { try { PrintWriter out = new PrintWriter("save.txt"); out.println("="); for (int i = 0; i &lt; rows; i++) { for (int j = 0; j &lt; cols; j++) { out.println(ActivityBoard.arrMove[i][j]); } } out.println("=="); for (int i = 0; i &lt; rows; i++) { for (int j = 0; j &lt; cols; j++) { out.println(ActivityBoard.arrProc[i][j]); } } out.println("==="); out.println(forTurn); out.println("===="); out.println(seconds); out.println("====="); out.println(TotalTimer.getTime()); out.close(); this.dispose(); System.exit(1); } catch (FileNotFoundException ex) { Logger.getLogger(ActivityBoard.class.getName()).log(Level.SEVERE, null, ex); } } i want store this value to my variable from delimiter = to == i want store into array arrMove[5][5] from delimiter == to === i want store into array arrProc[5][5] from delimiter === to ==== i want store into forTurn from delimiter ==== i want store into seconds can anyone help me ? thanks :) sry for my bad english.

http://stackoverflow.com/comment/43289130
type: Comment
has text: I still think it is a bad idea to do it this way, but see my updated answer for an AOP-style solution.
comment on: http://stackoverflow.com/a/27402619
score: 1
type: AnswerComment

http://stackoverflow.com/q/27334225
answer count: 1
has body: I am create relationship between two nodes using spring-data-neo4j, but the relation ship not persist. There is no exception thrown by server. when i fetch the node, there is a null values in it. I am using Neo4jTemplate createRelationshipBetween() method. Follwoing is my code: Relationship Entity: @RelationshipEntity(type=RelationshipTypes.FRIEND) public class FriendsRelationship extends BaseEntity{ @StartNode @Getter @Setter private Person person; @EndNode @Getter @Setter private Person friend; @Getter @Setter private String friendsType; } public class CreateEntitiesRelationship { @Autowired private Neo4jTemplate neo4jTemplate; ------------------------------- public FriendsRelationship createRelationshipBetweenPersons(Person person, Person friend, Class&lt;FriendsRelationship&gt; relationshipEntity, String friendshipType) { FriendsRelationship relationship = neo4jTemplate.createRelationshipBetween(person, friend, relationshipEntity, RelationshipTypes.FRIEND, false); neo4jTemplate.save(relationship); return relationship; } } Whht actual problem is , i am unable to figure out. I am new if Neo4j.
tagged with: spring-data-neo4j
type: UnansweredQuestion
has title: Spring-Data-Neo4j: Cannot create relationship between entities using neo4jtempalte createRelationshipBetween)() method
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/31337186
has comment: http://stackoverflow.com/comment/43161572
score: 0

http://stackoverflow.com/q/27353260
tagged with: 3des
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: encryption
has body: I have a problem to read the file (for example *.zip) and encrypt it with 3DES, using secretKey which one generated from name of encrypted file. Then I need to decrypt this file, and write it on HDD. I tried to resolve thhis problem, but stuck when was decrypting file. Here is code of encryptor public class Encryptor { private static String inputFilePath = "D:/1.txt"; public static void main(String[] args) { FileOutputStream fos = null; File file = new File(inputFilePath); String keyString = "140405PX_0.$88"; String algorithm = "DESede"; try { FileInputStream fileInputStream = new FileInputStream(file); byte[] fileByteArray = new byte[fileInputStream.available()]; fileInputStream.read(fileByteArray); for (byte b : fileByteArray) { System.out.println(b); } SecretKey secretKey = getKey(keyString); Cipher cipher = Cipher.getInstance(algorithm); cipher.init(Cipher.ENCRYPT_MODE, secretKey); ObjectOutputStream objectOutputStream = new ObjectOutputStream (new CipherOutputStream (new FileOutputStream ("D:/Secret.file"), cipher)); objectOutputStream.writeObject(fileByteArray); objectOutputStream.close(); } catch (Exception e) { e.printStackTrace(); } } public static SecretKey getKey(String message) throws Exception { String messageToUpperCase = message.toUpperCase(); byte[] digestOfPassword = messageToUpperCase.getBytes(); byte[] keyBytes = Arrays.copyOf(digestOfPassword, 24); SecretKey key = new SecretKeySpec(keyBytes, "DESede"); return key; } } And here is code of decryptor public class Decryptor { public static void main(String[] args) { try { File inputFileNAme = new File("d:/Secret.file"); FileInputStream fileInputStream = new FileInputStream(inputFileNAme); FileOutputStream fileOutputStream = new FileOutputStream(outputFilePath); SecretKey secretKey = getKey(keyString); Cipher cipher = Cipher.getInstance(algorithm); cipher.init(Cipher.DECRYPT_MODE, secretKey); ObjectInputStream objectInputStream = new ObjectInputStream (new CipherInputStream(fileInputStream, cipher)); …
type: Question
has answer: http://stackoverflow.com/a/27354179
has title: 3des encrypting/decrypting of file java
accepted answer: http://stackoverflow.com/a/27354179
possible better answer: http://stackoverflow.com/a/27354390
upvote count: 2
has answer: http://stackoverflow.com/a/27354390
answer count: 2
favorite count: 0

http://stackoverflow.com/q/27468382
has title: error with loading screen assetmanager libgdx java
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/43379038
linked to: http://stackoverflow.com/q/27462904
answer count: 0
type: Question
has comment: http://stackoverflow.com/comment/43372605
tagged with: libgdx
tagged with: java
score: 0
has body: I currently have 2 classes, an Assets class and a loading screen class: Assets class: public class Assets { public static AssetManager manager = new AssetManager(); public static void queueLoading() { (..) manager.load("sound/startScreen.mp3", Music.class); (..) while(!manager.update()) { System.out.println("Loaded: " + manager.getProgress() *100 + "%"); } } public static boolean isLoaded() { if(manager.getProgress() &gt;= 1) return true; return false; //return manager.update(); } } Loading screen:: public class LoadingScreen implements Screen{ final Game1 game; Sprite LdScreen; OrthographicCamera camera; public LoadingScreen(Game1 gam){ game=gam; camera = new OrthographicCamera(); camera.setToOrtho(false, 1920, 1080); } public void show() { Texture LdscreenTexture = new Texture(Gdx.files.internal("data/Background.png")); LdScreen = new Sprite (LdscreenTexture); } @Override public void render(float delta) { Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT); camera.update(); game.batch.setProjectionMatrix(camera.combined); game.batch.begin(); game.batch.draw(LdScreen, 0,0); game.batch.end(); Assets.manager.update(); if(Assets.manager.update() == true){ game.setScreen(new MainMenuScreen(game)); System.out.print("test"); } } The problem is this doesn't work, when I run it immediately Assets.manager.update returns true and I get an error saying that the assets are not found for MainMenuScreen, clear as they have not been loaded. And when i comment out game.setScreen(new MainMenuScreen(game)); I get the 'test' written to the console but I don't get the progress to the console from my Assets class. This leads me to think that when I run I the Asset.smanager.update always returns true, and it isn't loading the assets at all. I have looked at tutorials and the wiki, but I have not found them to be useful. Any ideas?

http://stackoverflow.com/q/27330319
type: UnansweredQuestion
upvote count: 1
type: Question
score: 1
tagged with: java
tagged with: eclipse
downvote count: 0
answer count: 1
favorite count: 0
has body: I have a question: I'm dealing with a digitalwatch.sct state chart model right now. When the bottom right pressed for at least 1.5 seconds, the digital watch should switch time editing mode. How can I manage to do it, which kind of strategy or triggered event I should do? The event for the bottom right pressing is "Buttons.bottomRightPressed". Thank you for your help.
has answer: http://stackoverflow.com/a/29784881
has title: switching to time edit mode of digital watch in statechart diagram in eclipse
tagged with: statechart

http://stackoverflow.com/comment/43284448
type: QuestionComment
comment on: http://stackoverflow.com/q/27419438
score: 0
has text: Yes, I think this is the way I have to go. It will get a bit messy when I add perhaps 30 more Objects.
type: Comment

http://stackoverflow.com/a/27424195
has comment: http://stackoverflow.com/comment/43290575
has comment: http://stackoverflow.com/comment/43290969
has body: See the docs: http://docs.spring.io/spring-boot/docs/current/reference/html/howto-logging.html#howto-configure-log4j-for-logging Just change the POM org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter org.springframework.boot spring-boot-starter-logging org.springframework.boot spring-boot-starter-log4j2
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43293888
has comment: http://stackoverflow.com/comment/43292055
answers question: http://stackoverflow.com/q/27424052
upvote count: 2

http://stackoverflow.com/comment/43376939
has text: Thanks, I updated the use case to to be more clear about the fact that we need to dry run the file, track job progress, and allow the customer to view job history and logs. How would you handle this?
type: Comment
comment on: http://stackoverflow.com/a/27470942
score: 0
type: AnswerComment

http://stackoverflow.com/a/27341748
score: 0
has body: Ok, it was pretty obvious in the end, but it took me a while to bridge the gap between sorting out the OAuth2 stuff to get the tokenResponse as in the sample app, and then actually reading data from a Google API. In my case, the key was to find the Javadoc for Google+ API in Google APIs Client Library for Java. Then the rest was easy: GoogleCredential cred = new GoogleCredential().setFromTokenResponse(tokenResponse); Plus plus = new Plus.Builder(TRANSPORT, JSON_FACTORY, cred) .setApplicationName(APPLICATION_NAME).build(); Person person = plus.people().get("me").execute(); List&lt;Emails&gt; emails = person.getEmails(); String name = person.getDisplayName(); String emailAddr = emails.get(0).getValue();
accepted answer of: http://stackoverflow.com/q/27329846
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27329846
type: Answer

http://stackoverflow.com/q/27449035
answer count: 2
has title: Correct way to source code for screen density related product flavors
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/43337981
tagged with: android-studio
score: 2
type: AnsweredQuestion
has body: In Android, there are times when the tablet vs phone version of an app differ to an extent that I need to create entirely separate activities as well as other components for each version. For instance, the home view of my tablet application may have modules within it that are entirely different from those found in the phone application. These differences go beyond configuration qualifiers in layout files. With gradle for Android, there are two methods I have seen for supporting different source code per product flavor. Specifically in an example with phone and tablet product flavors, option 1 seems to be using a package name: phone { packageName "com.ebookfrenzy.buildexample.app.phone" versionName "1.0-phone" } Option two is to instead use source sets to define either additional code, or a whole new source directory: sourceSets { phone { java { srcDir 'src/phone/java' } } } Which option is the correct method? I haven't found anything in Google's documentation and my worry is that if I choose the wrong method, I might miss out on future support for the "correct" method in future Android Studio release.
possible better answer: http://stackoverflow.com/a/27449877
downvote count: 0
has answer: http://stackoverflow.com/a/27449877
tagged with: java
tagged with: gradle
has comment: http://stackoverflow.com/comment/43336959
type: Question
has answer: http://stackoverflow.com/a/27449873
accepted answer: http://stackoverflow.com/a/27449873
upvote count: 2

http://stackoverflow.com/q/27339097
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27891160
has body: I am having trouble with the game of life, my generations are going through but it is doing it incorrectly. I have a generate class which holds the rules of the game and the movement through the generations. A RunActivity which makes the movements through and sends it to a myView class which receives new a 2d array and "paints" it to the screen. MyView has two setPoint methods, one adds points to a 2d array based on a 2d array from gen class, and another which adds points based on touch motions There is also an ontouchlistener which adds a arraylist of points to the generation and a main activity which gets settings for game of life. Here is my most relevant code: package com.example.gameoflife; public class Generate { int dim; int[][] gena; int[][] genb; int a; //public static int[][] genc; public Generate(int size){ this.dim = size; this.gena = new int[dim][dim]; this.genb = new int[dim][dim]; //this.genc = new int[d][d]; } public boolean birth(int parent, int neighbors){ //rules for game of life if ((parent == 0)&amp;&amp;(neighbors == 3)) return true; if ((parent &gt; 0)&amp;&amp;((neighbors == 3)||(neighbors == 2))) return true; return false; } public void grow(){ //puts genb in gena after printing, clears genb for(int r = 0; r &lt; dim; r++){ for(int c = 0; c &lt; dim; c++){ gena[r][c] = genb[r][c]; } } } public void random(){ //randomly fills object with life for(int r = 0; r&lt;gena.length; r++){ for(int c=0; c&lt;dim;c++){ gena[r][c] = (int) (Math.random()*2); } } } public void makelove(){ //nested loop to determine where the cell is, and if it will live in the next generation for(int r = 0; r&lt;dim; r++){ for(int c = 0; c&lt;dim; c++){ a = 0; for (int i = r-1; i &lt;= r+1; i++){ for (int j = c-1; j &lt;= c+1; j++){ if((i &gt;= 0)&amp;&amp;(i &lt; dim)&amp;&amp;(j &gt;= 0)&amp;&amp;(j &lt; dim)&amp;&amp;((i!=r)&amp;&amp;(j!=c))){ if (gena[i][j] &gt; 0) a++; } } } if (birth(gena[r][c], a)) genb[r][c]++; else genb[r][c] = 0; //topleft // if ((r == 0)&amp;&am…
type: Question
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/43134799
score: 0
has title: Game of Life Android Java
has comment: http://stackoverflow.com/comment/43143084
tagged with: android
has comment: http://stackoverflow.com/comment/43134966
has comment: http://stackoverflow.com/comment/43136025
tagged with: conways-game-of-life

http://stackoverflow.com/comment/43317199
type: QuestionComment
has text: If a file wasn't found, the `FileReader` constructor would be throwing `FileNotFoundException`.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27438572

http://stackoverflow.com/q/27318943
has answer: http://stackoverflow.com/a/27318999
score: 0
answer count: 2
has title: this is my first attempt at a java applet. its just a simple square that should move
tagged with: applet
has comment: http://stackoverflow.com/comment/43097366
has body: i paint the square at x,y and then increment x and y in the run method before repainting but the square doesnt move import java.applet.*; import java.awt.*; public class Basics extends Applet implements Runnable{ int x = 0; int y = 0; public void init(){ setSize(500,500); } public void start(){ Thread a = new Thread(); a.start(); } public void stop(){ } public void destroy(){ } public void run(){ while(true){ x++; y++; repaint(); try{ Thread.sleep(18); } catch(InterruptedException e){} } } public void paint(Graphics g){ g.setColor(Color.red); g.fillRect(x,y,25,25); } } however, even if i dont increment x and y and just set a value for them in the run method the square paints at 0,0;
linked to: http://stackoverflow.com/q/6255106
has answer: http://stackoverflow.com/a/27319002
has comment: http://stackoverflow.com/comment/43132371
type: UnansweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/comment/43172373
has text: I tried this and now it is not printing anything at all
type: AnswerComment
comment on: http://stackoverflow.com/a/27360142
score: 0
type: Comment

http://stackoverflow.com/comment/43238535
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27396155
has text: This is duplicate answer

http://stackoverflow.com/q/27345657
has comment: http://stackoverflow.com/comment/43146584
has comment: http://stackoverflow.com/comment/43146720
has comment: http://stackoverflow.com/comment/43146617
has comment: http://stackoverflow.com/comment/43146692
accepted answer: http://stackoverflow.com/a/27345775
answer count: 3
has answer: http://stackoverflow.com/a/27345785
downvote count: 0
tagged with: button
score: 1
favorite count: 0
has title: button_id Cannot be resolved or is not a field
has body: I've been searching about this problem a lot before posting this question but still couldnt get any help,kindly help me in solving this error as im a newbie to this field..!! Main Java Code package com.example.firstapp; import com.example.firstapp.R; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Button button = (Button) findViewById(R.id.button_id); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent i = new Intent(getApplicationContext(),Second.class); startActivity(i); } }); } activity_xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.firstapp.MainActivity" > <requestFocus android:layout_width="wrap_content" /> <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/editText4" android:layout_centerHorizontal="true" android:layout_marginBottom="36dp" android:src="@drawable/robo" android:contentDescription="@null"/> </RelativeLayout> activity_second.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft…
tagged with: android
has comment: http://stackoverflow.com/comment/43146578
tagged with: android-intent
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43146678
possible better answer: http://stackoverflow.com/a/27345774
has answer: http://stackoverflow.com/a/27345775
tagged with: java
has answer: http://stackoverflow.com/a/27345774
upvote count: 1
has comment: http://stackoverflow.com/comment/43146719
type: Question

http://stackoverflow.com/q/27366488
downvote count: 1
type: Question
has title: get skills from linkedin api?
answer count: 2
has body: Probably a simple question but I haven't been able to find any tutorials for this. I'm using the linkedin api in java and implementing it on android. I'm able to get education, position and other information but I'm not sure how to retrieve skills. Here's what I have: private static final String PROFILE_URL = "https://api.linkedin.com/v1/people/~:(id,phone-numbers,headline,educations,positions, skills, recommendations-received)?oauth2_access_token="; public CareerPluginImpl(final ProviderSupport providerSupport) { this.providerSupport = providerSupport; } public Career getCareerDetails() throws Exception { LOG.info("Fetching career details from " + PROFILE_URL); Response serviceResponse = null; try { serviceResponse = providerSupport.api(PROFILE_URL + providerSupport.getAccessGrant().getKey()); } catch (Exception ie) { throw new SocialAuthException( "Failed to retrieve the career details from " + PROFILE_URL, ie); } Element root; try { root = XMLParseUtil.loadXmlResource(serviceResponse.getInputStream()); } catch (Exception e) { throw new ServerDataException( "Failed to parse the career details from response." + PROFILE_URL, e); } Career career = null; if (root != null) { career = new Career(); Education[] educationsArr = null; Position[] positionsArr = null; Recommendation[] recommendationsArr = null; Skill[] skillsArr = null; String headline = XMLParseUtil.getElementData(root, "headline"); career.setHeadline(headline); String id = XMLParseUtil.getElementData(root, "id"); career.setId(id); // get Skills NodeList skills = root .getElementsByTagName("skills"); if (skills != null &amp;&amp; skills.getLength() &gt; 0) { LOG.debug("skills count " + skills.getLength()); skillsArr = new Skill[skills.getLength()]; for (int i = 0; i &lt; skills.getLength(); i++) { Skill skillObj = new Skill(); Element skillEl = (Element) skills.item(i); String sid = XMLParseUtil.getElementData(skillEl, "id"); if (sid != null) { skillObj.setSkillId(sid); } String text = XMLParseUtil.getEleme…
has answer: http://stackoverflow.com/a/27366529
has comment: http://stackoverflow.com/comment/43184927
tagged with: linkedin-api
favorite count: 0
has comment: http://stackoverflow.com/comment/43185046
upvote count: 2
has answer: http://stackoverflow.com/a/29447697
type: UnansweredQuestion
tagged with: android
score: 1
tagged with: java

http://stackoverflow.com/q/27343677
has answer: http://stackoverflow.com/a/27343989
type: AnsweredQuestion
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27343989
has title: Rotate Sprite on creation.
upvote count: 1
type: Question
tagged with: libgdx
possible better answer: http://stackoverflow.com/a/27344735
has answer: http://stackoverflow.com/a/27344735
answer count: 2
downvote count: 0
favorite count: 0
has body: I'm pretty new to this framework and I'm having some troubles rotating an Sprite. I think I'm doing it right but somehow it's not working. This is what I have: I'm using scene2d and I have an Actor called Cube. In the constructor of this cube I generate the texture for an sprite that is a cube doing the following: public Cube(){ sizeOfCube = 40; Pixmap pixmap = new Pixmap(sizeOfCube,sizeOfCube, Pixmap.Format.RGBA8888); pixmap.setColor(Color.BLUE); pixmap.fill(); pixmap.drawRectangle(0,0,sizeOfCube,sizeOfCube); Texture rectangleTexture = new Texture(pixmap); pixmap.dispose(); rectangleSprite = new Sprite(rectangleTexture,0,0,sizeOfCube,sizeOfCube); rectangleSprite.setPosition(Gdx.graphics.getWidth() / 2 - rectangleSprite.getWidth() / 2, Gdx.graphics.getHeight() / 2); rectangleSprite.setOrigin(rectangleSprite.getWidth()/2, rectangleSprite.getHeight()/2); rectangleSprite.rotate(45f); } In the draw method of the actor I have: @Override public void draw(Batch batch, float alpha){ batch.draw(rectangleSprite, rectangleSprite.getX(), rectangleSprite.getY()); } The Sprite is correctly rendered in the screen but there is no rotation at all! It's driving me crazy, I have read multiple places that my code seems to be fine but I can't make it work so there must be something that I'm missing as I'm completely new to this world. Thanks a lot!

http://stackoverflow.com/q/27392633
tagged with: xml-serialization
accepted answer: http://stackoverflow.com/a/27992344
has body: I am stuck with very strange problem with following tech-stack: Weblogic 12c JDK 1.7 Axis2 1.5.2 with integrated JAXB Activity: Upgrading project from Weblogic 10.3.6 to 12.1.1 including JDK upgrade from 1.6 to 1.7 Problem Description: While creating OM Element, JAXB is putting object ID of child object instead of value of parameter under child object. The issue is seen in JDK 1.7 only where as it's working perfect in JDK 1.6 Request.java import java.math.BigInteger; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; /** * Java class for anonymous complex type. * * The following schema fragment specifies the expected content contained within this class. * * * * * * * * * * * * * * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "NumberOfNotes", "NoteData" }) @XmlRootElement(name = "Request") public class Request { @XmlElement(required = true) @XmlSchemaType(name = "nonNegativeInteger") protected BigInteger NumberOfNotes; @XmlElement(name = "NoteData", required = true) protected NoteData NoteData; /** * Gets the value of the NumberOfNotes property. * * @return * possible object is * {@link BigInteger } * */ public BigInteger getNumberOfNotes() { return NumberOfNotes; } /** * Sets the value of the NumberOfNotes property. * * @param value * allowed object is * {@link BigInteger } * */ public void setNumberOfNotes(BigInteger value) { this.NumberOfNotes = value; } /** * Gets the value of the NoteData property. * * @return * possible object is * {@link NoteData } * */ public NoteData getNoteData() { return NoteData; } /** * Sets the value of the NoteData property. * * @param value * allowed object is * {@link NoteData } * */ public void setNoteData(NoteData value) { this.NoteData = value; } } NoteData.java package co…
has title: JAXB With Axis2 Putting Object ID while Serializing
type: AnsweredQuestion
tagged with: java
tagged with: jaxb
type: Question
has answer: http://stackoverflow.com/a/27992344
score: 0
answer count: 1
tagged with: http://stackoverflow.com/tag/xml

http://stackoverflow.com/a/33979424
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/78343653
answers question: http://stackoverflow.com/q/27383357
has body: Actually that was pretty simple (I used Scala, but that doesn't really matter): import java.io.File import org.apache.maven.model.Dependency import org.apache.maven.model.building.{DefaultModelBuilderFactory, DefaultModelBuildingRequest, ModelBuildingRequest} object POMParser { def parse(pomXml: File): List[Dependency] = { val modelBuilder = new DefaultModelBuilderFactory().newInstance() val req = new DefaultModelBuildingRequest() req.setPomFile(pomXml) req.setProcessPlugins(false) req.setValidationLevel(ModelBuildingRequest.VALIDATION_LEVEL_MINIMAL) val model = modelBuilder.build(req).getEffectiveModel import collection.JavaConverters._ model.getDependencies.asScala } } This will return the effective model with all dependencies populated, and all placeholders from the properties of the parent POM file are resolved too. Hope that helps anybody who has the same problem as OP.
upvote count: 1
type: Answer

http://stackoverflow.com/comment/43235374
has text: Thanks. Let's see what i can do.
comment on: http://stackoverflow.com/a/27394081
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43182135
has text: Can you explain a little bit more in detail what the program would do? It sounds interesting and I would like to help, but I frankly didn't fully understand what the program shall do. More examples of input and expected output might be helpful.
type: QuestionComment
score: 2
comment on: http://stackoverflow.com/q/27364998
type: Comment

http://stackoverflow.com/a/27368637
has body: It seems like you're missing the basics of OOP (Object Oriented Programming). Extending a class and creating an instance of that class are not mutually exclusive. Extending a class gives you access to any public or protected properties and methods defined in the parent class. Anything private will not be visible. I think what you may want to look into is extends vs implements. Best of luck getting up to speed.
has comment: http://stackoverflow.com/comment/43189321
has comment: http://stackoverflow.com/comment/43189709
score: 0
answers question: http://stackoverflow.com/q/27368599
type: Answer

http://stackoverflow.com/comment/43274755
has text: such a small changes make a huge difference... I overlooked it.
type: Comment
comment on: http://stackoverflow.com/a/27415287
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43345363
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27452733
has text: You should make `Column<T>` implement `Copyable<Column<T>>` instead of just `Cloneable`.
type: AnswerComment

http://stackoverflow.com/q/27458398
type: Question
linked to: http://stackoverflow.com/q/15560527
accepted answer: http://stackoverflow.com/a/27467733
answer count: 1
downvote count: 0
favorite count: 0
has title: Weird rendering result when JFrame is set as not resizable, but not when it is resizable
type: AnsweredQuestion
tagged with: rendering
score: 1
has body: I'm creating a game and I have a JFrame with a custom Canvas in it. The weird thing is that when I set the JFrame to BE RESIZABLE, the rendering result looks like this: But when I set the JFrame to NOT BE RESIZABLE, the result looks like this: The method which adds the texture's pixel array to the BufferedImage's pixel array looks like this: // DRAW A TEXTURE ON THE CANVAS public void drawTexture(Texture texture, Vector2i location) { // Store the current texture coordinates int tx = 0, ty = 0; // Scroll through each pixel on the screen horizontally (begin at the X coordinate specified by the 'location') for(int x = location.x; (x &lt; getWidth() &amp;&amp; x &lt; location.x + texture.getWidth()); x++) { // Scroll through each pixel on the screen vertically (begin at the Y coordinate specified by the 'location') for(int y = location.y; (y &lt; getHeight() &amp;&amp; y &lt; location.y + texture.getHeight()); y++) { // Set each pixel to the color of the corresponding pixel on the Texture pixels[x + y * getWidth()] = texture.getPixels()[tx + ty * texture.getWidth()]; // Add one to the texture Y coordinate ty++; } // Reset the ty variable ty = 0; // Add one to the texture X coordinate tx++; } } And the BufferedImage is drawn inside of a loop in the run method of my custom canvas. The custom canvas class (extends Canvas offcourse) implements Runnable, and it also contains an own Thread for rendering. I wonder if anyone know why this happens, and maybe how to fix it, because I can't figure it out...
tagged with: java
has answer: http://stackoverflow.com/a/27467733
upvote count: 1

http://stackoverflow.com/comment/43249814
comment on: http://stackoverflow.com/a/27402054
has text: @Gimby Ultimately the Java code that renders the controls will call Win32 API functions, at least on Windows of course. The key is that this GUI framework does not use windowed controls.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27455288
has body: You have to initialize i first: for (int i = 0; i&lt;stackArrayString.length; i++) { valueToBeInserted = valueToBeInserted + "\r\n" + stackArrayString[i]; } for (int i = 0; i&lt;stackArrayInt.length; i++) { valueToBeInserted = valueToBeInserted + "\r\n" + stackArrayInt[i]; }
type: Answer
answers question: http://stackoverflow.com/q/27455126
score: 0

http://stackoverflow.com/comment/43376239
has text: Are you sure this is the code that matches your question? Because it seems to me that it should display the `else` part for each of the items in the list instead of just once, which is a different problem from the one you stated. If it stays blank, I believe the list is simply empty.
score: 1
comment on: http://stackoverflow.com/q/27470665
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43185780
type: QuestionComment
has text: @BlackEye The same problem still exists, the `setPage` method is block the EDT...
comment on: http://stackoverflow.com/q/27366566
score: 0
type: Comment

http://stackoverflow.com/comment/43317785
comment on: http://stackoverflow.com/q/27429509
score: 0
type: QuestionComment
has text: Two tips: don't use `@PropertySource` (I'm not sure it works with YAML and Boot doesn't need it); and don't put `@Profile` on a test case (I think you mean `@ActiveProfiles`).
type: Comment

spark-cassandra-connector
tags question: http://stackoverflow.com/q/27323426
tag name: spark-cassandra-connector
type: Tag

http://stackoverflow.com/a/27346060
score: 0
type: Answer
has body: The correct way to do this is in the draw function, but it makes initialization a little funky.
answers question: http://stackoverflow.com/q/27328936

http://stackoverflow.com/comment/43342866
type: Comment
comment on: http://stackoverflow.com/a/27451492
has text: It requires a reputaiton of 15 in order to do that. Seems like I need my rep to go up a bit :P
type: AnswerComment
score: 0

http://stackoverflow.com/a/27449877
answers question: http://stackoverflow.com/q/27449035
type: Answer
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43339128
has body: you can do this create a new folder of values that is "values-sw600dp" it create a file bool resources and create your folder "values" bool another resource file, you must create a boolean in each such. "values-sw600dp" <resources> true </ resources> "values" <resources> false </ resources> //in your code you must put if (getResources.getBoolean(R.bool.isTablet)) { // Your code for tablet } else { // Your code for smartphone }
downvote count: 0

http://stackoverflow.com/comment/43120208
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27330994
has text: @BoristheSpider, I think that's the whole point with functional interfaces. I think it's not like the `Event` holds the handler itself, it's more like the `Event` holds an anonymous delegate object that implements the functional interface, I don't see anything wrong with that. Actually it seems to me it is very similar to the observer patter itself.
score: 0

http://stackoverflow.com/a/27835327
has body: I just figures this out. first you have to update the server.xml and add readonly=false to: <Resource auth="Container" readonly="false" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" name="UserDatabase" pathname="conf/tomcat-users.xml" type="org.apache.catalina.UserDatabase"/> then in a jsp file: <%!public static boolean changePasswd(String user, String passwd, MBeanServer mbeanServer, JspWriter out) throws Throwable{ try { String userFDN = "Users:type=User,username=\""+user+"\",database=UserDatabase"; ObjectName userObjName = new ObjectName(userFDN); MBeanInfo info = mbeanServer.getMBeanInfo(userObjName); Attribute attr=new Attribute("password",passwd); mbeanServer.setAttribute(userObjName, attr); ObjectName databaseObjName=new ObjectName("Users:type=UserDatabase,database=UserDatabase"); Object result= mbeanServer.invoke(databaseObjName,"save",new Object[0],new String[0]); out.println("Changed password and, Saved: "+result+""); return true; } catch (Throwable t) { out.print("WHY: " + t); } return false; }%> <%MBeanServer mbeanServer = (MBeanServer) list.get(0); //ObjectName obname = new ObjectName( "Catalina:type=Resource,resourcetype=Global,class=org.apache.catalina.UserDatabase,name=\"UserDatabase\"" ); ArrayList list = MBeanServerFactory.findMBeanServer(null); MBeanServer mbeanServer = (MBeanServer) list.get(0); changePasswd("user","passwd",mbeanServer,out); /N
downvote count: 1
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27407985
answers question: http://stackoverflow.com/q/27407985
type: Answer
has comment: http://stackoverflow.com/comment/44076174
has comment: http://stackoverflow.com/comment/44134789
score: 0
has comment: http://stackoverflow.com/comment/44213643
upvote count: 1

http://stackoverflow.com/a/27362239
has comment: http://stackoverflow.com/comment/43176515
score: 1
has body: If ClassTwo extends ClassOne and you make an array of ClassOnes, then you can add objects of ClassTwo to the array, however, you may only access members of ClassOne unless you cast.
answers question: http://stackoverflow.com/q/27362129
has comment: http://stackoverflow.com/comment/43176482
upvote count: 1
type: Answer
downvote count: 0

http://stackoverflow.com/q/27375857
has comment: http://stackoverflow.com/comment/43206974
score: 0
tagged with: jsni
has body: How can I set focus from JSNI method for a field in GWT application that I know its ID? For example suppose I have this method: public native void focusOn(String id) /*-{ $wnd.$("#" + id).focus(); }-*/; This is not working. Are there a solution for this problem?
has comment: http://stackoverflow.com/comment/43234169
answer count: 0
type: UnansweredQuestion
has title: call jquery focus from JSNI method inside GWT
tagged with: gwt
has comment: http://stackoverflow.com/comment/43205683
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43264567
tagged with: javascript

http://stackoverflow.com/q/27461624
score: 0
answer count: 1
has body: I'm trying to port this example shiro-primefaces-example written for glassfish, but I have trobles with the datasource. The example has two config files: glassfish-web.xml: /shiro-primefaces-example jdbc/shiro-primefaces java:app/jdbc/shiro-primefaces <class-loader delegate="false"/> <parameter-encoding default-charset="UTF-8"/> glassfish-resources.xml: <property name="serverName" value="localhost"/> <property name="PortNumber" value="5432"/> <property name="DatabaseName" value="shiro_primefaces"/> <property name="User" value="shiro_primefaces"/> <property name="Password" value="testpass"/> <jdbc-resource pool-name="pool/shiro-primefaces" jndi-name="java:app/jdbc/shiro-primefaces"/> My datasource in standalone.xml is "java:jboss/datasources/mysql". shiro.ini: ... datasource.resourceName = java:jboss/datasources/mysql ... When I try to login I get this error: ... at org.jboss.weld.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40) at org.jboss.weld.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50) at com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:105) at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:87) ... 50 more Caused by: java.lang.NullPointerException at org.example.shiro.bean.security.ShiroLoginBean.doLogin(ShiroLoginBean.java:40) 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) Do you need to create the file jboss-web.xml or something?
has answer: http://stackoverflow.com/a/27466748
accepted answer: http://stackoverflow.com/a/27466748
type: AnsweredQuestion
tagged with: jsf
has title: simple login with shiro wildfly jsf and primefaces
tagged with: java
tagged with: wildfly
type: Question
tagged with: shiro
tagged with: jboss

http://stackoverflow.com/comment/43364895
comment on: http://stackoverflow.com/a/27464249
type: AnswerComment
type: Comment
has text: First thing you'd want to check is determine the exact type of your NFC card. If it's NDEF, then the NDEF_DISCOVERED intent will suffice, otherwise you should also listen for TECH_DISCOVERED intent and provide a corresponding tech list xml.
score: 0

http://stackoverflow.com/a/27389368
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/27389348
accepted answer of: http://stackoverflow.com/q/27389348
has body: You might want to look at string operations for equality. The condition while(calcAgain == "yes") will not execute ever, because you are comparing the object itself. String equality is done with the .equals() function.
type: AcceptedAnswer
upvote count: 3
type: Answer

http://stackoverflow.com/comment/43146549
type: AnswerComment
score: 0
type: Comment
has text: Are they in the root of the jar file?
comment on: http://stackoverflow.com/a/27345486

http://stackoverflow.com/q/27452849
score: 3
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43344500
tagged with: sql
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43344324
linked to: http://stackoverflow.com/q/14433438
upvote count: 3
tagged with: oracle-database
accepted answer: http://stackoverflow.com/a/27453276
favorite count: 0
has body: I am trying to pass List in sql IN but I am getting invalid column type error. Here my SQL looks like: String partyIdSql = "select party_id from myPartySearch where partyId = :id" List&lt;Long&gt; partyIdList = new JdbcTemplate(dataSource) .queryForList(partyIdSql, new Object[] { id }, Long.class); String currentRecordSql = "select * from myTable where someCol IN (:colVal)"; Map&lt;String,Object&gt; params = new HashMap&lt;String, Object&gt;(); params.put("partyIdList", partyIdList); memberInfo = new JdbcTemplate(dataSource) .query(currentRecordSql , new Object[] { params }, new BeanPropertyRowMapper&lt;MyDto&gt;(MyDto.class));
has comment: http://stackoverflow.com/comment/43344464
linked to: http://stackoverflow.com/q/16359316
has answer: http://stackoverflow.com/a/27453276
has title: Passing value to sql IN using JdbcTemplate
tagged with: spring
tagged with: jdbctemplate
type: AnsweredQuestion

http://stackoverflow.com/a/27375728
type: Answer
answers question: http://stackoverflow.com/q/27333281
accepted answer of: http://stackoverflow.com/q/27333281
score: 0
type: AcceptedAnswer
has body: You are declaring Array as: int [] Array = {12,11,10,15,16,17}; and then iterating in: for (int i=0; i&lt; inputData.Array().length;i++){ this means that the values of i are {0,1,2,3,4,5} and x is defined like IloNumVar[6][6][6] when you do: this.x[inputData.Array()[i]] is and error because you dont have indexes {12,11,10,15,16,17} in the x variable.

http://stackoverflow.com/comment/43399789
comment on: http://stackoverflow.com/q/27470579
score: 0
type: Comment
has text: android.permission.ACCESS_NETWORK_STATE?
type: QuestionComment

http://stackoverflow.com/comment/46908788
comment on: http://stackoverflow.com/q/27398578
score: 0
type: QuestionComment
has text: Hi Devin! Yes I solved it. See my answer below. I hope this helps for your project.
type: Comment

http://stackoverflow.com/q/27340575
has title: Cant compile, class not declared Java
score: -1
answer count: 3
has answer: http://stackoverflow.com/a/27340665
has answer: http://stackoverflow.com/a/27340616
upvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/27340665
has comment: http://stackoverflow.com/comment/43137264
possible better answer: http://stackoverflow.com/a/27340603
has answer: http://stackoverflow.com/a/27340603
type: AnsweredQuestion
tagged with: java
has body: I'm trying to do this following program. I deleted the last part of MyRectangle2D in order to shorten it down a bit. When I try to compile I get 2 errors, i just can't work my way through! TestExample.java:17: class GeometricObject2 is public, should be declared in a file named GeometricObject2.java public abstract class GeometricObject2 { TestExample.java:11: cannot find symbol symbol : constructor MyRectangle2D(double,double,double,double) location: class MyRectangle2D GeometricObject2 rectangle1 = new MyRectangle2D(1.0, 2.0, 3.0, 4.0); 2 errors help is much appreciated ! import java.util.*; public class TestExample { public static void main(String[] args) { GeometricObject2 rectangle1 = new MyRectangle2D(1.0, 2.0, 3.0, 4.0); System.out.println(rectangle1.getArea()); } } public abstract class GeometricObject2 { private String color = "white"; private boolean filled; protected GeometricObject2() { } protected GeometricObject2(String color, boolean filled) { this.color = color; this.filled = filled; } public String getColor() { return color; } public void setColor(String color) { this.color = color; } public boolean isFilled() { return filled; } public void setFilled(boolean filled) { this.filled = filled; } public abstract double getArea(); public abstract double getPerimeter(); } class MyRectangle2D extends GeometricObject2 { }
downvote count: 1
type: Question
tagged with: jgrasp

http://stackoverflow.com/a/27414360
has comment: http://stackoverflow.com/comment/43273701
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27414155
score: 0
answers question: http://stackoverflow.com/q/27414155
type: Answer
has body: Why are you using getDimension() to set a value? The reason this is happening is because you must have created a new class of beeColony and while doing that you used the default value of D (set to zero). It would then use this value of D to create the Foods array. This would create a Foods array of size FoodNumber x 0 I would change it as follows: public class beeColony { int D; double Foods[][]=null; public void getDimension(int D) { this.D = D; this.Foods = new double[FoodNumber][D]; } } }

http://stackoverflow.com/comment/43101512
has text: Related: [How can you speed up Eclipse?](http://stackoverflow.com/q/316265/897024)
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27321013
type: Comment

http://stackoverflow.com/q/27395408
tagged with: ant
has title: custom ant build and JavaFX
score: 0
has answer: http://stackoverflow.com/a/27543264
answer count: 2
tagged with: javafx-8
accepted answer: http://stackoverflow.com/a/27543264
has body: with your regular netbeans javaFX project the developer is capable of doing the following -make a javaFX jar file -make a html with javaFX on browser on it -make a jnlp webstart i want to achieve the same output with ant build (inside netbeans IDE), but so far my success is limited to the javaFX jar file only, i'd want to make the html file and jnlp with ant as well i am using netbeans 8.0.2, i have a standard java library (non-javaFX) project, this project contains a single backend and two frontends SWING and javaFX, with ant build script i am successful in producing two separate and self contained jar files which is dssSWING.jar and dssJavaFX.jar, each capable of self extracting the database inside of them and having the third party dependencies embedded on each of the as well, here is the ant code i use to produce both <zipgroupfileset dir="protected/lib" includes="h2-1.4.182.jar"/> <zipgroupfileset dir="protected/lib" includes="commons-csv-1.0.jar"/> <exclude name=".netbeans_automatic_build"/> <exclude name=".netbeans_update_resources"/> <exclude name="mobileView/**"/> <exclude name="Thumbs.db"/> <attribute name="Main-Class" value="desktopView.WelcomePage"/> <zipgroupfileset dir="protected/lib" includes="h2-1.4.182.jar"/> <zipgroupfileset dir="protected/lib" includes="commons-csv-1.0.jar"/> <zipgroupfileset dir="protected/lib" includes="jfxtras-labs-8.0-r4-20141129.090224-39.jar"/> <exclude name=".netbeans_automatic_build"/> <exclude name=".netbeans_update_resources"/> <exclude name="desktopView/**"/> <exclude name="Thumbs.db"/> <attribute name="Main-Class" value="mobileView.Main"/> please don't tell to make it into javaFX project instead (easy way out), i would like to learn the exact ant script to generate the HTML file embedding on the javaFX jar file as well as the jnlp file
type: AnsweredQuestion
tagged with: netbeans
possible better answer: http://stackoverflow.com/a/27529872
tagged with: java
has answer: http://stackoverflow.com/a/27529872
type: Question

http://stackoverflow.com/comment/43367098
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27465512
score: 1
has text: You need to call `t1.start()` instead of `t1.run()`.

concurrency
tag name: concurrency
tags question: http://stackoverflow.com/q/27330347
tags question: http://stackoverflow.com/q/27390281
tags question: http://stackoverflow.com/q/27332481
tags question: http://stackoverflow.com/q/27361215
tags question: http://stackoverflow.com/q/27473144
tags question: http://stackoverflow.com/q/27359112
tags question: http://stackoverflow.com/q/27329203
tags question: http://stackoverflow.com/q/27427110
tags question: http://stackoverflow.com/q/27378527
tags question: http://stackoverflow.com/q/27322856
tags question: http://stackoverflow.com/q/27439706
tags question: http://stackoverflow.com/q/27422121
tags question: http://stackoverflow.com/q/27340279
tags question: http://stackoverflow.com/q/27403155
tags question: http://stackoverflow.com/q/27371211
type: Tag
tags question: http://stackoverflow.com/q/27376952
tags question: http://stackoverflow.com/q/27441232
tags question: http://stackoverflow.com/q/27462465

http://stackoverflow.com/comment/43504106
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27470341
has text: Hi blackSmith: Thanks for the response. That was very helpful.
score: 0

http://stackoverflow.com/comment/43146552
comment on: http://stackoverflow.com/a/27341091
score: 0
type: AnswerComment
type: Comment
has text: Now how could I reverse this? For example, caar ->car

http://stackoverflow.com/q/27422793
has title: Jersey/JAX-RS ExceptionMappers and Inheritance
tagged with: rest
has comment: http://stackoverflow.com/comment/43287834
type: AnsweredQuestion
has body: I'm using Jersey/JAX-RS to implement a RESTful web service. I have a question about the ExceptionMapper interface, which doesn't appear to be documented anywhere. Say I have the following custom (extend RuntimeException) exceptions: FizzException extends RuntimeException BuzzException extends FizzException Now let's say that I want my exception mappers to perform the following Exception-to-Response mappings: FizzException actually maps to an HTTP 404 NOT FOUND BuzzException maps to an HTTP 403 UNAUTHORIZED Everything else maps to an HTTP 500 INTERNAL SERVER ERROR So, if I understand the API correctly, I need to implement 3 different exception mappers: @Provider public class DefaultExceptionMapper implements ExceptionMapper&lt;Exception&gt; { @Override Response toResponse(Exception exc) { // Map to HTTP 500 } } @Provider public class FizzExceptionMapper implements ExceptionMapper&lt;FizzException&gt; { @Override Response toResponse(Exception exc) { // Map to HTTP 404 } } @Provider public class BuzzExceptionMapper implements ExceptionMapper&lt;BuzzException&gt; { @Override Response toResponse(Exception exc) { // Map to HTTP 403 } } However, this has me curious: since we have exception class inheritance going on, which mappers will actually fire? For instance: BuzzException extends FizzException, which ultimately extends Exception. So, if a BuzzException is thrown, which mapper will fire: BuzzExceptionMapper, FizzExceptionMapper or DefaultExceptionMapper? The other way around: when an Exception is thrown, since a BuzzException is, ultimately, an Exception, which mapper fires: BuzzExceptionMapper, FizzExceptionMapper or DefaultExceptionMapper?
accepted answer: http://stackoverflow.com/a/27423477
upvote count: 3
tagged with: java
tagged with: error-handling
has comment: http://stackoverflow.com/comment/43294705
type: Question
tagged with: jersey
has comment: http://stackoverflow.com/comment/43293372
score: 3
has answer: http://stackoverflow.com/a/27423477
downvote count: 0
answer count: 1
tagged with: jax-rs
favorite count: 0

http://stackoverflow.com/q/27371151
tagged with: java
type: Question
tagged with: video-streaming
tagged with: opencv
has answer: http://stackoverflow.com/a/27371262
has comment: http://stackoverflow.com/comment/43218602
possible better answer: http://stackoverflow.com/a/27385082
answer count: 2
has answer: http://stackoverflow.com/a/27385082
downvote count: 0
tagged with: motion
favorite count: 0
accepted answer: http://stackoverflow.com/a/27371262
has comment: http://stackoverflow.com/comment/43237010
has title: How to detect a motion in a video by using openCV
has body: I'm new to OpenCV and I want to detect the actions in a video by using openCV. Let say the video is a cricket match, then I want to detect who is the batmat and who is the bowler by using their motions. Can anyone guide me how can I do this with examples or some related videos. All your comments are highly appreciated.
score: 2
type: AnsweredQuestion
upvote count: 2

http://stackoverflow.com/comment/43387727
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27473734
has text: You are getting 404 because your path to PuchaseCheckOut is not correct. Providee the correct path where your PurchaseCheckOut servlet is located.
score: 0

http://stackoverflow.com/q/27382367
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43214390
tagged with: hadoop
has comment: http://stackoverflow.com/comment/43217969
answer count: 0
has comment: http://stackoverflow.com/comment/43219984
type: Question
has title: How to find last line in a mapreduce job
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43221388
has body: I am processing a .csvfile. I would like to print only my first and last lines. I have accomplished this using normal Java code but, I did not find any Inputformatwhich will read the lines and find first and last line. My Java code is as as below. public class CSVToJSON { public static void main(String[] args) throws ParseException, ClassNotFoundException, FileNotFoundException { File file = new File("/../Desktop/ABCD.txt"); try { BufferedReader csvFile = new BufferedReader(new FileReader("/../Desktop/.csv")); BufferedWriter jsonFile = new BufferedWriter(new FileWriter(file)); InputStream inputStream = new ByteArrayInputStream(jsonNew.getBytes(StandardCharsets.UTF_8)); jsonFile.write(jsonNew); jsonFile.newLine(); String next, fileContent = csvFile.readLine(); for (boolean first = true, last = (fileContent == null); !last; first = false, fileContent = next) { last = ((next = csvFile.readLine()) == null); if (first) { String[] tab = fileContent.split(","); String line = "[" + tab[2] + "," + tab[3] + "," + tab[8] + "," + tab[11] + "," + tab[15] + "," + tab[16] + "],"; InputStream inputStreamNew = new ByteArrayInputStream(line.getBytes(StandardCharsets.UTF_8)); jsonFile.write(line); jsonFile.newLine(); }else if (last) { String[] tab = fileContent.split(","); String lineLast = "[" + tab[2] + "," + tab[3] + "," + tab[8] + "," + tab[11] + "," + tab[15] + "," + tab[16] + "]" + "\n" + "]; InputStream inputStreamNewLine = new ByteArrayInputStream(lineLast.getBytes(StandardCharsets.UTF_8)); jsonFile.write(lineLast); jsonFile.newLine(); }else { String[] tab = fileContent.split(","); String line = "[" + tab[2] + "," + tab[3] + "," + tab[8] + "," + tab[11] + "," + tab[15] + "," + tab[16] + "],"; inputStream inputStreamNormalLine = new ByteArrayInputStream(line.getBytes(StandardCharsets.UTF_8)); jsonFile.write(line); jsonFile.newLine(); } } csvFile.close(); jsonFile.close(); } catch (FileNotFoundException e) { Logger.getLogger(CSVToJSON.class.getName()).log(Level.SEVERE, null, e);…

http://stackoverflow.com/a/27324412
type: Answer
score: 0
has body: I think you need to convert the filePath stored in your FileArray to a Bitmap first... Bitmap bitmap = BitmapFactory.decodeFile(listFile[position].getAbsolutePath()); imageView.setImageBitmap(bitmap);
answers question: http://stackoverflow.com/q/27324189

http://stackoverflow.com/comment/43112860
has text: I read the link you sent me but it seems really confusing to me. I'm really new to Java so I'm not really code efficient if you know what I mean. If you or anyone could create an example based off the information I put down and explain it to me that would be really helpful. I'm a visual learner basically.
comment on: http://stackoverflow.com/q/27326847
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43190948
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27369584
type: Comment
has text: Related: http://stackoverflow.com/q/3697988/3651800

weblogic8.x
tag name: weblogic8.x
tags question: http://stackoverflow.com/q/27451982
type: Tag

http://stackoverflow.com/comment/68195506
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27431819
type: Comment
has text: When importing the client cer into server keystore, do I need to specify the same clientAlias as when it's exported?

http://stackoverflow.com/q/27393304
tagged with: java
type: Question
has title: Custom Polygon not drawing correctly
tagged with: vertices
tagged with: polygon
tagged with: vector
linked to: http://stackoverflow.com/q/15556929
upvote count: 1
has body: I'm currently designing a custom polygon using OpenGL in Java. I have defined the vertices and double checked the vertices being correct. I've done a test and can see the correct design I want when displaying the LINE. But, when I display as FILL the cross like shape does NOT appear to be a cross lined shaped. I've defined the vertices 1-16. 1 starting from the bottom of the design (See Image). I then called the vectors anti-clockwise. The imagine showing the Line is what I wanted to draw, have a look at the vertex dots to see how I coordinated it. The polygon is the only thing which is not showing correctly Screen Shots LINE: DOT: FILL: CODE // DECLARED VARIABLE Vertex v1 = new Vertex(0.0f, -5.0f, 0.0f); Vertex v2 = new Vertex(0.5f, -4.0f, 0.0f); Vertex v3 = new Vertex(0.5f, -0.5f, 0.0f); Vertex v4 = new Vertex(4.0f, -0.5f, 0.0f); Vertex v5 = new Vertex(5.0f, 0.0f, 0.0f); Vertex v6 = new Vertex(4.0f, 0.5f, 0.0f); Vertex v7 = new Vertex(0.5f, 0.5f, 0.0f); Vertex v8 = new Vertex(0.5f, 4.0f, 0.0f); Vertex v9 = new Vertex(0.0f, 5.0f, 0.0f); Vertex v10 = new Vertex(-0.5f, 4.0f, 0.0f); Vertex v11 = new Vertex(-0.5f, 0.5f, 0.0f); Vertex v12 = new Vertex(-4.0f, 0.5f, 0.0f); Vertex v13 = new Vertex(-5.0f, 0.0f, 0.0f); Vertex v14 = new Vertex(-4.0f, -0.5f, 0.0f); Vertex v15 = new Vertex(-0.5f, -0.5f, 0.0f); Vertex v16 = new Vertex(-0.5f, -4.0f, 0.0f); // Draw Vertices anti clockwise GL11.glBegin(GL11.GL_POLYGON); { v1.submit(); v2.submit(); v3.submit(); v4.submit(); v5.submit(); v6.submit(); v7.submit(); v8.submit(); v9.submit(); v10.submit(); v11.submit(); v12.submit(); v13.submit(); v14.submit(); v15.submit(); v16.submit(); } GL11.glEnd(); I would really appreciate if someone can help me out. I'm sensing that I'm missing something out.
favorite count: 0
has comment: http://stackoverflow.com/comment/43234471
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/15556929
answer count: 0
downvote count: 0
tagged with: opengl
score: 1

http://stackoverflow.com/q/27344693
has comment: http://stackoverflow.com/comment/43144728
accepted answer: http://stackoverflow.com/a/27344811
possible better answer: http://stackoverflow.com/a/27344765
has comment: http://stackoverflow.com/comment/43148387
has answer: http://stackoverflow.com/a/27344811
has comment: http://stackoverflow.com/comment/43144857
has comment: http://stackoverflow.com/comment/43144683
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27344765
has body: public static void main(String[] args) throws IOException { Scanner in = new Scanner(new FileReader( "/input5.txt")); input5.txt is the text file from which I read the input. BufferedReader is = new BufferedReader(new FileReader "/input5.txt")); int wordcount = 0;//counter int i = 0;//each character of input boolean hasChar = true;//flag for has Character while (in.hasNextLine()) { // while input exists String a = in.nextLine();//get next line while (i &lt; a.length()) {// get each char if (a.charAt(i) == ' ') {// blank space does not count in word count hasChar = false; }// does not work else { wordcount++;// count words } i++;//get each char } } System.out.println("The word count is " + wordcount);// print wordcount System.out.println(""); String line;// echo print the input file while ((line = is.readLine()) != null) { System.out.println("Echo print of the file: " + line); } in.close(); } That's my code. The Input file includes this Aiwegfu24r;q0912j 129puehilhwueildgyuol The second line of code is not counted for in the word count. How may I fix this with while loops only? Please do not give me the answer but rather guide me.
has title: Create word-count application that accounts for multiple lines of text in an input file
answer count: 2
has comment: http://stackoverflow.com/comment/43144680
has comment: http://stackoverflow.com/comment/43144842
has comment: http://stackoverflow.com/comment/43144684
score: 0
tagged with: while-loop
has comment: http://stackoverflow.com/comment/43144954

http://stackoverflow.com/a/27376055
has body: According to the documentation http://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html, Letter Date or Time Component Presentation Examples z Time zone General time zone Pacific Standard Time; PST; GMT-08:00 Z Time zone RFC 822 time zone -0800 X Time zone ISO 8601 time zone -08; -0800; -08:00 you are supposed to use small z instead of capital Z for the general time zone. However, I tried it (Java SE 1.8.0) and it works both with z as well as Z for me. As Android007 wrote as a comment: "In Java app its working fine but on Android giving exception" - it may be that your library implements the contract more thoroughly than the standard Oracle J2SE :) See also here: https://stackoverflow.com/a/2581073/2886891
type: Answer
answers question: http://stackoverflow.com/q/27375489
score: 0

http://stackoverflow.com/comment/43733194
has text: @yunandtidus The post request is being made from Java.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27414922
score: 0

http://stackoverflow.com/comment/43111853
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27326123
type: Comment
has text: That is exactly what I have did. Thank you for helping me with the problem!

http://stackoverflow.com/q/27451255
has body: I am playing around with Spring Boot and have something that I don't quite get. I have 2 @Controllers in my application, and the second one is not really picking up REST calls, Thymeleaf is jumping on the requests instead. Basically what I have is: @Configuration @ComponentScan @EnableAutoConfiguration public class Application { public static void main(String[] args) throws Throwable { SpringApplication.run(Application.class, args); } } Then @Configuration @EnableWebMvcSecurity @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled=true) public class SecurityConfig extends WebSecurityConfigurerAdapter { @Autowired Environment env; @Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests() .antMatchers("/", "/home").permitAll() .antMatchers("/webjars/**").permitAll() .antMatchers("/console/**").permitAll() .antMatchers("/resources/**").permitAll() .anyRequest().authenticated(); http.formLogin().loginPage("/login").permitAll().and().logout() .permitAll(); http.csrf().disable(); // for angularjs ease http.headers().frameOptions().disable(); //for H2 web console } } And @Configuration public class WebMvcConfig extends WebMvcConfigurerAdapter { @Override public void addViewControllers(ViewControllerRegistry registry) { registry.addViewController("/home").setViewName("home"); registry.addViewController("/").setViewName("home"); registry.addViewController("/hello").setViewName("hello"); registry.addViewController("/login").setViewName("login"); } @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/public/**").addResourceLocations("classpath:/public/"); registry.addResourceHandler("/resources/**").addResourceLocations("classpath:/resources/"); } } And the two controllers. This one works, so it is picking up my call from a simple AngularJS client and responds: @Controller @RequestMapping("/foo") public class MyController { @RequestMapping(method = RequestMethod.GET) @Respons…
tagged with: spring
type: Question
tagged with: spring-mvc
has title: Spring Boot, Thymeleaf and @Controller
type: AnsweredQuestion
tagged with: spring-boot
has answer: http://stackoverflow.com/a/27453053
tagged with: java
accepted answer: http://stackoverflow.com/a/27453053
downvote count: 0
answer count: 1
score: 6
favorite count: 0
upvote count: 6

http://stackoverflow.com/q/27369328
has body: I'm trying to print an array via toString() so I can call it to another method. What exactly am I doing wrong? Why isn't it compiling and what is a better solution. public class Applicants { private String applicant[]; public Applicants() { Application student1 = new Application() Application student2 = new Application() Application student3 = new Application() Application student4 = new Application() Application student5 = new Application() Application student6 = new Application(); Application applicant[] = new Application[5]; applicant[0] = student1; applicant[1] = student2; applicant[2] = student3; applicant[3] = student4; applicant[4] = student5; applicant[5] = student6; for (int index = 0; index &lt; applicant.length; index++) { System.out.println(applicant[index]); } } public String toString(String[] applicant) { String output = new String(); String total; for (int index = 0; index &lt; applicant.length; index++) { total = System.out.println(applicant[index]); } return total; } }
has answer: http://stackoverflow.com/a/27369470
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43190404
has comment: http://stackoverflow.com/comment/43190401
has answer: http://stackoverflow.com/a/27369396
has comment: http://stackoverflow.com/comment/43190461
downvote count: 3
score: -3
has comment: http://stackoverflow.com/comment/43190411
has comment: http://stackoverflow.com/comment/43190422
type: Question
tagged with: tostring
tagged with: java
has title: How do I print my an array in a toString() method?
answer count: 2
upvote count: 0
tagged with: arrays

http://stackoverflow.com/a/27384053
upvote count: 1
has comment: http://stackoverflow.com/comment/43216786
has comment: http://stackoverflow.com/comment/43216873
has body: one thing, when you say API, you should refer to an Interface. Your approach is very clean, hope that this services, both, implement the same interface.
answers question: http://stackoverflow.com/q/27383780
has comment: http://stackoverflow.com/comment/43216943
downvote count: 0
score: 1
type: Answer

http://stackoverflow.com/a/27441006
has body: The problem is in the Intent creation (you didn't post that code). I think that you created the intent in this way: Intent intent = new Intent(this, Menu.class); but in at the beginning you likely imported: android.view.Menu instead of using com.fyp.e_attendance.Menu
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43380789
upvote count: 1
answers question: http://stackoverflow.com/q/27433154
type: Answer

http://stackoverflow.com/comment/43272567
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27414239
score: 0
has text: @APerson Yes it does, I just had that there to confirm that the number was truly random. I was using that in the Thread.sleep() method to make time when the you have to click the button random.

http://stackoverflow.com/q/27407920
tagged with: java
has comment: http://stackoverflow.com/comment/43276109
has comment: http://stackoverflow.com/comment/43275216
type: Question
has title: How do I generate keyboard events that don't have key code in Java?
score: 5
has body: I'm using Robot class and KeyEvent key codes to generate all the other key events and they work fine, but I also need Hangul key(toggle Korean keyboard). Apparently KeyEvent does not have a key code for this key, so I'm stuck :( Is there a way to generate this Hangul key event? Is there a way to use the Windows' key code like VK_HANGUL (0x15) instead of the KeyEvent key codes? If that's possible changing all the key codes wouldn't be a problem... Or somehow take the key event once and store it permanently somewhere and use that forever...??? What I am trying to do is creating an onscreen keyboard that has numbers, alphabets and Korean. Click on an icon and it will generate the key event of the corresponding letter so the letter is typed. (Everything except switching to Korean is working properly.) Being able to generate the Hangul key event would be nice but if that's not possible, is there any suggestions on how I could achieve this? Maybe I could bind each Korean letter with corresponding alphabet on keyboard(for example g is ㅎ on conventional keyboards that have both Eng and Korean) or something but then how do I send it to other applications? Sorry if this question is so all over the place. I'm just really lost.
linked to: http://stackoverflow.com/q/15605109
linked to: http://stackoverflow.com/q/14595483
has comment: http://stackoverflow.com/comment/43275383
has comment: http://stackoverflow.com/comment/43276309
answer count: 1
linked to: http://stackoverflow.com/q/397113
favorite count: 0
has answer: http://stackoverflow.com/a/27447022
upvote count: 5
type: UnansweredQuestion
tagged with: utf
has comment: http://stackoverflow.com/comment/43266340
tagged with: keyevent
has comment: http://stackoverflow.com/comment/43276404
downvote count: 0
has comment: http://stackoverflow.com/comment/43275607

http://stackoverflow.com/a/27428213
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: Yeah, sort of surprising that it wasn't added until API 19. You could just define a utility method some where that iterates over the source object, and adds all elements to the new object (except for the specified index). Something like this: public static JSONArray removeJsonObjectAtJsonArrayIndex(JSONArray source, int index) throws JSONException { if (index &lt; 0 || index &gt; source.length() - 1) { throw new IndexOutOfBoundsException(); } final JSONArray copy = new JSONArray(); for (int i = 0, count = source.length(); i &lt; count; i++) { if (i != index) copy.put(source.get(i)); } return copy; }
upvote count: 4
accepted answer of: http://stackoverflow.com/q/27427999
score: 4
answers question: http://stackoverflow.com/q/27427999

http://stackoverflow.com/comment/43242830
has text: The second servlet, WiCode which is something i don't want to run on request basis, that's why i didn't put mapping..Acutally i need it to run as a background thread..
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27398533
score: 0

http://stackoverflow.com/comment/43322650
comment on: http://stackoverflow.com/a/27441554
score: 0
type: AnswerComment
has text: This is not what was asked for.
type: Comment

http://stackoverflow.com/a/27546453
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/27457841
has comment: http://stackoverflow.com/comment/43627751
has body: Try this: when creating a new android application use "Empty Activity" instead of "Blank Activity". This will fix the problem immediately.
score: 0
type: Answer

eclipse-luna
tags question: http://stackoverflow.com/q/27369772
tags question: http://stackoverflow.com/q/27332328
tags question: http://stackoverflow.com/q/27343253
tags question: http://stackoverflow.com/q/27314896
tags question: http://stackoverflow.com/q/27398120
tags question: http://stackoverflow.com/q/27337936
tag name: eclipse-luna
tags question: http://stackoverflow.com/q/27443028
type: Tag
tags question: http://stackoverflow.com/q/27383093

http://stackoverflow.com/a/27467215
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/43370267
has body: In any case you probably want to flush() your output (done implicitly by close()), but with BufferedOutputStream this is even more important than with a other OutputStreams. If you have a FileOutputStream, the only buffering performed is that of the OS. If you have a BufferedOutputStream, Java performs its own buffering on top of it. If you use Java 7 or newer, I'd recommend to write the code like this: try (BufferedInputStream bIn = new BufferedInputStream(in); BufferedOutputStream bOut = new BufferedOutputStream(new FileOutputStream(fileName))) { for (int read; ((read = bIn.read()) != -1; ) bOut.write(read); } In your case I suspect you were closing the FileOutputStream but not the BufferedOutputStream. Therefore the file was truncated or even empty because the data buffered in the BufferedOutputStream was not flushed.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27467174
has comment: http://stackoverflow.com/comment/78107032

http://stackoverflow.com/a/27374234
has comment: http://stackoverflow.com/comment/51214933
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27351412
downvote count: 0
type: Answer
has body: Not sure if this helps, but maybe FIT_TO_PAGE_SIZE is causing your trouble. In my Java program, I'm using these settings instead (and the reports are using a fixed layout): pdfOptions.setOption(IPDFRenderOption.PAGE_OVERFLOW, IPDFRenderOption.OUTPUT_TO_MULTIPLE_PAGES); // Dafür sorgen, dass Texte nicht abgeschnitten werden, sondern umgebrochen: pdfOptions.setOption(IPDFRenderOption.PDF_TEXT_WRAPPING, true); pdfOptions.setOption(IPDFRenderOption.PDF_HYPHENATION, true);
score: 2
answers question: http://stackoverflow.com/q/27351412
upvote count: 2

http://stackoverflow.com/a/27468732
answers question: http://stackoverflow.com/q/27468716
has comment: http://stackoverflow.com/comment/43372748
has comment: http://stackoverflow.com/comment/43372936
type: Answer
has comment: http://stackoverflow.com/comment/43372892
has comment: http://stackoverflow.com/comment/43372776
has body: I suggest you to use the session. Note that there is a plugin named JQuery session plugin, available from here Tutorials links : Lassosoft weschools
score: 0

http://stackoverflow.com/comment/43121291
type: Comment
has text: to be honest i think my teacher would flatline if she saw or attempted this lol
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27331204

http://stackoverflow.com/a/27369219
upvote count: 1
answers question: http://stackoverflow.com/q/27369075
accepted answer of: http://stackoverflow.com/q/27369075
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: If you just want the user to be able to search for a name, then use this: String entered; while(true) { entered = input.nextLine(); if(entered.equalsIgnoreCase("exit")) break; for(int i = 0; i &lt; nameArray.length; i++) { if(entered.equals(nameArray[i])) { System.out.println("Name: " + nameArray[i] + "\tTime: " + resultArray[i]); } } }
score: 1

http://stackoverflow.com/a/34449648
type: Answer
score: 3
upvote count: 3
answers question: http://stackoverflow.com/q/27352672
has comment: http://stackoverflow.com/comment/68773155
has body: Since your are using JDK1.7, change to the older version will work! org.json json 20140107 </dependency>
downvote count: 0

http://stackoverflow.com/a/27462629
answers question: http://stackoverflow.com/q/27459207
type: Answer
upvote count: 4
downvote count: 0
score: 4
type: AcceptedAnswer
has body: @Resource only works in Tomcat when you set up a resource in your container. Here's a reference for your own sake: http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html It expects that you're binding a JNDI entry called "connectionProvider" in Tomcat. CDI does not bind elements to JNDI, it has its own internal mapping of objects to scopes. @Inject works here as you likely have not setup a resource for this class in your resource configuration.
accepted answer of: http://stackoverflow.com/q/27459207

http://stackoverflow.com/q/27431224
tagged with: java
has answer: http://stackoverflow.com/a/27555628
tagged with: eclipse
type: Question
answer count: 2
tagged with: ide
score: 0
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has body: error retrieving parent for item Theme.appcompat.light.darkactionbar. Tried all the method like "File->Import (android-sdk\extras\android\support\v7). Choose "appcompat" Project-> properties->Android. In the section library "Add" and choose "appCompat"" "-In Properties -> Android add the library, but uncheck "IsLibrary”. -In Android -> Project build tarjet check Android 4.0. -In "Java Build Path" -> Order and Export -> Unchecked the .jar library -Finally do a “Project -> Clean” both projects " You should reinstall your Android Support Library by Android SDK Manager to get the complete android supportV7 library. The mediarouter library project dependency on the appcompat library project. So,after you have finished Step 1, you can follow Android Support Library v7: Error retrieving parent for item to fix this problem. Still the error is not going...what would be the reason.help me upon this guys
has title: error retrieving parent for item theme.appcompat.light.darkactionbar
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27432282

sbt
tags question: http://stackoverflow.com/q/27333909
tags question: http://stackoverflow.com/q/27461385
tag name: sbt
type: Tag
tags question: http://stackoverflow.com/q/27331769

http://stackoverflow.com/a/27345248
answers question: http://stackoverflow.com/q/27344989
type: AcceptedAnswer
downvote count: 0
has body: In past experience, the JVM will not attempt to compile a class until needed. If a class refers to another class then that other class will also be compiled. Where it is located in the classpath, Jar A or Jar B is not relevant to compilation. Despite the long history of changes to how things work in the JVM, I think this is still true today. Classes like System are pretty central, so they will end up being compiled pretty much straight away. JVM startup time isn't as bad as many make it out to be, but that doesn't mean that the applications that they're running have good startup time. In the traditional JIT (the client VM), the JVM would only ever execute code that had been JIT compiled, and it did not need to compile the entire application to begin execution (JIT stands for Just in Time). The JIT compiler produced decent executable code, but not great executable code. Then hotspot came along (the server VM). The JVM would begin by interpreting bytecode and also begin analyzing conditions at runtime to figure out what to compile. Because it did not need to compile code to run it, it could begin execution more quickly, and since it did not need to wait for compilation and because it was aware of runtime conditions, it could afford to be more aggressive with optimizations. So the hotspot compiler produces faster code. The downside is that in the beginning it executed more slowly because it was executing interpreted code. Hotspot continues to analyze after compilation so methods that get called a lot (hotter ones), can be compiled again with yet more aggressive optimizations. For a long time, the JVM would start by default in client mode, and you had to explicitly start it in server mode. Some JRE's did not even ship with a server mode (e.g. windows) though their corresponding JDK's did. As machines got more powerful this did not make sense any more, so the JVM would use some heuristics to figure out if it should start in server mode or client mode. Then, beginning in …
type: Answer
accepted answer of: http://stackoverflow.com/q/27344989
has comment: http://stackoverflow.com/comment/43174375
has comment: http://stackoverflow.com/comment/43172117
has comment: http://stackoverflow.com/comment/43161303
score: 3
upvote count: 3
has comment: http://stackoverflow.com/comment/43174592
has comment: http://stackoverflow.com/comment/43176772

http://stackoverflow.com/q/27436917
tagged with: jssc
has comment: http://stackoverflow.com/comment/43314826
tagged with: java
possible better answer: http://stackoverflow.com/a/27829529
has comment: http://stackoverflow.com/comment/43314856
has comment: http://stackoverflow.com/comment/43454315
accepted answer: http://stackoverflow.com/a/27511911
has title: How to Create virtual serial port using java
type: AnsweredQuestion
has body: I had tried with TelnetSerialPort and jSSC library to create virtual sertial port but wont work.it not create Virtual serial port, it use existing serial port for communication. This one my programm using jSSc library public class VirtualSerialPort { /** * @param args the command line arguments */ public static void main(String[] args) { SerialPort serialPort = new SerialPort("COM12"); try { System.out.println("Port opened: " + serialPort.openPort()); System.out.println("Params setted: " + serialPort.setParams(9600, 8, 1, 0)); System.out.println("\"Hello World!!!\" successfully writen to port: " + serialPort.writeBytes("Hello World!!!".getBytes())); System.out.println("Port closed: " + serialPort.closePort()); } catch (SerialPortException ex) { System.out.println(ex); } } } it gives following output Port opened: false jssc.SerialPortException: Port name - EMPTY; Method name - setParams(); Exception type - Port not opened.
tagged with: virtual-serial-port
type: Question
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/43319476
has comment: http://stackoverflow.com/comment/43314851
has answer: http://stackoverflow.com/a/27829529
has comment: http://stackoverflow.com/comment/43321065
has answer: http://stackoverflow.com/a/27511911

http://stackoverflow.com/comment/43374497
has text: @codefoodgirl_99 Yes they **do** something (and this is why your search didn't work).
type: AnswerComment
comment on: http://stackoverflow.com/a/27469742
score: 0
type: Comment

http://stackoverflow.com/comment/43389835
comment on: http://stackoverflow.com/a/27473178
type: Comment
score: 0
has text: @PatrickGarner [`Instance#select(..)`](http://docs.jboss.org/cdi/api/1.0/javax/enterprise/inject/Instance.html#select(java.lang.annotation.Annotation...)) is a way to imitate annotation based injection. You pass a type of the injection target and instances of annotations that describe that target. That's what I meant by _you want to inject some functionality that only exists when processing annotations_. (Perhaps the _only_ was misleading.)
type: AnswerComment

http://stackoverflow.com/q/27344005
has title: html draw submit form in the same form using switch() JS
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has body: I am new in programming and I need to make a DB insert using jsp. My probem is that I have my page with choose option (see img), and when I press "Display form to insert" button I want to have in the same page the rows (enter name and enter adresse) for this table from my DB. the used code is: Choose Table Name : univer client company departament employee person promotion service subsidiary
accepted answer: http://stackoverflow.com/a/27345870
type: AnsweredQuestion
tagged with: java
tagged with: servlets
type: Question
tagged with: jsp
tagged with: javascript
score: 0
has answer: http://stackoverflow.com/a/27345870

http://stackoverflow.com/q/27345395
has comment: http://stackoverflow.com/comment/43146389
has title: Screen Size and Image Aren't Functioning Correctly
has comment: http://stackoverflow.com/comment/43146689
has comment: http://stackoverflow.com/comment/43155430
has comment: http://stackoverflow.com/comment/43146103
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43146579
type: Question
has comment: http://stackoverflow.com/comment/43146305
tagged with: dimension
has comment: http://stackoverflow.com/comment/43147286
has body: As I final for my Computer Sciences class we could either teach a lesson in Java or some sort of big project. I used an existing pokemon java engine and am building my game around that. The problem that I am running into is that it isn't the correct size (160,144) and the image won't show up unless you re-size the frame. If anyone has any ideas why that'd be great. Also the paths for the pictures are correct it just won't let me post them for some reason. import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Image; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.geom.AffineTransform; import javax.swing.JFrame; import javax.swing.JPanel; public class AnotherIdea { public static class Engine extends JPanel implements KeyListener, ActionListener { public static JFrame jf; public Toolkit tk = jf.getToolkit(); private Image titlescreen = tk.createImage("F:\\Votech Final\\Welcome to Nightvale\\anotherIdea\\src\\Resources\\Tittle.png"); private Image start_symbol = tk.createImage("F:\\Votech Final\\Welcome to Nightvale\\anotherIdea\\src\\Resources\\Start.png"); private boolean atTitle = true; private boolean atContinueScreen = false; private boolean start_visible = true; private boolean gamestarted = false; private int offsetX = 0, offsetY = 0; private int TILE_WIDTH_PIXELS = 32; private int TILE_HEIGHT_PIXELS = 32; private int concurrentMenuItem = 0; public long seconds = 0; public long oldTime; public long minutes = 0; public long hours = 0; public void paintComponent(Graphics g){ super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; AffineTransform at = new AffineTransform(); g2.setTransform(at); if (atTitle == true) { g.drawImage(titlescreen,0,0,null); if (start_visible == true) { g.drawImage(start_symbol,0,260,null); } } } public void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); if (…
score: 0
has comment: http://stackoverflow.com/comment/43146339
has comment: http://stackoverflow.com/comment/43146493

http://stackoverflow.com/q/27470499
tagged with: initialization
favorite count: 0
has answer: http://stackoverflow.com/a/27470860
tagged with: static
has title: what does static initializer with no assignment mean?
type: UnansweredQuestion
upvote count: 1
has answer: http://stackoverflow.com/a/27470520
has comment: http://stackoverflow.com/comment/43375899
score: 1
tagged with: java
has body: I saw this post static initializer. It is used to provide non-trivial initialization for static variables of your class Then I saw this code: public class CommandFactory { private CommandFactory() { } static { new CommandFactory(); } What's the purpose of it? (as there is no assignment to any field)
has comment: http://stackoverflow.com/comment/43375909
type: Question
linked to: http://stackoverflow.com/q/12024095
downvote count: 0
has comment: http://stackoverflow.com/comment/43376667
answer count: 3
has answer: http://stackoverflow.com/a/27470515

http://stackoverflow.com/comment/43165831
has text: @RahulPatidar i have only one Linearlayout(vertical), i need to add dynamically horizontal layout when checkbox item in each row == 3
comment on: http://stackoverflow.com/q/27356353
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27364837
has title: Java - Printing format with super class
has comment: http://stackoverflow.com/comment/43181742
tagged with: java
upvote count: 1
downvote count: 1
has body: The printout of my MediaCollection is not in format that I want it to be. When I print MediaCollection details from a file it does show this: Where I rather want it to show something like that: This is my super class public class MediaFormat { public String title; public int releaseDate; public double price; public MediaFormat(String title, int releaseDate, double price) { this.title = title; this.releaseDate = releaseDate; this.price = price; } /** * Change the title. */ public void changeTitle(String title) { this.title = title; } /** * Change Release Date. */ public void changeReleaseDate (int releaseDate) { this.releaseDate = releaseDate; } /** * Return Price of a CD or DVD. */ public double getPrice() { return price; } public String toString() { return ("\n" + "Title - " + title + "\n" + "Release Date - " + releaseDate + "\n" + "Price - " + price + "\n"); } } This is my CD Class public class CD extends MediaFormat { // Defining variables public String artist; public int playingTime; public int nuOfTracks; /** * Create new constructor for CD object, with all appropriate details. */ public CD(int releaseDate, String title, String artist, int playingTime, int nuOfTracks, double price) { super(title, releaseDate, price); this.artist = artist; this.playingTime = playingTime; this.nuOfTracks = nuOfTracks; } /** * Change the Artista Name. */ public void changeArtist(String Artist) { this.artist = artist; } /** * Change Playing Time Duration. */ public void changePlayingTime(int playingTime) { this.playingTime = playingTime; } /** * Change the number of tracks. */ public void changenuOfTracks(int nuOfTracks) { this.nuOfTracks = nuOfTracks; } public String toString() { String additionals = super.toString(); return additionals + ("\n" + "Artist - " + artist + "\n" + "Playing Time - " + playingTime + "min" + "\n" + "nuOfTracks - " + nuOfTracks + "\n"); } } This is my DVD class public class DVD extends MediaFormat { public String director; public String rating; public int …
type: Question
has comment: http://stackoverflow.com/comment/43182528
has comment: http://stackoverflow.com/comment/43181819
tagged with: bluej
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43181972
favorite count: 0
has comment: http://stackoverflow.com/comment/43181835
has answer: http://stackoverflow.com/a/27365638
has comment: http://stackoverflow.com/comment/43182258
accepted answer: http://stackoverflow.com/a/27365638
type: AnsweredQuestion

http://stackoverflow.com/comment/43114269
has text: Ok I left the part that I need help. If the user puts 5 rows and 5 columns that program shoudl diplay a array with 5 columns and 5 rows
type: QuestionComment
comment on: http://stackoverflow.com/q/27327488
score: 0
type: Comment

http://stackoverflow.com/comment/43360436
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27461667
score: 0
has text: Thanks for providing the link, it answers my question.

http://stackoverflow.com/comment/43255997
type: Comment
type: QuestionComment
has text: The problem is i know what is wrong with the broken code, it is unfixable because it is drawing to the wrong jframe thats not the problem i would like to know where to go from here, how can i modify g in later methods?
comment on: http://stackoverflow.com/q/27405543
score: 0

http://stackoverflow.com/comment/79571252
type: AnswerComment
comment on: http://stackoverflow.com/a/27410844
has text: I read the second block ("alternative, just the `@JsonPOJOBuilder`") as meaning I could do that **instead** of, rather than **in addition to** the `@JsonDeserialize` annotation. At least for me, I needed both annotations.
type: Comment
score: 1

http://stackoverflow.com/comment/43302414
comment on: http://stackoverflow.com/q/27430305
score: 1
has text: "It compiles and runs" isn't the same as debugging into it - if it's crashing with an exception, why didn't you mention that before? Please show the full stack trace in your question - and ideally cut this down to a shorter program demonstrating the problem.#
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27474281
answers question: http://stackoverflow.com/q/27474272
has comment: http://stackoverflow.com/comment/43383893
has body: Just initialize temp at the start of the method : int temp = 0; This way you won't access it before it's initialized.
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43382913
has comment: http://stackoverflow.com/comment/43382952
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43383829

http://stackoverflow.com/q/27350722
answer count: 2
has comment: http://stackoverflow.com/comment/43155929
has title: JAVA Doubly Linked List - count equal data items
has answer: http://stackoverflow.com/a/27350861
has comment: http://stackoverflow.com/comment/43156198
tagged with: doubly-linked-list
has comment: http://stackoverflow.com/comment/43155870
tagged with: count
type: AnsweredQuestion
tagged with: list
accepted answer: http://stackoverflow.com/a/27350852
tagged with: java
has body: I am still a little confused on how to implement a doubly linked list. After researching and finding some information about them, I've got a good visual of how some of the basic functions work, such as add, remove etc. However, If I wanted to write a method for a DLList called countEquals (E check) that walks the entire list and counts the number of items in the list that are equal to the "Check" data item passed to the method, how would I write this. The instructions say I cannot use a for-each loop or an iterator, but a loop of some sort must be used. After the list is fully traversed, return the number of items that are equal to "check". Here is some code that I have tried to write for this: internal references of DLList: Fields (next, data, prev) Members (size), head and tail. public int countEquals(E Check){ currentNode = head; int count = 0; while (currentNode != null) { if (currentNode.data == check) { count ++; else { currentNode.next = currentNode; } return count; } I'm not too sure if this will correctly walk a doubly linked list, if I have to write more pointer assignments? I was thinking that because I'm not adding any nodes, but just walking a list, I wouldnt need to do the pointers.
possible better answer: http://stackoverflow.com/a/27350861
type: Question
has answer: http://stackoverflow.com/a/27350852
score: 0

http://stackoverflow.com/a/27428263
has comment: http://stackoverflow.com/comment/43322488
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43300112
accepted answer of: http://stackoverflow.com/q/27428041
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27428041
has body: You forgot to reverse the arrayList itself. You only reverse each StringBuilder. Collections.reverse(arrayList); Anyways, there seems to be no use for a list at all. Just append directly to the StringBuilder. Something like this should do the trick: // ... StringBuilder sb = new StringBuilder(); while((line = in.readLine()) != null &amp;&amp; line.length()!= 0) { sb.append(line); } in.close(); System.out.println(sb.reverse().toString()); // ...
type: Answer

http://stackoverflow.com/comment/43152604
has text: No,you got it wrong.I am doing like this: http://prntscr.com/5ed4ds I am adding items to last of map then i am reversing the list and last item will be top of the list.Is this a good approach for performance or etc.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27348905
type: AnswerComment

http://stackoverflow.com/a/27363412
upvote count: 2
has comment: http://stackoverflow.com/comment/43201595
has comment: http://stackoverflow.com/comment/43192093
answers question: http://stackoverflow.com/q/27363330
has comment: http://stackoverflow.com/comment/43180617
downvote count: 0
has body: You can fetch employee table data in this way Here hibernateSession is the reference variable of Session. List employees=hibernateSession.createQuery("from Employee").list(); Than through while loop you can get your data Employee employee; int x=0; while(x&lt;employees.size()) { employee=(Employee)employees.get(x); String name=employee.getName()); int age=employee.getAge(); x++; } Hope this helps if you think that this solves your problem than mark the answer as solution
type: Answer
has comment: http://stackoverflow.com/comment/43179833
score: 2

http://stackoverflow.com/comment/43116274
type: QuestionComment
has text: Do you see any string like "Wait for servor...", "Un known Host Exception Occur..." on gui or `Logger.getLogger(UserClient.class.getName()).log(Level.SEVERE, null, ex);` in logger?
comment on: http://stackoverflow.com/q/27328754
score: 0
type: Comment

http://stackoverflow.com/a/27382911
has body: I would couple my ProgressDialog with the Async Class itself and pass the context from this fragment using getActivity(), using the Async class's constructor. .....//Fragment Code//...... new MyAsyncTask(getActivity(),....).execute(...); ....//Async Task Code//...... class MyAsyncTask extends AsyncTask&lt;P1,P2,P3&gt; { Context context; ProgressDialog pDialog; ....... public MyAsyncTask(Context ctx,...) { this.context = ctx; ..... } onPreExecute() { pDialog = new ProgressDialog(context); ...configure your ProgressDialog here } }
answers question: http://stackoverflow.com/q/27382743
has comment: http://stackoverflow.com/comment/43373107
score: 0
type: Answer

http://stackoverflow.com/comment/43219449
score: 1
type: QuestionComment
has text: @JonSkeet Don't know. The format is intended to be an open standard that anyone could generate with any language they choose. I've considered the option of specifying UTF-16 code unit order but I don't like it very much since a number of more recent languages don't use UTF-16 encoding natively. I've also worked with my team to try to come up with a way of avoiding having to specify an ordering in the format spec, but everything we've come up with for the situation in question causes more problems than it solves.
comment on: http://stackoverflow.com/q/27385328
type: Comment

http://stackoverflow.com/q/27449571
has body: I have a file containing data in the format: director movie I'm using hadoop and Java to process it. It's pretty basic to count the number of movies for every director, but how can I modify the code to get something like this: director movie1 movie2 movie3...
type: AnsweredQuestion
tagged with: java
tagged with: mapreduce
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/27452386
possible better answer: http://stackoverflow.com/a/27450142
has answer: http://stackoverflow.com/a/27450142
score: 0
answer count: 2
has title: How to get Hadoop output to Text, Text format?
accepted answer: http://stackoverflow.com/a/27452386

http://stackoverflow.com/comment/43226008
comment on: http://stackoverflow.com/q/27389040
score: 5
has text: You're just seeing the output of calling `toString()` on an array. It's got nothing to do with sorting. Try calling `Arrays.toString(words)` instead.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27393225
type: AnsweredQuestion
tagged with: inner-classes
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43233711
accepted answer: http://stackoverflow.com/a/27393573
upvote count: 1
has title: Can't access members of an anonymous, nested subclass (implementing an interface)
type: Question
has body: I have problem here. I write a piece of code like this： package vh.Static; public class Nesting { //static class Nested{} class Inner{} void method(){ Inner inner = new Inner(){ public int z =2; public int getZ(){ return z; } }; System.out.println(inner); } public static void main(String args[]){ Nesting ne =new Nesting(); Inner inner = ne.new Inner(){ public int z =1; public int getZ(){ return z; } }; System.out.println(inner); ne.method(); } } I don't know how to get the var z definding in the Inner constructor block. help me,please! and tell me where is z local? in Inner? or Nesting
has comment: http://stackoverflow.com/comment/43233756
tagged with: class
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27393573
favorite count: 0
tagged with: interface

http://stackoverflow.com/comment/43207627
score: 0
type: AnswerComment
has text: @Will What data do you want to put in the array? Primitives? Objects? In your code you wrote `Array`, so if that's your real code, the compiler expects a class called `Array`.
type: Comment
comment on: http://stackoverflow.com/a/27378826

http://stackoverflow.com/comment/43109104
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27322052
type: Comment
has text: Can I add JRE on a RAM disk or does it have to be JDK? I think the same rule applies while running JRE or JDK off the RAM disk - whether it's for Java or non-Java development. Correct me if I am wrong.

http://stackoverflow.com/q/27378043
type: UnansweredQuestion
tagged with: solr
type: Question
tagged with: java
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27386341
tagged with: solrj
has body: I have solr schema where almost every field is required=true. I am using following POJO to persist data in solr @Field(value = "id") private String id; @Field(value = "entity_id") private Long entityId; ... Now before sending it to solr, I am currently checking explicitly each field for null. Is there any annotation like @NotNull or @Field attribute like required=true so that I need not to check them ?
score: 2
has title: @NotNull type annotation - Solrj
upvote count: 2

http://stackoverflow.com/comment/43161339
comment on: http://stackoverflow.com/q/27353664
score: 0
type: QuestionComment
has text: please refer [this](http://ankursinghal86.blogspot.in/2014/11/json-to-hashmap-parsing-json-string.html)
type: Comment

http://stackoverflow.com/a/27434566
type: Answer
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27432635
answers question: http://stackoverflow.com/q/27432635
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43335659
has body: Ok, I figured out at least one way to do this. I have a number of bugs in the above code and this is what I needed to do to fix it. The Image tag should have been inside the HTMLPanel The Image tag seems to want a string instead of an image recource I found some helpful information in fixing this here: How to add an icon to a MenuItem in GWT? I think the g:Image tag needs to be an img and the resource should be src Need to use safeUri Here is the working code: SiteHeader.ui.xml &lt;!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"&gt; &lt;ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" xmlns:g="urn:import:com.google.gwt.user.client.ui"&gt; &lt;ui:with field='res' type='com.IdeaBurger.assets.Images'/&gt; &lt;ui:style&gt; &lt;/ui:style&gt; &lt;g:HTMLPanel&gt; &lt;img src='{res.logo.getSafeUri}' /&gt; &lt;g:HorizontalPanel&gt; &lt;g:cell&gt; &lt;g:Label&gt;One&lt;/g:Label&gt; &lt;/g:cell&gt; &lt;/g:HorizontalPanel&gt; &lt;/g:HTMLPanel&gt; &lt;/ui:UiBinder&gt; SiteHeader.java package com.IdeaBurger.client; import com.IdeaBurger.assets.Images; import com.google.gwt.core.client.GWT; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.Widget; public class SiteHeader extends Composite { private static SiteHeaderUiBinder uiBinder = GWT .create(SiteHeaderUiBinder.class); @UiField Images res; interface SiteHeaderUiBinder extends UiBinder&lt;Widget, SiteHeader&gt; { } public SiteHeader() { initWidget(uiBinder.createAndBindUi(this)); } } Cheers

http://stackoverflow.com/a/27475076
has body: Basically you want to implement extensibility or plugin design pattern. There are multiple ways to implement this scenario. Which ever the component you want to allow someone else to reload the module, define an interface and implement your own implementation as a default one. For example, Here I am trying to provide a HelloInterface which each country can implement and load anytime, public interface HelloInterface { public String sayHello(String input); .. } public class HelloImplDefault implements HelloInterface { public String sayHello(String input) { return "Hello World"; } } Now allow user to add a plugin (custom implementation) files to a pre-configured path. You can either user FileSystemWatcher or a background thread to scan this path and try to compile and load the file. To compile java file, private void compile(List&lt;File&gt; files) throws IOException{ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); DiagnosticCollector&lt;JavaFileObject&gt; diagnostics = new DiagnosticCollector&lt;JavaFileObject&gt;(); StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null); Iterable&lt;? extends JavaFileObject&gt; compilationUnits = fileManager .getJavaFileObjectsFromFiles(files); JavaCompiler.CompilationTask task = compiler.getTask(null, fileManager, diagnostics, null, null, compilationUnits); boolean success = task.call(); fileManager.close(); } To load class file, private void load(List&lt;File&gt; files) throws MalformedURLException, InstantiationException, IllegalAccessException, ClassNotFoundException{ ClassLoader cl = Thread.currentThread().getContextClassLoader(); for(File f: files){ if(f.getName().endsWith(".class") &amp;&amp; !loadedClass.contains(f.getName())){ URL url = f.toURL(); URL[] urls = new URL[]{url}; Object obj = cl.loadClass(f.getName().replace(".class", "")).newInstance(); if(obj instanceof HelloInterface){ HelloProviders.addProvider((HelloInterface)obj); System.out.println("Loaded "+ ((HelloIn…
answers question: http://stackoverflow.com/q/27331252
score: 0
type: Answer

http://stackoverflow.com/a/27320082
score: 2
upvote count: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27319446
has body: Are there more cases where a single thread will be faster than multithreading? So in a GUI application you will benefit from multithreading. At the most basic level you will be updating the front end as well as what the front end is presenting. If you're running something basic like hello world then like you showed it would be more overhead. That question is very broad... Do you count Unit Tests as applications? If so then there are probably more applications that use single threads because any complex system will have (hopefully) at least 1 unit test. Do you count every Hello world style program as a different application or the same? If an application is deleted does it still count? As you can see I can't give a good response other than you would have to narrow the scope of your question to get a meaningful answer. That being said this may be a statistic out there that I'm unaware of. When should we decide to give up multithreading and only use a single thread to accomplish our goal? When multithreading will perform 'better' by whatever metric you think is important. Can your problem be broken into parts that can be processed simultaneously? Not in a contrived way like breaking Hello World into two threads where one thread waits on the other to print. But in a way that 2+ threads would be able to accomplish the task more efficiently than one? Even if a task is easily parallelizable doesn't mean that it should be. I could multithread an application that trolled thousands of new sites constantly to get me my news. For me personally this would suck because it would eat my pipe up and I wouldn't be able to get my FPS in. For CNN this might be exactly what they want and will build a mainframe to accommodate it. Can you narrow your questions?
type: Answer

http://stackoverflow.com/q/27469933
tagged with: java
accepted answer: http://stackoverflow.com/a/27491063
tagged with: error-handling
tagged with: apache-storm
type: Question
answer count: 2
downvote count: 0
has title: Add retry mechanism for bolt on Apache Storm
has body: I have a bolt (dispatcher) in my storm topology which open http request connection. I want to add retry mechanism in-case of failure (connection time out, fail status, etc..). The retry should occur only in the dispatcher-bolt and not to start over the whole topology. usually what I would do is to add a queue which would be responsible for the retry and exception handling (for example after 3 time automatically dispatch the message to an error queue..) Is it OK to do such thing inside a bolt? anyone has any experience with that and could suggest which library I could use?
has answer: http://stackoverflow.com/a/57025879
has answer: http://stackoverflow.com/a/27491063
favorite count: 0
possible better answer: http://stackoverflow.com/a/57025879
tagged with: bigdata
upvote count: 1
type: AnsweredQuestion
score: 1

http://stackoverflow.com/comment/43211644
type: AnswerComment
has text: http://stackoverflow.com/questions/767759/occurrences-of-substring-in-a-string refer this for getting in each line and you can put variable outside loop and keep adding it.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27380378

http://stackoverflow.com/comment/43114216
has text: I need to use scanner
type: Comment
comment on: http://stackoverflow.com/a/27327626
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43141783
comment on: http://stackoverflow.com/a/27343126
score: 0
type: AnswerComment
has text: Where in the folder should I save the .jar files?
type: Comment

http://stackoverflow.com/q/27451344
type: Question
has answer: http://stackoverflow.com/a/27799145
has title: AWS S3 getObject() causing HTTP Connection Time Out
possible better answer: http://stackoverflow.com/a/27799145
answer count: 2
has body: I am trying to retrieve a File (asdf.txt) that I manually uploaded to my AWS S3 Bucket. Let's call it "myBucket". I have set the permissions on the bucket and the file to be completely accessible to all. When I call getObject() I get the an error saying that the Connection timed out. Here is my stacktrace: Dec 12, 2014 2:51:31 PM com.amazonaws.http.AmazonHttpClient executeHelper INFO: Unable to execute HTTP request: Connection timed out: connect java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:579) at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:618) at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:523) at org.apache.http.conn.ssl.SSLSocketFactory.connectSocket(SSLSocketFactory.java:402) at com.amazonaws.http.conn.ssl.SdkTLSSocketFactory.connectSocket(SdkTLSSocketFactory.java:112) at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:178) at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:304) at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445) at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863) at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) at org.…
downvote count: 0
has answer: http://stackoverflow.com/a/27625376
has comment: http://stackoverflow.com/comment/43671139
favorite count: 0
has comment: http://stackoverflow.com/comment/43590141
type: AnsweredQuestion
score: 3
tagged with: amazon-s3
accepted answer: http://stackoverflow.com/a/27625376
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/115321239
type: Comment
type: AnswerComment
has text: and how do we iterate over it?
score: 0
comment on: http://stackoverflow.com/a/48930524

http://stackoverflow.com/q/27472750
has comment: http://stackoverflow.com/comment/43380153
has comment: http://stackoverflow.com/comment/43380379
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43380204
has title: What's wrong with my code; constructors and loops?
has comment: http://stackoverflow.com/comment/43380363
has body: This is my driver class import java.io.File; import java.io.IOException; import java.util.Scanner; public class PizzaMatch { @SuppressWarnings("resource") public static void main(String[] args) throws IOException { String answer = ""; String yes = "Y"; String no = "N"; String topping = ""; int size = 0; double cost = 0; int iteration = 0; int inFileSize = 0; double inFileCost = 0; String inFileTopping = ""; Scanner reader = new Scanner(System.in); Scanner inFileReader = new Scanner(new File("C:/Users/Frosty Snow/Downloads/pizza.txt")); System.out.println("Would you like to enter a Pizza? (Y or N)"); answer = reader.next(); if(answer.equalsIgnoreCase(no)) { System.exit(1); } System.out.println("Input a Pizza topping, size, and cost:"); topping = reader.next(); size = reader.nextInt(); cost = reader.nextDouble(); Pizza Order = new Pizza (size, topping, cost); while(inFileReader.hasNextLine()) { iteration ++; inFileSize = inFileReader.nextInt(); inFileTopping = inFileReader.next(); inFileCost = inFileReader.nextDouble(); Pizza inFileOrder = new Pizza(inFileSize, inFileTopping, inFileCost); if(Order.equals(inFileOrder)) { System.out.println("That pizza is # " + iteration + " in the file."); break; } } } } This is my resource class public class Pizza { private int size; private String topping; private double cost; public Pizza() { size = 10; topping = "cheese"; cost = 9.00; } public Pizza(int s, String t, double c) { size = s; topping = t; cost = c; } public int getSize() { return size; } public void setSize(int s) { s = size; } public String getTopping(){ return topping; } public void setTopping(String t){ topping = t; } public void setCost(double c) { cost = c; } public double getCost(double c){ return cost; } public boolean equals(Object obj) { if(!(obj instanceof Pizza)) throw new IllegalArgumentException(); Pizza temp = (Pizza) obj; if (this.size == temp.size &amp;&amp; this.topping.equals(temp.topping) &amp;&amp; this.cost == temp.cost) return true; else return fal…
has comment: http://stackoverflow.com/comment/43380263
has answer: http://stackoverflow.com/a/27472946
has comment: http://stackoverflow.com/comment/43380226
has comment: http://stackoverflow.com/comment/43380178
type: Question
has comment: http://stackoverflow.com/comment/43380237
has comment: http://stackoverflow.com/comment/43380327
has comment: http://stackoverflow.com/comment/43380082
score: 0
tagged with: java
answer count: 1
has comment: http://stackoverflow.com/comment/43380145
has comment: http://stackoverflow.com/comment/43380176

http://stackoverflow.com/a/27432354
type: Answer
downvote count: 0
score: 1
has body: Don't put the I/O into the filter. That's not what it's for. You should get the complete list of files and then process it. For example if the I/O creates another file in the directory, the behaviour is undefined. You might miss a file, or see the new file in the accept() method.
upvote count: 1
has comment: http://stackoverflow.com/comment/43319134
answers question: http://stackoverflow.com/q/27430662

http://stackoverflow.com/q/27433173
type: AnsweredQuestion
has title: If condition not working on String
downvote count: 2
has comment: http://stackoverflow.com/comment/43307734
has comment: http://stackoverflow.com/comment/43307567
type: Question
has answer: http://stackoverflow.com/a/27434009
accepted answer: http://stackoverflow.com/a/27433408
score: -2
tagged with: java
answer count: 3
upvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27433254
linked to: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/27433408
has comment: http://stackoverflow.com/comment/43307503
has body: Okay this is kind of hard to explain but I'll try my best. I'm creating a program that reads from a .data file, saves each line of the file into an array list, then the user specifies the building and room number to look for, the program then searches through the whole array list (couple thousand lines) for matches, then with those matches calculates how often those rooms are used using some of the data obtained from the data file. Now, the problem is that I can get up to the program searching through the array list, but it seems to be doing something incorrectly. String buildingNum = jTextField2.getText(); String roomNum = jTextField1.getText(); int strDuration = 0; int totalDuration = 0; int meetings = 0; for (int x = 0; x &lt; Global.globalLength; x++) { if ((buildingNum != "XXXX") &amp;&amp; (list.get(x).building != "XXXX") &amp;&amp; (list.get(x).room != "XXXX") &amp;&amp; (roomNum != "XXXX")) { int intBuildingNum = Integer.parseInt(buildingNum); int intRoomNum = Integer.parseInt(roomNum); int listBuildingNum = Integer.parseInt(list.get(x).building); int listRoomNum = Integer.parseInt(list.get(x).room); if (listBuildingNum == intBuildingNum) { System.out.println("Second STEP WOO"); if (listRoomNum == intRoomNum) { strDuration = Integer.parseInt(list.get(x).duration); meetings = list.get(x).days.length(); totalDuration = totalDuration + (meetings * strDuration); System.out.println(strDuration + " and " + meetings); System.out.println(" and " + totalDuration); } } } } int utilization = totalDuration / 50; jTextArea1.setText("The room utilization is: " + utilization); In the data file, there are a few places in which data is entered as XXXXXXXXXXXX for whatever reason. Because of this, when trying to convert said data into an integer there's a problem (for obvious reasons). So to fix this, I made that odd if block right after the for loop so that the program would try not to do so. However, When running it, I am able to get the program to display the total duratio…
duplicate of: http://stackoverflow.com/q/513832
possible better answer: http://stackoverflow.com/a/27433254

http://stackoverflow.com/a/27339974
upvote count: 1
type: Answer
downvote count: 0
has body: This is expected behaviour, API gives a similar example: "emptiness".substring(9) returns "" (an empty string)
score: 1
answers question: http://stackoverflow.com/q/27339873

http://stackoverflow.com/comment/43184053
comment on: http://stackoverflow.com/q/27365318
score: 0
type: Comment
type: QuestionComment
has text: Perhaps you need to commit after the bulk insert?

http://stackoverflow.com/q/27474736
has comment: http://stackoverflow.com/comment/43422482
type: Question
has body: I have a function attached to a button that looks like this: public void viewSnappies(View z) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(Util.getOutputMediaFile().mediaStorageDir().getPath())); startActivity(intent); } In my Util Class, I have: public final class Util { /** * Create a File for saving an image */ // http://developer.android.com/guide/topics/media/camera.html#saving-media public static File getOutputMediaFile(Context context) { File mediaStorageDir = null; // To be safe, you should check that the SDCard is mounted // using Environment.getExternalStorageState() before doing this. String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { mediaStorageDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES), "snappiesticker"); } else { ContextWrapper cw = new ContextWrapper(context); mediaStorageDir = cw.getDir("imageDir", Context.MODE_PRIVATE); } // This location works best if you want the created images to be shared // between applications and persist after your app has been uninstalled. // Create the storage directory if it does not exist if (!mediaStorageDir.exists()) { if (!mediaStorageDir.mkdirs()) return null; } // Create a media file name String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date()); File mediaFile; mediaFile = new File(mediaStorageDir.getPath() + File.separator + "IMG_" + timeStamp + ".jpg"); return mediaFile; } } Right now the button is not working as I intend it to (error in the new Intent line). Its not resolving because I am putting the wrong thing into Uri.parse(). I want it to resolve to and use the mediaStorageDir defined in the getOutputMediaFile method given in the Util class. How do I pass this variable correctly?
tagged with: java
score: 0
has comment: http://stackoverflow.com/comment/43385276
has comment: http://stackoverflow.com/comment/43384798
has comment: http://stackoverflow.com/comment/43384003
has comment: http://stackoverflow.com/comment/43384620
has comment: http://stackoverflow.com/comment/43384300
has comment: http://stackoverflow.com/comment/43395354
has comment: http://stackoverflow.com/comment/43384217
tagged with: android
has comment: http://stackoverflow.com/comment/43384163
has comment: http://stackoverflow.com/comment/43384242
has comment: http://stackoverflow.com/comment/43430291
answer count: 0
has comment: http://stackoverflow.com/comment/43384481
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43384801
has title: How to export media storage directory into an ACTION_VIEW intent?
tagged with: android-intent

grouplayout
type: Tag
tag name: grouplayout
tags question: http://stackoverflow.com/q/27396074

http://stackoverflow.com/comment/43182727
type: AnswerComment
has text: It is beyond bizarre... I've tried it as you suggested and the value of title after stepping over the line String title = info.get(MeetingInfo.MEETING_TITLE).replace("'", "''"); is still: User's (the apostrophe is still there) http://pastebin.com/sgDU9DTe
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27362707

osmdroid
type: Tag
tag name: osmdroid
tags question: http://stackoverflow.com/q/27438294

http://stackoverflow.com/q/27418353
has answer: http://stackoverflow.com/a/27418979
score: 2
upvote count: 3
tagged with: whitespace
downvote count: 1
has comment: http://stackoverflow.com/comment/43279912
type: Question
tagged with: java
tagged with: javascript
has body: I am writing lots of whitespaces as you can see the code below. out.println("new Array('1453 12999 ALPER KOPUZ')"); unfortunately when code compiles and run the code in the screen I am able to see it as "1453 1299 ALPER KOPUZ". It means it auto removes whitespaces and put only one whitespace after one word.It works fine at older versions of Internet Explorer but it does show line such like "1453 1299 ALPER KOPUZ" at Internet explorer which I need to fix and our application runs on this server. I tried css "white-space: pre;" but it is still same. This problem makes me crazy and ate my 3 hours. I would be glad if you have any idea to fix it. Cheers Alper Kopuz
has title: jsp page auto removes whitespaces
has comment: http://stackoverflow.com/comment/43283284
answer count: 1
tagged with: jsp
favorite count: 0
type: UnansweredQuestion
tagged with: http://stackoverflow.com/tag/html

http://stackoverflow.com/a/27375876
has body: The if statement is terminated by a semicolon (;), and a block that starts after it if(categorys_list_panel.isMovetoErrorsList()); // here -----^ { This means that the condition is evaluated, and if it's true nothing is executed. Then, an anonymous block is opened, executed, and closed. In order to have the block relate to the if, you should remove the semicolon: if(categorys_list_panel.isMovetoErrorsList()) // no ; {
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43201632
type: Answer
has comment: http://stackoverflow.com/comment/43201656
upvote count: 3
answers question: http://stackoverflow.com/q/27375776
score: 3
accepted answer of: http://stackoverflow.com/q/27375776

http://stackoverflow.com/a/27421063
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27421009
score: 1
has body: First overide the run method and then create the object of thread class in main() and call start method.

http://stackoverflow.com/comment/43196324
has text: This came back with all the sets but only for one transaction.
comment on: http://stackoverflow.com/a/27371968
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43141562
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27338713
type: QuestionComment
has text: thank you Stephan Branczyk, i corrected it. Only wondered if this is the way to go or if there is another (easier) way. Its like "i close the door when its closing". Why do i need to disable car_mode when its already exiting?

http://stackoverflow.com/comment/43248724
has text: @Mohit_Bhasi,i need to create 9 arrays ,each array contains 9 values.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27401933

http://stackoverflow.com/comment/43188349
comment on: http://stackoverflow.com/q/27368214
type: Comment
type: QuestionComment
score: 1
has text: Yep, test it and see. But do read the tutorials or an intro to Java book.

http://stackoverflow.com/a/27318174
score: 1
has body: import com.lowagie.text.Document; import com.lowagie.text.DocumentException; import com.lowagie.text.Paragraph; import com.lowagie.text.pdf.PdfWriter; import java.io.FileOutputStream; import java.io.IOException; import java.util.*; import javax.mail.*; public class Email2PDF { public static void main(String[] args) { Properties props = new Properties(); props.setProperty("mail.store.protocol", "imaps"); try { Session session = Session.getInstance(props, null); Store store = session.getStore(); store.connect("imap.gmail.com", "youremail@gmail.com", "password"); Folder inbox = store.getFolder("INBOX"); inbox.open(Folder.READ_ONLY); Message msg = inbox.getMessage(inbox.getMessageCount()); Multipart mp = (Multipart) msg.getContent(); BodyPart bp = mp.getBodyPart(0); createPdf(msg.getSubject(), (String) bp.getContent()); } catch (Exception mex) { mex.printStackTrace(); } } public static void createPdf(String filename, String body) throws DocumentException, IOException { Document document = new Document(); PdfWriter.getInstance(document, new FileOutputStream(filename + ".pdf")); document.open(); document.add(new Paragraph(body)); document.close(); } } I've used itext as the pdf library
upvote count: 1
answers question: http://stackoverflow.com/q/27317795
has comment: http://stackoverflow.com/comment/43097497
downvote count: 0
has comment: http://stackoverflow.com/comment/43096566
type: Answer
has comment: http://stackoverflow.com/comment/43097333
has comment: http://stackoverflow.com/comment/43095876

http://stackoverflow.com/a/27422612
has comment: http://stackoverflow.com/comment/43287885
has comment: http://stackoverflow.com/comment/43287436
has comment: http://stackoverflow.com/comment/43289550
score: 0
has body: Try calling getAllRunninThreads just once as calling it again and again would not give you consistent value of set/array (imagine creating new thread or exiting a thread) and hence would create issue. public static boolean isThreadExist(String threadName) { Thread[] threads = ThreadsUtility.getAllRunninthreads(); for (int i = 0; i &lt; threads.length; i++) { if (threads[i].getName().equals(threadName)) { return true; } } return false; } This is what api has to say for getAllStackTraces method A zero-length array will be returned in the map value if the virtual machine has no stack trace information about a thread.
answers question: http://stackoverflow.com/q/27422319
type: Answer

http://stackoverflow.com/comment/43244578
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27361309
score: 0
has text: @camickr: you are absolutely right - SSCCE updated (please checkout the resizing comment too), thank you.

http://stackoverflow.com/q/27455114
has title: How to compare user input with my database in java
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/867194
has answer: http://stackoverflow.com/a/27455203
has comment: http://stackoverflow.com/comment/43348105
has body: As shown on the title, I have tried so hard to compare the user input with my database and it works with a true input. However, when the input is not exist on my database I don't know what is wrong in my below code, please help. private class da implements ActionListener{ public void actionPerformed(ActionEvent e){ Connection con = null; String url = "jdbc:mysql://localhost:3306/المكتبة"; String unicode = "?useUnicode=yes&amp;characterEncoding=UTF-8"; try{ con = DriverManager.getConnection(url+unicode,"root",""); PreparedStatement upd = con.prepareStatement("SELECT * FROM library WHERE author =?'"); upd.setString(1,name.getText()); ResultSet rs = upd.executeQuery(); while(rs.next()){ String authorname = rs.getString("author"); String bookname = rs.getString("bookname"); String categort = rs.getString("category"); int isbn = Integer.parseInt(rs.getString("ISBN")); String data = "اسم المؤلف: "+authorname+"\n"+"اسم الكتاب: "+bookname+"\n"+"التصنيف: "+categort+"\n"+"ISBN: "+isbn; if(name.getText().equals(authorname)) txt.setText(data); else txt.setText("no matches");
score: 0
has answer: http://stackoverflow.com/a/27455169
answer count: 2
type: UnansweredQuestion
tagged with: jdbc

http://stackoverflow.com/q/27390216
has body: So I am working on a project for a class. And I've been struggling with this issue for a while now. The code below is a start screen, and when the enter key is pressed (when atTitle turns to false) I would like it to draw the next image. The problem with that is I can not think of a way for it to draw the next image when it turns to false. I've tried using ifs and whiles. Mainly the problem is that you obviously put another public void paintComponent in an if statement. And I can't carry the Graphics g variable to the KeyPressed method. I'm stuck. public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2 = (Graphics2D)g; AffineTransform at = new AffineTransform(); g2.setTransform(at); if (atTitle == true) { g.drawImage(titlescreen, 0, 0, this); if (start_visible == true) { g.drawImage(start_symbol, -70, 30, this); jf.addKeyListener(this); } } } public void keyTyped(KeyEvent e) {} public void keyReleased(KeyEvent e) {} public void keyPressed(KeyEvent e) { //int keyCode = e.getKeyCode(); if (atTitle == true) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { atTitle = false; System.out.println("It Works."); } } }
tagged with: 2d-games
has answer: http://stackoverflow.com/a/27390325
has comment: http://stackoverflow.com/comment/43228519
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43228468
type: Question
has comment: http://stackoverflow.com/comment/43228612
has answer: http://stackoverflow.com/a/27390351
answer count: 2
has title: How to draw an image over another?
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/8498147

http://stackoverflow.com/q/27332964
has body: I use this function to create tabs. When I want to add button "?" that will open the Wizard, this button appears at the right side of this JTable. How to edit this? comp1 - "1. Dp/Drho", comp2 - "2. Df2/Drho", comp3 - "3. SDSS", comp4 - "4. Help". name1-4 - names of this tabs. static protected JPanel allocateUniPane(Component comp1,Component comp2,Component comp3, Component comp4, String name1, String name2, String name3, String name4){ JPanel resultPane = new JPanel(); GridBagLayout gridbagforUnionPane = new GridBagLayout(); GridBagConstraints cUnionPane = new GridBagConstraints(); resultPane.setLayout(gridbagforUnionPane); cUnionPane.fill = GridBagConstraints.BOTH; cUnionPane.anchor = GridBagConstraints.CENTER; JButton showWizard = new JButton("?"); cUnionPane.weightx = 0.5; cUnionPane.weighty = 0.5; JTabbedPane jtp = new JTabbedPane(); jtp.addTab(name1, comp1); jtp.addTab(name2, comp2); jtp.addTab(name3, comp3); jtp.addTab(name4, comp4); cUnionPane.gridx = 0; cUnionPane.gridy = 0; resultPane.add(jtp,cUnionPane); cUnionPane.fill = GridBagConstraints.NORTH; cUnionPane.weightx = 0.5; cUnionPane.gridx = 1; cUnionPane.gridy = 0; resultPane.add(showWizard,cUnionPane); return resultPane; }
type: AnsweredQuestion
tagged with: java
upvote count: 1
tagged with: swing
type: Question
tagged with: gridbaglayout
accepted answer: http://stackoverflow.com/a/27333258
has title: Swing - GridBagLayout button adding mistake
tagged with: grid-layout
answer count: 1
downvote count: 0
score: 1
favorite count: 0
tagged with: jtabbedpane
has answer: http://stackoverflow.com/a/27333258

http://stackoverflow.com/comment/43308806
has text: @KevinBowersox Yes, Map would be ideal. True, we don't know. That's why it's good to make sure OP doesn't think this approach is the "standard way".
score: 1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27433586

http://stackoverflow.com/comment/43176597
type: QuestionComment
has text: Down voters please consider adding the reason of your vote
comment on: http://stackoverflow.com/q/27362044
score: 0
type: Comment

http://stackoverflow.com/comment/43324289
type: Comment
has text: actually i add this line so when user clicked on any button like minimize and cross then application is added to system tray and trayIcon contains image which i showed in system tray
comment on: http://stackoverflow.com/q/27442164
score: 0
type: QuestionComment

jython-2.5
tag name: jython-2.5
type: Tag
tags question: http://stackoverflow.com/q/27412722

http://stackoverflow.com/comment/43361655
has text: I am not sure I am able to figure out how to work that. I am doing this: new ThreadPoolExecutor(nThreads, nThreads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); so I have a blocking queue. "The supplying thread will block".. but I am fetching data from the database. I can fetch 1000 or 1000 000 million at a time. If I supply a million to the queue, it doesn't sound ideal to me, even if it does block.
type: AnswerComment
comment on: http://stackoverflow.com/a/27462501
score: 0
type: Comment

http://stackoverflow.com/comment/58336647
has text: @ErickG.Hagstrom : now its closed anyway . i had a quite well documented and complete answer ready to post ... thats bad luck now its gone. The point is, this question is not the duplicate but the other one is because this question was asked prior. That pixxes me off a bit, i improved the other question so that there is a complete answer and I put the correct answer in here and the only thing I got is a down vote and a deleted answer. Thats not motivating.
type: QuestionComment
comment on: http://stackoverflow.com/q/27402825
score: 0
type: Comment

http://stackoverflow.com/q/27422898
tagged with: logging
type: Question
has comment: http://stackoverflow.com/comment/43292162
has comment: http://stackoverflow.com/comment/43291461
has comment: http://stackoverflow.com/comment/43290723
linked to: http://stackoverflow.com/q/1710476
upvote count: 1
tagged with: jpa
favorite count: 0
has title: JPA Log ResultSet
tagged with: resultset
has body: Good Morning in my timezone I am working with JPA , and i do not understand how one of the query fields is returning null. I see the one of the object fields fullfilled with NULL. I am logging the query , when i run it in my sqldeveloper , it retrives the expected values(different from NULL).But that particular object field is fullfilled with NULL. How can i see(log) the resultset that the JPA uses(the result of the query) ? I am a little desperate :( Thanks in advance Best regards
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/a/27411694
downvote count: 2
upvote count: 1
answers question: http://stackoverflow.com/q/27411639
has comment: http://stackoverflow.com/comment/43267786
score: -1
has comment: http://stackoverflow.com/comment/43267789
type: Answer
has body: Your code to check if the user exists checks the keys of the map (usersMap.containsKey) but the later code checks the values (usersMap.values().contains(loginUser))

http://stackoverflow.com/comment/43291852
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27420609
has text: Thank you so much! commenting the `conf.setCombinerClass(WordCountReducer.class)` did the trick.

http://stackoverflow.com/q/27345944
tagged with: java
tagged with: jaxb
upvote count: 1
type: Question
has title: How do I create an empty tag of anyType without attributes using JAXB
tagged with: epp
has comment: http://stackoverflow.com/comment/43160917
has comment: http://stackoverflow.com/comment/43148279
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43191673
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/33914423
has comment: http://stackoverflow.com/comment/43152889
has body: The xsd is here: http://www.iana.org/assignments/xml-registry/schema/epp-1.0.xsd I don't want to modify the XSD (maintained by a third party) or the XJC generated classes since they get overwritten with every build. Here is a sample snippet of the above XSD: &lt;complexType name="dcpAccessType"&gt; &lt;choice&gt; &lt;element name="all"/&gt; ... &lt;/choice&gt; &lt;/complexType&gt; The corresponding XJC generated class looks like this: ... public EppDcpAccessType { ... public void setAll(Object value) { this.all = value; } ... } ... I want to generate an empty tag such as follows: &lt;all/&gt; But I don't know how to set the property to achieve this. If I do the following: eppDcpAccessType.setAll(""); I get the following (with a bunch of attributes I don't want): &lt;all xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string"&gt;&lt;/all&gt; If I do the following: eppDcpAccessType.setAll(new Object()); I get the following run time error: java.lang.ClassCastException: java.lang.Object cannot be cast to org.w3c.dom.Element How do I generate an empty tag without the attributes?
score: 1

http://stackoverflow.com/a/27319214
downvote count: 0
has comment: http://stackoverflow.com/comment/43288360
has body: Unless you are running your application as WAR, the src/main/webapp folder won't be included in the output as stated in the documentation: Do not use the src/main/webapp folder if your application will be packaged as a jar. Although this folder is a common standard, it will only work with war packaging and it will be silently ignored by most build tools if you generate a jar. So that may be your problem. To fix it try to set config location explicitly for the main servlet: servlet.addInitParameter("contextConfigLocation", "classpath:main-servlet.xml"); and place the main-servlet.xml file in src/main/resources. Hope this helps.
type: AcceptedAnswer
score: 7
has comment: http://stackoverflow.com/comment/43288644
type: Answer
upvote count: 7
accepted answer of: http://stackoverflow.com/q/27318367
answers question: http://stackoverflow.com/q/27318367

http://stackoverflow.com/a/27331353
score: 1
upvote count: 1
has body: Revising the concept of data type and their size might help you http://www.tutorialspoint.com/java/java_basic_datatypes.htm
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27331336

http://stackoverflow.com/comment/43122235
type: QuestionComment
has text: Read about anonymous classes. https://docs.oracle.com/javase/tutorial/java/javaOO/anonymousclasses.html
comment on: http://stackoverflow.com/q/27332347
score: 0
type: Comment

animation
tags question: http://stackoverflow.com/q/27423375
type: Tag
tag name: animation
tags question: http://stackoverflow.com/q/27463989
tags question: http://stackoverflow.com/q/27473258
tags question: http://stackoverflow.com/q/27458526
tags question: http://stackoverflow.com/q/27459443
tags question: http://stackoverflow.com/q/27417901
tags question: http://stackoverflow.com/q/27437174

http://stackoverflow.com/q/27373109
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27394813
has title: CSRF Guard - how to validate generated token at server side
tagged with: csrf
has body: I'm very new to web security and I'm trying to implement CSRF Gaurd on my web application. I have done all the required configuration on my web application and I can see that token (FWJY-N767-M4HG-DHXT-WCE4-5J08-MV4G-LNV4) is getting generated/injected when I do a ajax call or when a html page loads. I have notice that token is same on every request. However, I'm not able to validate token at server side. According to my research it should go to CsrfGuardFilter.java class and validate the token but when I'm debugging I can see that it is not going to CsrfGuardFilter.java class and it not validating the request based on token. I'm getting the response for the requests which doesn't contain token also. Can someone guide me to implement CSRF Guard properly on my web application. Thanks for your help.
tagged with: security
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/32490695
linked to: http://stackoverflow.com/q/27377608
accepted answer: http://stackoverflow.com/a/27394813
possible better answer: http://stackoverflow.com/a/32490695
tagged with: web-applications
tagged with: csrf-protection
type: AnsweredQuestion

http://stackoverflow.com/q/27404406
type: Question
has title: Android: How to get data from both header and body using KSOAP2
has body: After following a few tutorials(pretty much all the Fahrenheit to Celsius tutorial) I am still at a loss as to how to actually obtain the data I require and set up the request properly. The main issue is getting inside the header and giving it the PartnerID inside . I also need to give it the following parameters in the body of the request: string int int ID Can anyone explain how to achieve this? POST /service/searchapi.asmx HTTP/1.1 Host: uk.company.com Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://api.company.com/service/SearchByKeyword" <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> string </soap:Header> <soap:Body> string int int ID </soap:Body> </soap:Envelope>
has comment: http://stackoverflow.com/comment/43255086
downvote count: 0
answer count: 1
favorite count: 0
tagged with: android
accepted answer: http://stackoverflow.com/a/27421859
tagged with: soap
has comment: http://stackoverflow.com/comment/43253942
has answer: http://stackoverflow.com/a/27421859
has comment: http://stackoverflow.com/comment/43254389
upvote count: 1
tagged with: web-services
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: ksoap2

http://stackoverflow.com/q/27332732
possible better answer: http://stackoverflow.com/a/27332746
answer count: 6
has body: public static void main(String [] args) { for (int i = 0; i &lt; 50; i++) { if (i % 3 == 0) { System.out.println(); } System.out.print(i+","); } } This code prints: 0,1,2, 3,4,5, 6,7,8, ... I want it to print: 0,1,2 1,2,3 2,3,4 3,4,5 ... Any idea? Thanks a lot! I can't use an array.
has answer: http://stackoverflow.com/a/27332746
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27333190
has answer: http://stackoverflow.com/a/27332750
has answer: http://stackoverflow.com/a/27332762
has comment: http://stackoverflow.com/comment/43123158
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27332755
accepted answer: http://stackoverflow.com/a/27333190
has title: How to print 3 different numbers on each line
has answer: http://stackoverflow.com/a/27332819
type: Question

http://stackoverflow.com/q/27450601
upvote count: 10
accepted answer: http://stackoverflow.com/a/27459779
answer count: 2
downvote count: 0
tagged with: pki
favorite count: 0
possible better answer: http://stackoverflow.com/a/37008123
has answer: http://stackoverflow.com/a/37008123
has body: I'm slightly confused about cacerts formats. An application I use recently had to upgrade it's cacerts file. The original cacerts file was pk12 format (I assume, it's binary), while the new format is clearly pem. I can use either cacert, but when I suggested someone having trouble with authentication upgrade to the new cacert he gets complaints because it is not a pk12 format. What file format should cacert's be? can it be either format? Does something configure/define which format it should expect?
has answer: http://stackoverflow.com/a/27459779
type: Question
has title: What format is java's cacerts format expected to be?
type: AnsweredQuestion
tagged with: java
score: 10
tagged with: ssl

file
type: Tag
tags question: http://stackoverflow.com/q/27325065
tags question: http://stackoverflow.com/q/27454084
tags question: http://stackoverflow.com/q/27340631
tags question: http://stackoverflow.com/q/27395159
tags question: http://stackoverflow.com/q/27447703
tags question: http://stackoverflow.com/q/27458402
tags question: http://stackoverflow.com/q/27447521
tags question: http://stackoverflow.com/q/27379059
tags question: http://stackoverflow.com/q/27435527
tags question: http://stackoverflow.com/q/27390393
tags question: http://stackoverflow.com/q/27442210
tag name: file
tags question: http://stackoverflow.com/q/27420294
tags question: http://stackoverflow.com/q/27329941
tags question: http://stackoverflow.com/q/27372739
tags question: http://stackoverflow.com/q/27456070
tags question: http://stackoverflow.com/q/27465478
tags question: http://stackoverflow.com/q/27441425
tags question: http://stackoverflow.com/q/27467405
tags question: http://stackoverflow.com/q/27410178
tags question: http://stackoverflow.com/q/27446522
tags question: http://stackoverflow.com/q/27410004
tags question: http://stackoverflow.com/q/27371191
tags question: http://stackoverflow.com/q/27451497
tags question: http://stackoverflow.com/q/27463839
tags question: http://stackoverflow.com/q/27419832
tags question: http://stackoverflow.com/q/27447846
tags question: http://stackoverflow.com/q/27447129
tags question: http://stackoverflow.com/q/27374275
tags question: http://stackoverflow.com/q/27441877
tags question: http://stackoverflow.com/q/27407806
tags question: http://stackoverflow.com/q/27317512
tags question: http://stackoverflow.com/q/27450808
tags question: http://stackoverflow.com/q/27426046
tags question: http://stackoverflow.com/q/27334021
tags question: http://stackoverflow.com/q/27466194
tags question: http://stackoverflow.com/q/27345197
tags question: http://stackoverflow.com/q/27335005
tags question: http://stackoverflow.com/q/27381886
tags question: http://stackoverflow.com/q/27422582
tags question: http://stackoverflow.com/q/27346272
tags question: http://stackoverflow.com/q/27469802
tags question: http://stackoverflow.com/q/27321825
tags question: http://stackoverflow.com/q/27469597
tags question: http://stackoverflow.com/q/27402800
tags question: http://stackoverflow.com/q/27345289
tags question: http://stackoverflow.com/q/27430285
tags question: http://stackoverflow.com/q/27367465
tags question: http://stackoverflow.com/q/27335371
tags question: http://stackoverflow.com/q/27347596
tags question: http://stackoverflow.com/q/27466361
tags question: http://stackoverflow.com/q/27322367

http://stackoverflow.com/comment/43256812
comment on: http://stackoverflow.com/q/27406050
has text: You are breaking out of your while loop after the first iteration with "break" after your System.out.print...
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43269082
score: 0
type: Comment
type: QuestionComment
has text: -3633715. It runs without issue and no warnings when writing it.
comment on: http://stackoverflow.com/q/27412322

http://stackoverflow.com/a/27330378
has comment: http://stackoverflow.com/comment/43119636
has comment: http://stackoverflow.com/comment/43119060
score: -1
has body: &lt;Component&gt;.setBounds(_x_, _y_, _width_, _height_); Will change the x, y position of a GUI element. It is also possible to resize it. More can be read here https://docs.oracle.com/javase/tutorial/uiswing/layout/none.html
has comment: http://stackoverflow.com/comment/43118788
has comment: http://stackoverflow.com/comment/43120030
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43119074
has comment: http://stackoverflow.com/comment/43119552
answers question: http://stackoverflow.com/q/27329988
downvote count: 2
type: Answer
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27329988
has comment: http://stackoverflow.com/comment/43119306
has comment: http://stackoverflow.com/comment/43119478

http://stackoverflow.com/q/27414933
has comment: http://stackoverflow.com/comment/43273929
possible better answer: http://stackoverflow.com/a/27415090
has answer: http://stackoverflow.com/a/27415090
has body: Currently im doing an assignment that wants me to add 4 objects to an ArrayList! But im however not sure that understand the mechanics of this.. even though i have been reading through my book, in order to get a decent explanation! When we create an ArrayList we do: ArrayList&lt;Object&gt; list = new ArrayList&lt;&gt;(); And when we are creating an object, one would do: loan m = new loan(); circle n new circle(); When im making an object, i normally go and create a class that supports the object with constructors etc. But as far as im aware, when adding an object to an ArrayList thats not whats being done? Do i still need to create my class "loan" and "circle" and somehow implement it in my ArrayList, through the constructors? Im furthermore having trouble understanding if the ArrayList can distinguish between circle and loan, when these are being added? -- Im still thinking in array[], so i might have a troubled thinking in regards to this. Any help is appreciated
type: AnsweredQuestion
has title: Adding objects to ArrayList confused
upvote count: 0
tagged with: java
type: Question
score: -1
has comment: http://stackoverflow.com/comment/43273909
has comment: http://stackoverflow.com/comment/43273887
tagged with: arraylist
has answer: http://stackoverflow.com/a/27414992
accepted answer: http://stackoverflow.com/a/27414992
answer count: 2
downvote count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43273956

http://stackoverflow.com/comment/43326254
type: Comment
comment on: http://stackoverflow.com/a/27432480
score: 0
type: AnswerComment
has text: @Mark Thank you for pointing that out. I've let the cast in my original answer because it was already there in OP's code. But you're right, this is useless. I removed it.

http://stackoverflow.com/comment/43139902
has text: How do I make the dialog movable over the call screen? And I'd also like to have it cancelled by dragging it out of the screen.
comment on: http://stackoverflow.com/a/27342104
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/comment/43291625
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27424862
score: 0
has text: Hello, THis depends on the server configuration and does it allow outside applications to connect to the mailserver. You may want to contact the mailServer administrator and ask them the Email-Server settings and tell them to allow external applications for your account.

http://stackoverflow.com/comment/43255828
score: 0
type: AnswerComment
type: Comment
has text: I can't set initial delay because the size will change and i can't predict the delay
comment on: http://stackoverflow.com/a/27405397

http://stackoverflow.com/q/27319495
has answer: http://stackoverflow.com/a/32659795
has answer: http://stackoverflow.com/a/77364545
score: 84
has answer: http://stackoverflow.com/a/29099913
has answer: http://stackoverflow.com/a/49479179
has answer: http://stackoverflow.com/a/71173102
has answer: http://stackoverflow.com/a/28686920
has answer: http://stackoverflow.com/a/44564303
favorite count: 0
has answer: http://stackoverflow.com/a/64489793
tagged with: java-home
has answer: http://stackoverflow.com/a/28686117
tagged with: maven
has answer: http://stackoverflow.com/a/79229263
has answer: http://stackoverflow.com/a/45317562
possible better answer: http://stackoverflow.com/a/27319530
has title: Error: JAVA_HOME is not defined correctly executing maven
has answer: http://stackoverflow.com/a/79200717
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27319530
has answer: http://stackoverflow.com/a/51229134
has comment: http://stackoverflow.com/comment/77598249
accepted answer: http://stackoverflow.com/a/28686920
tagged with: java
has comment: http://stackoverflow.com/comment/95937839
has answer: http://stackoverflow.com/a/27319543
has answer: http://stackoverflow.com/a/74992159
type: Question
has answer: http://stackoverflow.com/a/57716861
downvote count: 0
upvote count: 84
answer count: 19
has body: I installed java and set the path environment and when I run echo $JAVA_HOME in the terminal I get the following output: /usr/lib/jvm/java-7-oracle/jre/bin/java I Also installed apache-maven and changed environment file and now it looks like this: JAVA_HOME="/usr/lib/jvm/java-7-oracle/jre/bin/java" M2_HOME=/usr/local/apache-maven/apache-maven-3.0.5 M2=$M2_HOME/bin MAVEN_OPTS="-Xms256m -Xmx512m" PATH=$M2:$PATH But when I execute mvn --version I get a warning: Error: JAVA_HOME is not defined correctly. We cannot execute /usr/lib/jvm/java-7-oracle/jre/bin/java/bin/java Can not find out why it repeats in the end /bin/java/bin/java
has answer: http://stackoverflow.com/a/37479837
has answer: http://stackoverflow.com/a/36628570

http://stackoverflow.com/comment/43218847
type: AnswerComment
comment on: http://stackoverflow.com/a/27385103
score: 0
type: Comment
has text: You'll need to post more detail than that. BigDecimal is part of the core API, there shouldn't be any issue resolving it.

http://stackoverflow.com/q/27399533
has body: When using grails with a domain class hierarchy similar to the following: abstract class Vehicle { ... } class Car extends Vehicle { ... } class Motorcycle extends Vehicle { ... } and a service as the following: class VehicleService { def startRepairing(Car car) { ... } def startRepairing(Motorcycle motorcycle) { ... } } We very frequently we face errors as the following in production: No signature of method: VehicleService.startRepairing() is applicable for argument types: (Car_$$_javassist_156) values: [Id: 42343, Class: Car]. Possible solutions: startRepairing(Car) We believe this happens because we retrieve the Vehicle instance from a collection such as static hasMany = [vehicles: Vehicle], which causes the proxy to implement the abstract class Vehicle but not the concrete class (Car, Motorcycle, etc). We used to remove the argument type from the method as a solution, but we would rather have it - code is cleaner, method overload is possible, more IDE friendly... One solution we thought about is to use the infamous GrailsHibernateUtil.unwrapIfProxy when the type doesn't match any other method: class VehicleService { def startRepairing(Vehicle vehicle) { startRepairing(GrailsHibernateUtil.unwrapIfProxy(vehicle)) } def startRepairing(Car car) { /* actual business logic here */ } def startRepairing(Motorcycle motorcycle) { /* actual business logic here */ } } But then the question is, how can we test this? When running code in development we very rarely find the javassist problem, and even in production it seems to happen "randomly" (or more precisely, due to conditions that escape our knowledge :). Is it possible to force an instance to be a javassist proxy? What would be a good strategy for these kind of problems in general?
favorite count: 0
has answer: http://stackoverflow.com/a/27400134
type: UnansweredQuestion
score: 6
upvote count: 6
tagged with: java
tagged with: hibernate
type: Question
has comment: http://stackoverflow.com/comment/66220580
has comment: http://stackoverflow.com/comment/65772303
tagged with: grails
tagged with: proxy
has title: Grails: simulate a hibernate proxy for testing
answer count: 1
downvote count: 0

http://stackoverflow.com/q/27435575
type: AnsweredQuestion
upvote count: 3
accepted answer: http://stackoverflow.com/a/27435624
linked to: http://stackoverflow.com/q/849813
type: Question
tagged with: recursion
score: 3
has answer: http://stackoverflow.com/a/27435660
has body: I am using the following two functions to calculate factorials and combinations. public static long Factorial(long n) { if (n == 0) return 1; else return n * Factorial(n-1); } public static long combinations (long n, long k) { return Factorial(n)/(Factorial(k) * Factorial(n - k)); } I am testing it using: long test = combinations((long)21, (long)13); It seems to work for small numbers such as 5,2. But if I try 21,13, I get incorrect answers (negatives or 0). Would anyone know what is happening here?
tagged with: long-integer
tagged with: java
has comment: http://stackoverflow.com/comment/43312094
possible better answer: http://stackoverflow.com/a/27435660
has answer: http://stackoverflow.com/a/27435776
downvote count: 0
has answer: http://stackoverflow.com/a/27435624
favorite count: 0
answer count: 3
has comment: http://stackoverflow.com/comment/43312119
has title: Recursive function to calculate combination and factorial
has comment: http://stackoverflow.com/comment/43312124
linked to: http://stackoverflow.com/q/7215411

security
tags question: http://stackoverflow.com/q/27385736
tags question: http://stackoverflow.com/q/27335570
tags question: http://stackoverflow.com/q/27407397
tags question: http://stackoverflow.com/q/27407985
tags question: http://stackoverflow.com/q/27404118
tags question: http://stackoverflow.com/q/27338897
tags question: http://stackoverflow.com/q/27422979
tags question: http://stackoverflow.com/q/27441690
tags question: http://stackoverflow.com/q/27373109
tags question: http://stackoverflow.com/q/27352525
tags question: http://stackoverflow.com/q/27466212
tags question: http://stackoverflow.com/q/27406357
tags question: http://stackoverflow.com/q/27421862
type: Tag
tags question: http://stackoverflow.com/q/27468260
tag name: security

http://stackoverflow.com/comment/43088449
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27314087
has text: This is not the full logcat...paste the full logcat here to identify the error
score: 0

http://stackoverflow.com/q/27469718
has answer: http://stackoverflow.com/a/27469763
score: 1
tagged with: java
type: Question
answer count: 2
has body: I'm working on a code where a user inputs ten strings which is store in an array, and a search key. The code has to run a linear search based on the search key. So far this is what I've got: import java.io.*; class linstring { String array[] = new String[10]; String a = new String(); public void linsearch(String string[], String search) { string = array; search = a; int i; int flag = 0; for(i = 0; i&lt;10; i++) { if (search.equals(string[i])) { flag = 1; break; } } if (flag ==1) { System.out.println("Word found at position " +(i+1)); } else { System.out.println("Word not found."); } } public static void main(String args[])throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); linstring obj = new linstring(); System.out.println("Enter any 10 words."); String enter [] = new String[10]; int i; for (i = 0; i&lt;10; i++) { enter[i] = br.readLine(); } System.out.println("Enter word to be searched."); String search1 = br.readLine(); obj.linsearch(enter, search1); } } No compilation errors and no runtime errors found. However, there is a huge logical error. When I search for an element which IS PRESENT in the array, it says that the search was unsuccessful. How do I solve this?
has comment: http://stackoverflow.com/comment/43374722
tagged with: arrays
possible better answer: http://stackoverflow.com/a/27469763
upvote count: 1
tagged with: linear-search
has answer: http://stackoverflow.com/a/27469742
accepted answer: http://stackoverflow.com/a/27469742
favorite count: 0
has comment: http://stackoverflow.com/comment/43374794
has title: Linear search for Strings in Java
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/q/27343632
has body: I try to add a image in simple table with wicket. I searched in Google but I don't understand the answers. For the moment, I have just the path of the image in the cell. page.html page.java List<Table51Bean> tableperso = new ArrayList<Table51Bean>(); tableperso.add(new Table51Bean(getString("chap51p1n"), getString("chap51p1i"), getString("chap51p1d"), getString("chap51p1t"))); tableperso.add(new Table51Bean(getString("chap51p2n"), getString("chap51p2i"), getString("chap51p2d"), getString("chap51p2t"))); ListView<Table51Bean> perso = new ListView<Table51Bean>("perso", tableperso) { @Override protected void populateItem(final ListItem<Table51Bean> item) { // Retrieve the current Locale final Table51Bean loc = item.getModelObject(); // Add a Label for the nom item.add(new Label("perso_nom", new AbstractReadOnlyModel<String>() { @Override public String getObject() { return loc.getNom(); } })); // Add a Label for the image item.add(new Label("perso_image", new AbstractReadOnlyModel<String>() { @Override public String getObject() { return loc.getImage(); } })); // Add a Label for the description item.add(new Label("perso_description", new AbstractReadOnlyModel<String>() { @Override public String getObject() { return loc.getDescription(); } })); // Add a Label for the type item.add(new Label("perso_type", new AbstractReadOnlyModel<String>() { @Override public String getObject() { return loc.getType(); } })); } }; divchap51.add(perso); I want to know if it's possible to integrate an image in this code?
has title: Wicket add an image in simple table
type: Question
tagged with: image
tagged with: html-table
score: 0
answer count: 1
type: UnansweredQuestion
tagged with: wicket
tagged with: http://stackoverflow.com/tag/html
has answer: http://stackoverflow.com/a/27356156
tagged with: java

http://stackoverflow.com/q/27418875
has answer: http://stackoverflow.com/a/27961191
tagged with: sql-server
score: 0
has answer: http://stackoverflow.com/a/27500999
has body: I'm working on a Java project that uses jetty to run on local a webservice that access some databases. We was using jtds to access SQLServer databases, but now we need to work with DATETIME2 fields and this enforce us to use Microsft SQLServer driver instead of jtds. So, before setting all to use it, and running OK on some junit test that creates directly Connection objects using these driver, when we try the main app, we get in trouble. We have a jetty-env.xml like this : <?xml version="1.0" encoding="ISO-8859-1"?> executing jetty-env.xml jdbc/DATABASE username password databasename servername portnumber But when I launch the app with Jetty on Eclipse, I get a SQLException saying that can't log with the username. Setting a breakpoint and debuging, I saw that when the Java code gets the Datasource from context, it not have a password!!! String dsName = props.getProperty ("hibernate.connection.datasource"); // "java:comp/env/jdbc/DATABASE" Context ctx = new InitialContext(); SQLServerDataSource sqlds = (SQLServerDataSource) ctx.lookup (dsName); //sqlds.setPassword ("passoword"); DataSource ds = (DataSource) sqlds; If I uncomment the sqlds.setPassword line, it conencts ok to the database. So by a unknow reason, the SQLServerDataSource isn't not getting the password from jetty. I try to use different Any clue of wtf is happening here ? PD: We are using Jetty 6 with an old customized version of jetty-run-jetty plugin that auto apply maven overlays. So changing jetty version not is an option at this moment. edit: added dsnames string
type: UnansweredQuestion
tagged with: java
tagged with: datasource
has comment: http://stackoverflow.com/comment/43285309
has title: Microsoft SQLServer driver datasource have password empty
type: Question
has comment: http://stackoverflow.com/comment/43281171
answer count: 2

http://stackoverflow.com/q/27325536
tagged with: counter
answer count: 2
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/27328351
has answer: http://stackoverflow.com/a/27325609
accepted answer: http://stackoverflow.com/a/27325609
has body: In Hadoop we can increment counter in map/reduce task, it looks like this: ... context.getCounter(MyCountersEnum.SomeCounter).increment(1); ... Than you can find their value in log. How do you access them from code after job completes? What is Hadoop API to read counter value?
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: mapreduce
has title: How to access Hadoop counters values via API?
type: Question
tagged with: hadoop
has answer: http://stackoverflow.com/a/27328351

http://stackoverflow.com/comment/43271254
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27413525
score: 1
has text: Hopefully you realize you can simplify the last 3 if statements to test just the first condition. Since these are else clauses, you've already checked if it's a higher grade.

http://stackoverflow.com/q/27387546
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27387693
type: Question
tagged with: stdin
score: 0
has body: I'm having some trouble with this Java input: public class Testinput { public static void main(String[] args) { int N = StdIn.readInt(); String[] name = new String[N]; int[] year = new int[N]; for (int i = 0; i &lt; name.length; i++) { name[i] = StdIn.readString(); for (int j = 0; j &lt; name.length; j++) { year[j] = StdIn.readInt(); } } for (int i = 0; i &lt; name.length; i++ ) { System.out.println(name[i]+" " +year[i]); } } } For example: it needs to read name and age in an alternating order: 2 bob 1963 kelly 1981 and print: bob 1963 kelly 1961 But instead it asks for an input of length 6 (instead of 2*N = 4) and prints out: input1 input5 input4 input6 Can you guys help me with this?
answer count: 1
has title: How can i alternate this input?
has comment: http://stackoverflow.com/comment/43223232

http://stackoverflow.com/comment/43259905
comment on: http://stackoverflow.com/a/27407614
type: AnswerComment
type: Comment
has text: But `private` methods cannot be overridden. It would be pointless to override a `private` method, because it's only accessible in the class in which it's defined anyway.
score: 2

http://stackoverflow.com/q/27394891
has comment: http://stackoverflow.com/comment/43236641
tagged with: java
has title: Build login,registration system with php and mysql for android,but app can run
tagged with: mysql
has comment: http://stackoverflow.com/comment/43236544
has body: I currently work with an login and registration system for android app.I use mysql as database,php to doing that,but after doing all the system files,the app just stop when clicking to login button..pls help,below is all the code i made main.xml <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_marginBottom="2dp" android:text="Plot Out" android:textAppearance="?android:attr/textAppearanceLarge" /> <TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_alignTop="@+id/textView1" android:layout_marginTop="1dp" android:text="Bring Me Out" android:textAppearance="?android:attr/textAppearanceLarge" /> <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="10dp" android:layout_marginLeft="53dp" android:layout_marginTop="2dp" android:src="@drawable/logo" /> <TextView android:id="@+id/link_to_forgotpassword" android:clickable="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/linearLayout2" android:layout_centerHorizontal="true" android:text="Forgot Your Password?" android:textAppearance="?android:attr/textAppearanceMedium" /> login.xml <?xml version="1.0" encoding="utf-8"?> <ImageView android:src="@drawable/logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dip"/> <TextView android:layout_width="fill_parent" android:id="@+id/loginEmail" android:layout_height="wrap_content" android:textColor="#372c24" android:text="Email"/> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#372c24" android:text="Password"/> <TextView android:id="@+id/login_error" android:layout_width…
type: Question
has comment: http://stackoverflow.com/comment/43236450
has answer: http://stackoverflow.com/a/27395066
answer count: 1
accepted answer: http://stackoverflow.com/a/27395066
score: 0
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/43236623
tagged with: php
has comment: http://stackoverflow.com/comment/43236699
has comment: http://stackoverflow.com/comment/43236599
type: AnsweredQuestion

http://stackoverflow.com/a/27470081
score: 1
has comment: http://stackoverflow.com/comment/100013061
accepted answer of: http://stackoverflow.com/q/27467667
has body: According to the source code of dema(), optInTimePeriod cannot be 0: else if( ((int)optInTimePeriod &lt; 2) || ((int)optInTimePeriod &gt; 100000) ) return RetCode.BadParam ; That's why your current code returns "BadParam" and not "Success" when you call dema(). (Same thing goes for tema())
answers question: http://stackoverflow.com/q/27467667
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43378000
type: Answer

http://stackoverflow.com/comment/43091218
type: Comment
score: 0
has text: @chrylis That's your opinion.
comment on: http://stackoverflow.com/q/27315633
type: QuestionComment

http://stackoverflow.com/q/27316105
has answer: http://stackoverflow.com/a/27321547
tagged with: spring
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27320766
tagged with: java
type: Question
answer count: 2
has body: I need a bean like this This is OK. My problem is I have the student returning from a method from a different bean. I usually load the bean like this when is a property. But in this case I need the new bean itself being set from the other bean method (School object is returned from another bean method). This is what I try, and of course this is wrong: Is there any workaround?
score: 0
accepted answer: http://stackoverflow.com/a/27320766
has title: Java Spring IOC bean creation value
tagged with: spring-bean
tagged with: inversion-of-control
possible better answer: http://stackoverflow.com/a/27321547

http://stackoverflow.com/comment/43107019
type: Comment
type: QuestionComment
has text: @ajb Np! I just wanted to know what I did wrong. It is a Friday afterall ;)
comment on: http://stackoverflow.com/q/27323087
score: 0

http://stackoverflow.com/comment/43223494
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27387591
has text: When I override the hashCode to return a constant or a random int the compiler didn't panic or complain. Which made me wonder, if this is valid, why is it not advised. I missed the bigger picture of the HashSet, HashMap.. which rely on Hashing.
score: 0

http://stackoverflow.com/comment/43259440
has text: John, the answer was too general for me and may be for other people it is different. Anyways, thanks for explanation.
type: AnswerComment
comment on: http://stackoverflow.com/a/27406912
score: 0
type: Comment

http://stackoverflow.com/q/27462689
answer count: 3
has answer: http://stackoverflow.com/a/27462822
favorite count: 0
has answer: http://stackoverflow.com/a/27462772
possible better answer: http://stackoverflow.com/a/27462726
upvote count: 2
has answer: http://stackoverflow.com/a/27462726
has body: I have this code that is implemented in a class called FileUtils, which does what it sounds like. All it does is it goes through a file and puts every folder under that folder in an ArrayList, so its like calling the .listFiles() method on any file that will return something. private static ArrayList&lt;File&gt; classFileList = new ArrayList&lt;File&gt;(); public static ArrayList&lt;File&gt; listFiles(File dir) { if (!dir.isDirectory() || !dir.exists()) return null; for (File file : dir.listFiles()) { classFileList.add(file); listFiles(file); } return classFileList; } The code above works fine but it requires a class variable ArrayList to work. If I create the ArrayList inside the method then it gets reset every time it is recalled and only returns the last file. But with the set up I have now, if I call the method more than once then the list contains duplicates of every file. Either a way to use a method variable or reset the class variable after it is called.
tagged with: class-variables
type: AnsweredQuestion
tagged with: recursion
score: 2
tagged with: java
accepted answer: http://stackoverflow.com/a/27462772
type: Question
has title: How to use an ArrayList inside a method that calls itself
downvote count: 0
tagged with: arraylist

http://stackoverflow.com/a/27327281
type: Answer
downvote count: 0
score: 1
has body: This issue has been resolved by using joda time The code snippet for the same is: public static long tokenTimeDuration(String loginTime, String expiryTime){ DateTimeFormatter FMT = DateTimeFormat.forPattern("EEE MMM dd HH:mm:ss a z yyyy"); final DateTime dt1 = new DateTime(FMT.parseDateTime(loginTime).withZone(DateTimeZone.getDefault())); Log.i("du_loginTimeAfterParsing",dt1.toString()); final DateTime dt2 = new DateTime(FMT.parseDateTime(expiryTime).withZone(DateTimeZone.getDefault())); Log.i("du_expiryTimeAfterParsing",dt2.toString()); long diff = dt2.getMillis() - dt1.getMillis(); Log.i("du_tokenExpiryDuration", diff + ""); return diff; } And the logcat output now says: 12-06 06:48:22.073: I/du_loginTimeAfterParsing(10440): 2014-12-06T06:48:22.000+05:30 12-06 06:48:22.077: I/du_expiryTimeAfterParsing(10440): 2014-12-06T10:08:22.000+05:30 12-06 06:48:22.078: I/du_tokenExpiryDuration(10440): 12000000 The solution has been added so that others can get benefited from the same.
upvote count: 1
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27319166
accepted answer of: http://stackoverflow.com/q/27319166

http://stackoverflow.com/comment/43383430
has text: Answer edited, added some code that I think more closely matches the problem you're trying to solve.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27474499

http://stackoverflow.com/q/27375192
tagged with: java
tagged with: servlets
answer count: 2
tagged with: outputstream
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27375786
possible better answer: http://stackoverflow.com/a/69143211
has title: How can I put a downloadable file into the HttpServletResponse?
has answer: http://stackoverflow.com/a/69143211
score: 6
upvote count: 6
tagged with: httpresponse
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27375786
type: Question
tagged with: jakarta-ee
has body: I have the following problem: I have an HttpServlet that create a file and return it to the user that have to receive it as a download byte[] byteArray = allegato.getFile(); InputStream is = new ByteArrayInputStream(byteArray); Base64InputStream base64InputStream = new Base64InputStream(is); int chunk = 1024; byte[] buffer = new byte[chunk]; int bytesRead = -1; OutputStream out = new ByteArrayOutputStream(); while ((bytesRead = base64InputStream.read(buffer)) != -1) { out.write(buffer, 0, bytesRead); } As you can see I have a byteArray object that is an array of bytes (byte[] byteArray) and I convert it into a file in this way: First I convert it into an InputStream object. Then I convert the InputStream object into a Base64InputStream. Finally I write this Base64InputStream on a ByteArrayOutputStream object (the OutputStream out object). I think that up to here it should be ok (is it ok or am I missing something in the file creation?) Now my servlet have to return this file as a dowload (so the user have to receive the download into the browser). So what have I to do to obtain this behavior? I think that I have to put this OutputStream object into the Servlet response, something like: ServletOutputStream stream = res.getOutputStream(); But I have no idea about how exactly do it? Have I also to set a specific MIME type for the file?

http://stackoverflow.com/q/27457710
answer count: 1
has comment: http://stackoverflow.com/comment/43352500
favorite count: 0
has comment: http://stackoverflow.com/comment/43352585
upvote count: 2
accepted answer: http://stackoverflow.com/a/27479739
score: 2
type: AnsweredQuestion
has title: Could not find main class while it does exist
tagged with: java
has comment: http://stackoverflow.com/comment/43353236
tagged with: classpath
type: Question
has comment: http://stackoverflow.com/comment/43352625
has comment: http://stackoverflow.com/comment/43352679
downvote count: 0
has comment: http://stackoverflow.com/comment/43354353
has answer: http://stackoverflow.com/a/27479739
tagged with: bnd
has body: I've got an issue with running the bnd launcher. The actual problem came up during build using gradle, but it also doesn't work when I call the jar directly. The Launcher class really does exist in that jar and it does have a main method. Anyone know why I got this error? $ java -cp cnf/cache/biz.aQute.launcher/biz.aQute.launcher-1.4.0.jar aQute.launcher.Launcher Error: Could not find or load main class aQute.launcher.Launcher When I read the content of the jar, I can see that the Launcher class is really there. $ jar tvf cnf/cache/biz.aQute.launcher/biz.aQute.launcher-1.4.0.jar 1490 Fri Sep 26 06:49:00 CEST 2014 META-INF/MANIFEST.MF ... 1586 Fri Sep 26 06:49:00 CEST 2014 aQute/launcher/Launcher$1.class 2270 Fri Sep 26 06:49:00 CEST 2014 aQute/launcher/Launcher$2.class 794 Fri Sep 26 06:49:00 CEST 2014 aQute/launcher/Launcher$3.class 1133 Fri Sep 26 06:49:00 CEST 2014 aQute/launcher/Launcher$4.class 1100 Fri Sep 26 06:49:00 CEST 2014 aQute/launcher/Launcher$5.class 1260 Fri Sep 26 06:49:00 CEST 2014 aQute/launcher/Launcher$AllPermissionCollection.class 1149 Fri Sep 26 06:49:00 CEST 2014 aQute/launcher/Launcher$AllPolicy.class 37566 Fri Sep 26 06:49:00 CEST 2014 aQute/launcher/Launcher.class ... I've also tried loading another random class from another random jar and that does work. Only when the main method is missing, I get a different error (Main method not found in class). Also the rights on all these files are the same, otherwise I also couldn't run 'jar tvf'. So, any ideas?

http://stackoverflow.com/comment/43169946
score: 0
type: Comment
type: QuestionComment
has text: BTW you're not testing return value of `renameTo`.
comment on: http://stackoverflow.com/q/27357901

http://stackoverflow.com/comment/43216518
has text: it's a very clean approach! Cheers!
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27383780
type: Comment

http://stackoverflow.com/q/27322594
has answer: http://stackoverflow.com/a/27324955
answer count: 1
has body: I have a mule application deployed on linux (RHEL 6) box which talks to twilio API and Gmail API. The server where the mule application is deployed has to go out via proxy. I have modified /usr/local/mule-standalone-3.5.0/conf/wrapper.conf and added additional java property for proxy settings (using wrapper.java.additional.4) and when I search the mule process, here is what I see $ ps -ef | grep mule root 12940 12938 0 Dec04 ? 00:04:24 java -Dmule.home=/usr/local/mule-standalone-3.5.0 -Dmule.base=/usr/local/mule-standalone-3.5.0 -Djava.net.preferIPv4Stack=TRUE **-Dhttp.proxyHost=http://&lt;proxy&gt; -Dhttp.proxyPort=80 -Dhttps.proxyHost=http://&lt;proxy&gt; -Dhttps.proxyPort=80** I still am not able to hit the outbound HTTP/ HTTPS urls. Is there a different way of setting outbound proxy in mule?
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: mule
tagged with: proxy
score: 0
has title: Mule outbound HTTP endpoints via proxy

http://stackoverflow.com/comment/43206052
has text: But this requires reading the entire file just to delete one name. Is that what OP wants? If not, then `RandomAccessFile` might be a better (and perhaps only?) way to go.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27378283
type: Comment

http://stackoverflow.com/comment/43274146
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27414766
has text: You mean add `-Xss=4m` in idea64.exe.vmoptions? no that does not work since IDEA can not recognize this option and doesn't launch.
score: 0

http://stackoverflow.com/q/27359953
has body: *How can i make sure my validAccounts array does not have null values?** This program is an ATM program that uses a text file and checks to see if the user's password and account number matches the possible passwords and balance from the text file import java.util.*; import java.io.*; public class ATM2 { public static Scanner kbd; public static final int MAXSIZE = 60000; public static void main(String[] args) { kbd = new Scanner(System.in); Scanner input = null; String[] validAccounts = new String[MAXSIZE]; int lineNum = 1; try { input = new Scanner(new File("ATMdata.txt")); // counts how many lines are in text while (input.hasNextLine()) { String line; line = input.nextLine(); lineNum++; } // sets the array to the number of lines in text validAccounts = new String[lineNum]; // prints out the number of lines in text System.out.println(lineNum); input.close(); } catch (FileNotFoundException e) { System.out.println("There was an error opening one of the files."); } try { int count = 0; input = new Scanner(new File("ATMdata.txt")); // counts how many lines are in text while (input.hasNextLine()) { String line; line = input.nextLine(); validAccounts[count] = line; count++; System.out.println(line); } input.close(); } catch (FileNotFoundException e) { System.out.println("There was an error opening file"); } System.out.println("What is your account number?"); String acctNum = kbd.nextLine(); System.out.println("What is the password?"); String pwd = kbd.nextLine(); checkID(acctNum, pwd,validAccounts); } // Each entry in the validAccounts array is assumed to be holding: // the account number followed by // a space, followed by // the password for the account // followed by a space // followed by the current balance. public static String checkID(String acctNum, String pwd, String[] validAccounts) { String account = "" ; String password = "" ; String balance; String result = "error"; //This is supposed to check the array for a valid input for(int i = 0; i &lt;validAccounts.le…
favorite count: 0
has comment: http://stackoverflow.com/comment/43172084
type: UnansweredQuestion
duplicate of: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/43172137
has answer: http://stackoverflow.com/a/27360084
has answer: http://stackoverflow.com/a/27360142
score: -4
type: Question
has title: How do I fill my validAccounts array-it shows that there are null values in it
has comment: http://stackoverflow.com/comment/43172054
linked to: http://stackoverflow.com/q/218384
has comment: http://stackoverflow.com/comment/43172126
tagged with: java
answer count: 2
downvote count: 4
upvote count: 0
has comment: http://stackoverflow.com/comment/43172022

http://stackoverflow.com/q/27354375
has comment: http://stackoverflow.com/comment/43161923
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43162559
has comment: http://stackoverflow.com/comment/43162207
has answer: http://stackoverflow.com/a/27354869
linked to: http://stackoverflow.com/q/58306
score: 0
linked to: http://stackoverflow.com/q/26857842
type: Question
tagged with: graph
has comment: http://stackoverflow.com/comment/43162680
tagged with: algorithm
tagged with: java
tagged with: directed-graph
accepted answer: http://stackoverflow.com/a/27354869
has comment: http://stackoverflow.com/comment/43162648
has comment: http://stackoverflow.com/comment/43161905
answer count: 1
has title: Performant Graph algorithm to find path from node to root in a directed graph
has comment: http://stackoverflow.com/comment/43166347
has body: I have a directed graph with a special root node from which all other nodes are reachable. It is quite easy to find an arbitrary algorithm to find all pathes from a giving node to the root, for example this solution (DFS) using LinkedHashSets. Well, this algorithm works well for small graphs but with larger graphs it doesn't come to an end in a reasonable amount of time. My example graph has 129 nodes and 200 edges. In my eyes not an extremly HUGE graph... Can somebody give me a hint how to solve this problem efficiently? Maybe we can make use of other properties of my graphs. They all are: connected directed with loops have a designated starting node have a designated end node

http://stackoverflow.com/a/27364528
type: Answer
score: 1
upvote count: 1
downvote count: 0
has body: You don't have a zero-argument constructor for PersonalAccount which is why the given statement would fail. Is that the problem you are having?
answers question: http://stackoverflow.com/q/27364260

http://stackoverflow.com/a/27400562
downvote count: 0
has body: Instead of adding a new JLabel to the frame, store the original to a field of the enclosing class. Then you can simply call label.setIcon(theNewIcon), where I'm assuming the field is named label. See the relevant documentation.
score: 5
type: Answer
answers question: http://stackoverflow.com/q/27400444
has comment: http://stackoverflow.com/comment/43248054
upvote count: 5

http://stackoverflow.com/q/27385667
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27386777
tagged with: spring
type: AnsweredQuestion
score: 1
tagged with: amazon-rds
tagged with: mysql
upvote count: 1
type: Question
has body: I'm trying to integrate Amazon RDS with webapp developed in Spring MVC. I'm using Flyway as db migration tool. I'm able to connect to the RDS but the thing is whenever flyway starts the migration, it tries to create schema_version table without firing use database_name query. And that's where RDS throws error saying "No Database Selected". I tried setting schema for flyway, flyway.setSchemas("koomi");, but no help, its still giving same error. So is there any way by which we can make flyway to execute use database_name query before it fires query for schema_version?
accepted answer: http://stackoverflow.com/a/27386777
tagged with: java
has title: Amazon RDS + Spring MVC + Flyway - Getting no database selected
tagged with: flyway

http://stackoverflow.com/q/27316185
has comment: http://stackoverflow.com/comment/43092337
has body: I have two times variable as string want to find the mean time. please help me inTime = shift.getInTime()+":00"; outTime = shift.getOutTime()+":00"; SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss"); Date d1=df.parse(inTime); Date d2 = df.parse(outTime); long date1InMilSec=d1.getTime(); long date2InMilSec=d2.getTime(); long half =date1InMilSec + ((date2InMilSec - date1InMilSec) / 2); long minute = (half / (1000 * 60)) % 60; long hour = (half / (1000 * 60 * 60)) % 24; String time = String.format("%02d:%02d", hour, minute);
has comment: http://stackoverflow.com/comment/43092282
favorite count: 0
upvote count: 1
has answer: http://stackoverflow.com/a/27316743
type: AnsweredQuestion
score: 1
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/27316715
answer count: 2
has answer: http://stackoverflow.com/a/27316715
downvote count: 0
accepted answer: http://stackoverflow.com/a/27316743
has title: mean time of two string time in java

http://stackoverflow.com/comment/43145041
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27342892
has text: @DanielWu There is a class 'AbstractRefreshableApplicationContext' in Spring and it has a method 'loadBeanDefinitions' so maybe it would be a good way to check it out. You could enforce 'refresh()' on the context and then 'loadBeanDefinitions' would get called... but it is a long shot.
score: 0

http://stackoverflow.com/q/27353203
has comment: http://stackoverflow.com/comment/43159945
has comment: http://stackoverflow.com/comment/43159970
answer count: 0
has title: Storing scraped data from web page to json object using java
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: Iam scraping the mobiles data from the web page , I need mobile name and price of all the mobiles of that page into json object below is my code: Elements mobilename = document.select( "#products div.product-unit div.pu-title "); Elements price = document.select( "#products div.product-unit div.pu-price div.pu-final span.fk-font-17"); for(Element url1:mobilename) { text=url1.text(); System.out.println(text); for(Element b:price) { text1= b.text(); System.out.println(text1); arr1.add(text1); arr1.add(text); } pa.put("price",text1 ); pa.put("name", text); obj7.add(pa); } json.put("mobile:", obj7); I am trying for the following out put for all the mobiles in a page: {"mobile:":[{"price":"Rs. ","name":""}
type: Question
score: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/43111024
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27325475
has text: I would like to pass your code on ide.com, but your code is giving wrong answer there (switched s1 with s2): [link](http://ideone.com/ytilpY)
score: 0

http://stackoverflow.com/comment/43272196
comment on: http://stackoverflow.com/q/27414023
score: 0
type: Comment
type: QuestionComment
has text: you never call findLargestInt from main

http://stackoverflow.com/q/27356505
tagged with: servlet-3.0
possible better answer: http://stackoverflow.com/a/27386683
has body: so far i m trying BufferedImage img = ImageIO.read(new ByteArrayInputStream(bytes)); but its give an error does don't support ImageIO in Apps engine.
answer count: 2
tagged with: google-cloud-platform
downvote count: 0
tagged with: jsp
favorite count: 0
tagged with: google-app-engine
has answer: http://stackoverflow.com/a/27386683
accepted answer: http://stackoverflow.com/a/27371815
upvote count: 3
tagged with: java
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27371815
score: 3
has title: convert byte array to image in Java using Google apps engine

http://stackoverflow.com/comment/43132855
has text: `dt = currentTime - lastTime` is simply performing maths. If game is paused don't do this! But *do* set lastTime to currentTime. Think about it.
score: 0
comment on: http://stackoverflow.com/q/27338060
type: QuestionComment
type: Comment

http://stackoverflow.com/a/27357770
score: 6
upvote count: 7
downvote count: 1
has body: I found out by searching around checking at the API's. Here is my code: import java.time.Duration import javax.xml.bind.annotation.adapters.XmlAdapter; import javax.xml.datatype.DatatypeFactory; public class DurationAdapter extends XmlAdapter&lt;javax.xml.datatype.Duration, Duration&gt; { @Override public Duration unmarshal(javax.xml.datatype.Duration v) throws Exception { return Duration.parse(v.toString()); } @Override public javax.xml.datatype.Duration marshal(Duration v) throws Exception { return DatatypeFactory.newInstance().newDuration(v.toString()); } }
accepted answer of: http://stackoverflow.com/q/27314093
has comment: http://stackoverflow.com/comment/89399231
has comment: http://stackoverflow.com/comment/106696954
answers question: http://stackoverflow.com/q/27314093
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/q/27380199
has answer: http://stackoverflow.com/a/27380378
linked to: http://stackoverflow.com/q/767759
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27380239
has comment: http://stackoverflow.com/comment/43209499
tagged with: java
has answer: http://stackoverflow.com/a/27380239
type: Question
accepted answer: http://stackoverflow.com/a/27380378
has body: I am trying to print a line from the listed file, which contains a word stated. But the program does nothing. Can someone help me with the code? Thanks import java.io.File; import java.util.ArrayList; import java.util.Scanner; public class SearchingArrayLists { public static void main(String[] args) throws Exception { ArrayList names = new ArrayList(); Scanner scan = new Scanner(new File("random.txt")); while (scan.hasNext()){ names.add(scan.next()); } if (names.contains("legal")){ System.out.println(scan.next()); } scan.close(); } } UPDATE: Sorry, removed the loop. the file contains random text where the word "legal" is in there. the file was read by the scanner beforehand.
has comment: http://stackoverflow.com/comment/43209641
has comment: http://stackoverflow.com/comment/43209485
has title: Program terminates without printing anything
score: 0
answer count: 2
linked to: http://stackoverflow.com/q/2770321
has comment: http://stackoverflow.com/comment/43209523
tagged with: string
has comment: http://stackoverflow.com/comment/43209630

embedded-tomcat-8
tag name: embedded-tomcat-8
type: Tag
tags question: http://stackoverflow.com/q/27318439

http://stackoverflow.com/a/27324677
type: Answer
has body: In order to convert the string to an integer, use the Integer.parseInt() method. For long types, Long.parseLong(). And so on.
upvote count: 2
score: 2
accepted answer of: http://stackoverflow.com/q/27324643
has comment: http://stackoverflow.com/comment/43108621
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27324643

http://stackoverflow.com/comment/43135139
comment on: http://stackoverflow.com/q/27339282
type: Comment
type: QuestionComment
has text: I think that is not the good solution
score: 0

http://stackoverflow.com/comment/43148279
type: Comment
type: QuestionComment
has text: Why isn't the `all` version with `@xsi:type` not suitable?
comment on: http://stackoverflow.com/q/27345944
score: 0

http://stackoverflow.com/a/27353982
answers question: http://stackoverflow.com/q/27353878
score: 0
type: Answer
has body: You can use reflection to do this, e.g. String line=null; Method method = null; while((line=br.readLine())!=null) { String words[]=line.split(" "); for(int i=0;i&lt;words.length;i++) { String temp=words[i]; method = getClass().getMethod(temp); method.invoke(this); } } That's assuming you want to call the method on this, of course, and that it's an instance method. Look at Class.getMethod and related methods, along with Method itself, for more details. You may want getDeclaredMethod instead, and you may need to make it accessible. I would see if you can think of a way of avoiding this if possible though - reflection tends to get messy quickly. It's worth taking a step back and considering if this is the best design. If you give us more details of the bigger picture, we may be able to suggest alternatives.

jmstemplate
tags question: http://stackoverflow.com/q/27378948
tag name: jmstemplate
type: Tag

http://stackoverflow.com/comment/43351733
type: QuestionComment
comment on: http://stackoverflow.com/q/27457248
score: 1
has text: So what is your question actually?
type: Comment

http://stackoverflow.com/comment/43128588
score: 0
type: QuestionComment
type: Comment
has text: This depends ENTIRELY on what you're going to do with the object downstream, and what conventions you have adopted for use of these objects. Either answer may be more efficient for some programs and wrong for others.
comment on: http://stackoverflow.com/q/27334917

http://stackoverflow.com/comment/43375914
comment on: http://stackoverflow.com/a/27470515
score: 0
type: Comment
has text: But it's invoking an empty constructor, so what side effects are there?
type: AnswerComment

http://stackoverflow.com/q/27444077
tagged with: weka
has title: Weka throws "UnassignedDatasetException"
answer count: 1
linked to: http://stackoverflow.com/q/12151702
accepted answer: http://stackoverflow.com/a/27444859
favorite count: 0
upvote count: 5
has answer: http://stackoverflow.com/a/27444859
type: AnsweredQuestion
downvote count: 0
tagged with: java
type: Question
score: 5
has body: I am working with Weka 3.6.11 and I am having an error which I can't figure out what is causing it. I have followed pages 202-204 in the Weka manual and have constructed my data like they say. Still when I try t classify the data I get an error. weka.core.UnassignedDatasetException: Instance doesn't have access to a dataset! Here is the code I have so far: public static void classifyTest() { try { Classifier classifier = (Classifier)weka.core.SerializationHelper.read("iris120.model"); System.Console.WriteLine("----------------------------"); weka.core.Attribute sepallength = new weka.core.Attribute("sepallength"); weka.core.Attribute sepalwidth = new weka.core.Attribute("sepalwidth"); weka.core.Attribute petallength = new weka.core.Attribute("petallength"); weka.core.Attribute petalwidth = new weka.core.Attribute("petalwidth"); FastVector labels = new FastVector(); labels.addElement("Iris-setosa"); labels.addElement("Iris-versicolor"); labels.addElement("Iris-virginica"); weka.core.Attribute cls = new weka.core.Attribute("class", labels); FastVector attributes = new FastVector(); attributes.addElement(sepallength); attributes.addElement(sepalwidth); attributes.addElement(petallength); attributes.addElement(petalwidth); attributes.addElement(cls); Instances dataset = new Instances("TestInstances", attributes, 0); double[] values = new double[dataset.numAttributes()]; values[0] = 5.0; values[1] = 3.5; values[2] = 1.3; values[3] = 0.3; Instance inst = new Instance(1,values); dataset.add(inst); // Here I try to classify the data that I have constructed. try { double predictedClass = classifier.classifyInstance(inst); System.Console.WriteLine("Class1: (irisSetosa): " + predictedClass); } catch (java.lang.Exception ex) { ex.printStackTrace(); } System.Console.ReadLine(); } catch (java.lang.Exception ex) { ex.printStackTrace(); System.Console.ReadLine(); } } From the error message I take it that I need to assign my dataset something but I do not know what or how. Can someo…
has comment: http://stackoverflow.com/comment/43332105

http://stackoverflow.com/comment/43098469
type: QuestionComment
score: 0
has text: That's kind of broad topic (so is debugging a 404). Does your app have a `web.xml` or have you use `@WebServlet` or directly through the `ServletContext`?
comment on: http://stackoverflow.com/q/27319524
type: Comment

http://stackoverflow.com/comment/43233578
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27393142
has text: for(int j = 0; j < s.length() - 1; i += n){ how come i += n is here?
type: Comment

http://stackoverflow.com/q/27411666
tagged with: jsp
tagged with: struts2
score: 0
has title: Using session with Struts2 in JSP
has answer: http://stackoverflow.com/a/27412495
answer count: 1
has comment: http://stackoverflow.com/comment/43269132
accepted answer: http://stackoverflow.com/a/27412495
has comment: http://stackoverflow.com/comment/43268964
type: AnsweredQuestion
tagged with: java
has body: I have a login (username and password stored in MySQL database). After insert username and password in textfield, the class Login controls if the username and password are stored in database or not, then in my 'LoginRiuscito.jsp' i want to write Welcome username. This is my index.jsp: <s:form action="acces" id="login" style="display:none"> Login <s:label value="Username"/><s:textfield id="username" name="username" required="true"/> <s:label value="Password"/><s:password name="password" required="true"/> <s:submit value="Accedi"/> </s:form> This is my Class named 'Login': public class Login extends ActionSupport implements SessionAware { public String accesso() throws ClassNotFoundException, SQLException{ Connessione(); // DB connection method QueryL(); // Query for login session.put("username",username); return QueryL(); } public void setUsername(String username) {this.username = username;} public String getUsername() {return username;} public String getPassword() {return password;} public void setPassword(String password) {this.password = password;} public Map<String, Object> getSession(){return session;} @Override public void setSession(Map<String, Object> session) { this.session=session; } I have this in 'LoginRiuscito.jsp' : Welcome : <s:property value="%{#session.Login.username}" /> But it doesn't work, when i go in 'LoginRiuscito.jsp' i see only "Welcome: "
type: Question
tagged with: session

http://stackoverflow.com/comment/43128202
type: QuestionComment
has text: [How to Use Key Bindings](http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html)
comment on: http://stackoverflow.com/q/27335644
score: 0
type: Comment

tabactivity
tags question: http://stackoverflow.com/q/27355388
type: Tag
tag name: tabactivity

mysql
tags question: http://stackoverflow.com/q/27443992
tags question: http://stackoverflow.com/q/27463506
tags question: http://stackoverflow.com/q/27361526
tags question: http://stackoverflow.com/q/27347799
tags question: http://stackoverflow.com/q/27321101
tags question: http://stackoverflow.com/q/27327617
tags question: http://stackoverflow.com/q/27324146
tags question: http://stackoverflow.com/q/27433367
tags question: http://stackoverflow.com/q/27416065
tags question: http://stackoverflow.com/q/27395923
tags question: http://stackoverflow.com/q/27321271
tags question: http://stackoverflow.com/q/27336073
tag name: mysql
tags question: http://stackoverflow.com/q/27373189
tags question: http://stackoverflow.com/q/27358881
tags question: http://stackoverflow.com/q/27358576
tags question: http://stackoverflow.com/q/27419208
tags question: http://stackoverflow.com/q/27462258
tags question: http://stackoverflow.com/q/27396725
tags question: http://stackoverflow.com/q/27393785
tags question: http://stackoverflow.com/q/27473941
tags question: http://stackoverflow.com/q/27331978
tags question: http://stackoverflow.com/q/27392174
tags question: http://stackoverflow.com/q/27452749
tags question: http://stackoverflow.com/q/27384509
tags question: http://stackoverflow.com/q/27357474
tags question: http://stackoverflow.com/q/27346031
tags question: http://stackoverflow.com/q/27472407
tags question: http://stackoverflow.com/q/27463307
tags question: http://stackoverflow.com/q/27318041
tags question: http://stackoverflow.com/q/27347595
tags question: http://stackoverflow.com/q/27366445
tags question: http://stackoverflow.com/q/27329315
tags question: http://stackoverflow.com/q/27468975
tags question: http://stackoverflow.com/q/27329482
tags question: http://stackoverflow.com/q/27316338
tags question: http://stackoverflow.com/q/27342455
tags question: http://stackoverflow.com/q/27342807
tags question: http://stackoverflow.com/q/27333003
tags question: http://stackoverflow.com/q/27353652
tags question: http://stackoverflow.com/q/27377951
tags question: http://stackoverflow.com/q/27352414
tags question: http://stackoverflow.com/q/27421988
tags question: http://stackoverflow.com/q/27445362
tags question: http://stackoverflow.com/q/27385667
tags question: http://stackoverflow.com/q/27316537
tags question: http://stackoverflow.com/q/27354321
tags question: http://stackoverflow.com/q/27332658
tags question: http://stackoverflow.com/q/27385363
tags question: http://stackoverflow.com/q/27319497
tags question: http://stackoverflow.com/q/27348225
tags question: http://stackoverflow.com/q/27465454
tags question: http://stackoverflow.com/q/27332532
tags question: http://stackoverflow.com/q/27464049
tags question: http://stackoverflow.com/q/27472833
tags question: http://stackoverflow.com/q/27371659
tags question: http://stackoverflow.com/q/27343383
tags question: http://stackoverflow.com/q/27442252
tags question: http://stackoverflow.com/q/27451278
tags question: http://stackoverflow.com/q/27426724
tags question: http://stackoverflow.com/q/27376192
tags question: http://stackoverflow.com/q/27416374
tags question: http://stackoverflow.com/q/27406183
tags question: http://stackoverflow.com/q/27472743
tags question: http://stackoverflow.com/q/27330856
tags question: http://stackoverflow.com/q/27387770
type: Tag
tags question: http://stackoverflow.com/q/27343815
tags question: http://stackoverflow.com/q/27456518
tags question: http://stackoverflow.com/q/27438276
tags question: http://stackoverflow.com/q/27443958
tags question: http://stackoverflow.com/q/27443938
tags question: http://stackoverflow.com/q/27343227
tags question: http://stackoverflow.com/q/27355932
tags question: http://stackoverflow.com/q/27439178
tags question: http://stackoverflow.com/q/27325959
tags question: http://stackoverflow.com/q/27470724
tags question: http://stackoverflow.com/q/27360970
tags question: http://stackoverflow.com/q/27432603
tags question: http://stackoverflow.com/q/27330338

http://stackoverflow.com/comment/43380344
score: 5
comment on: http://stackoverflow.com/q/27472928
type: Comment
type: QuestionComment
has text: Your changeFile code ignores the file path inFile you pass in.

http://stackoverflow.com/comment/43382733
type: AnswerComment
has text: Yes, then you replace tools folder and reopen eclipse
comment on: http://stackoverflow.com/a/27466549
type: Comment
score: 1

http://stackoverflow.com/comment/43105490
type: Comment
comment on: http://stackoverflow.com/q/27323087
has text: possible duplicate of [how to convert object to string in java](http://stackoverflow.com/questions/6055476/how-to-convert-object-to-string-in-java)
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43240168
comment on: http://stackoverflow.com/q/27393834
type: Comment
type: QuestionComment
has text: Are your changes committed to database from application A before reading from app B?
score: 0

http://stackoverflow.com/a/27361721
type: Answer
upvote count: 0
has body: I'm an idiot. I didn't call close on my PrintWriter.
score: -1
has comment: http://stackoverflow.com/comment/43175705
downvote count: 1
answers question: http://stackoverflow.com/q/27361618

http://stackoverflow.com/comment/111686807
score: 0
comment on: http://stackoverflow.com/a/27420529
type: AnswerComment
has text: Will this provide a better performance than I iterate and filter on list of Student objects? Under compulsion i have to o in Java 7
type: Comment

http://stackoverflow.com/q/27347018
answer count: 1
has answer: http://stackoverflow.com/a/27375482
accepted answer: http://stackoverflow.com/a/27375482
has comment: http://stackoverflow.com/comment/43196501
upvote count: 1
tagged with: bufferedimage
has body: I am reading bufferedImages in from PNGs, and converting them to int arrays using the PixelGrabber. My question is then: how do I use the integer array to make the corresponding OpenCV Mat? Where the array is 1D, with each value representing a pixel's combined RGB value. I have already tried using byte arrays.
tagged with: opencv
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43187850
has title: How to convert an int[] to an OpenCV Mat? (and vice-versa)
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43159338
tagged with: image
type: Question
has comment: http://stackoverflow.com/comment/43158506
tagged with: arrays
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43200421

http://stackoverflow.com/q/27324643
has comment: http://stackoverflow.com/comment/43108609
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27324677
tagged with: java
upvote count: 1
type: Question
score: -1
has comment: http://stackoverflow.com/comment/43108403
answer count: 2
has body: Consider the following input as an example: User_Input> x which is read from the following code: Scanner scan= new Scanner(System.in); String s = scan.nextLine(); Is it possible to declare a numerical variable which has the same name of the string read?
has answer: http://stackoverflow.com/a/27324781
favorite count: 0
has title: Converting character inputs into numerical variables
has answer: http://stackoverflow.com/a/27324677
downvote count: 2
possible better answer: http://stackoverflow.com/a/27324781

http://stackoverflow.com/a/27355257
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27354556
has body: AsyncTask enables proper and easy use of the UI thread. This class allows to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers. public void commandModule(String url) { try { new RequestTask().execute(url); } catch (Exception e) { } } @Override public void onClick(View v) { if (checkBox1.isChecked()) { commandModule("http://192.168.1.102/?command1"); } else { commandModule("http://192.168.1.102/?command2"); } if (checkBox2.isChecked()) { commandModule("http://192.168.1.102/?command3"); } else { commandModule("http://192.168.1.102/?command4"); } } private class RequestTask extends AsyncTask&lt;String,Void,Void&gt;{ @Override protected void onPreExecute() { super.onPreExecute(); } protected void doInBackground(String... args){ String url=args[0]; try { HttpClient httpClient = new DefaultHttpClient(); httpClient.execute(new HttpGet(url)); } catch (Exception e) { } } @Override protected void onPostExecute() { } } onPreExecute() – Executed when execute() method is called inside commandModule() (In short When AsyncTask is triggered). doInBackground() – Executed when onPreExecute() completed executing. Al the long task are handled here onPostExecute() – Background job is finished

http://stackoverflow.com/comment/43164960
type: QuestionComment
comment on: http://stackoverflow.com/q/27348702
has text: I will do next time :)
score: 0
type: Comment

http://stackoverflow.com/comment/43170463
type: QuestionComment
comment on: http://stackoverflow.com/q/27356803
has text: Kindly see the updated code to understand more in detail
score: 0
type: Comment

http://stackoverflow.com/a/27364226
accepted answer of: http://stackoverflow.com/q/27363345
upvote count: 1
has body: There should be no need to use a ComponentListener to resize components. That is the job of the layout managers that you use to dynamically resize the components. You should not be adding the text area to a JPanel first. Instead when using text areas you would generally add the text area directly to the viewport of a JScrollPane by using code like: JScrollPane scrollPane = new JScrollPane( textArea ); Then you add the scrollpane to the frame with code like: frame.add(scrollPane, BorderLayout.CENTER); As you have noticed you should also NOT use hardcoded literals like "Center". Instead use the variables provided by the layout manager. Since you are using a BorderLayout, use the variables defined in the BorderLayout class. Also, you should NOT be using static variable to create your GUI. I suggest you read the section from the Swing tutorial on Layout Manager. The tutorial will give you more information and the example code will show you how to better structure your program so that you don't need to use static variables.
has comment: http://stackoverflow.com/comment/43183612
score: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27363345
type: Answer

http://stackoverflow.com/comment/43135658
type: QuestionComment
has text: `public double posquadForm(int ax, int bx, int c)` takes in 3 integers, but when you call `System.out.println("Your answer is" + work.posquadForm() +"or" + work.negquadForm() +".");`, you are not passing in any integers.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27339470

http://stackoverflow.com/comment/43233431
type: Comment
comment on: http://stackoverflow.com/q/27393011
score: 0
has text: what are your 100 fields?? Are they all the same type?
type: QuestionComment

jar
tags question: http://stackoverflow.com/q/27409107
tags question: http://stackoverflow.com/q/27348016
tags question: http://stackoverflow.com/q/27407361
tags question: http://stackoverflow.com/q/27401360
tags question: http://stackoverflow.com/q/27362063
tags question: http://stackoverflow.com/q/27325927
tags question: http://stackoverflow.com/q/27317083
tags question: http://stackoverflow.com/q/27442308
tags question: http://stackoverflow.com/q/27437743
tags question: http://stackoverflow.com/q/27359359
tags question: http://stackoverflow.com/q/27439049
tags question: http://stackoverflow.com/q/27432730
tags question: http://stackoverflow.com/q/27387646
type: Tag
tags question: http://stackoverflow.com/q/27438821
tags question: http://stackoverflow.com/q/27417100
tags question: http://stackoverflow.com/q/27381027
tags question: http://stackoverflow.com/q/27374534
tags question: http://stackoverflow.com/q/27431001
tags question: http://stackoverflow.com/q/27361112
tags question: http://stackoverflow.com/q/27382259
tag name: jar
tags question: http://stackoverflow.com/q/27319332
tags question: http://stackoverflow.com/q/27315633
tags question: http://stackoverflow.com/q/27424364
tags question: http://stackoverflow.com/q/27467095
tags question: http://stackoverflow.com/q/27447765
tags question: http://stackoverflow.com/q/27319423
tags question: http://stackoverflow.com/q/27413411
tags question: http://stackoverflow.com/q/27459054
tags question: http://stackoverflow.com/q/27347534
tags question: http://stackoverflow.com/q/27314197
tags question: http://stackoverflow.com/q/27349189
tags question: http://stackoverflow.com/q/27364857
tags question: http://stackoverflow.com/q/27373757
tags question: http://stackoverflow.com/q/27457639
tags question: http://stackoverflow.com/q/27472311
tags question: http://stackoverflow.com/q/27356920
tags question: http://stackoverflow.com/q/27439263
tags question: http://stackoverflow.com/q/27390088
tags question: http://stackoverflow.com/q/27419022
tags question: http://stackoverflow.com/q/27405239
tags question: http://stackoverflow.com/q/27420944

http://stackoverflow.com/q/27321465
tagged with: spring
has comment: http://stackoverflow.com/comment/43200904
has comment: http://stackoverflow.com/comment/43109254
answer count: 0
tagged with: cxf
tagged with: java
has body: I have searched and searched and tried several different solutions I've found on the internet including this website. However, my problem persists. I'm trying to write a CXF (3.0.2) https client using a spring configuration. No matter what I try I keep getting the following error: javax.xml.ws.soap.SOAPFaultException: No conduit initiator was found for the namespace http://schemas.xmlsoap.org/soap/http I've surmised this means my CXF is not initialized properly, but I haven't been able to figure out what I'm doing wrong. I've followed the CXF guide and examples. Here is my Spring config: &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:sec="http://cxf.apache.org/configuration/security" xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:test123="http://example.com/XXX/ServiceDefinition/WSDLServiceClient/TestJunctionImpl" 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://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd"&gt; &lt;http:conduit name="*.http-conduit"&gt; &lt;http:tlsClientParameters&gt; &lt;sec:keyManagers keyPassword="password"&gt; &lt;sec:keyStore type="JKS" password="password" file="my/file/dir/Morpit.jks"/&gt; &lt;/sec:keyManagers&gt; &lt;sec:trustManagers&gt; &lt;sec:keyStore type="JKS" password="password" file="my/file/dir/Truststore.jks"…
type: Question
tagged with: apache
has comment: http://stackoverflow.com/comment/43105949
score: 0
linked to: http://stackoverflow.com/q/7611803
has title: Java CXF HTTPS Client error
type: UnansweredQuestion

http://stackoverflow.com/a/27445469
has comment: http://stackoverflow.com/comment/43330657
type: Answer
has comment: http://stackoverflow.com/comment/43388281
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27445342
has body: SQLSTATE 42501 The authorization ID does not have the privilege to perform the specified operation on the identified object. You just need to give the database user account the necessary permissions.
has comment: http://stackoverflow.com/comment/43330080
answers question: http://stackoverflow.com/q/27445342
type: AcceptedAnswer
downvote count: 0
score: 1

http://stackoverflow.com/q/27468975
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43373550
tagged with: jsf
tagged with: mysql
type: Question
has title: JSF + Hibernate serverError: class javax.el.PropertyNotFoundException
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/43373403
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27476820
has body: I have created a very simple CRUD application using JSF, Hibernate and integrated them with MySQL. Problem is, whenever I try to add new data, I get the following exception: serverError: class javax.el.PropertyNotFoundException Target Unreachable, identifier 'customer' resolved to null Here's my view: <h:head> JSF Hibernate CRUD Example </h:head> <h:body> <h:form> <h:panelGrid id="panel1" columns="2" border="1" cellpadding="5" cellspacing="1"> <f:facet name="header"> <h:outputText value="Add Customer Information"/> </f:facet> <h:outputLabel value="First Namer:"/> <h:inputText value="#{customer.firstName}" id="fn"/> <h:outputLabel value="Last Name:"/> <h:inputText value="#{customer.lastName}" id="ln"/> <h:outputLabel value="Email:"/> <h:inputText value="#{customer.email}" id="eml"/> <h:outputLabel value="Date of Birth:"/> <h:inputText value="#{customer.sd}" id="s"/> <f:facet name="footer"> <h:outputLabel value="#{customer.msg}" id="msg" styleClass="msg"/> <h:commandButton value="Save" action="#{customer.saveCustomer}"> <f:ajax render="fn ln eml s msg" execute="@form"/> </h:commandButton> </f:facet> </h:panelGrid> </h:form> <h:form> <h:panelGrid id="panel2" columns="2" border="1" cellpadding="5" cellspacing="1"> <f:facet name="header"> <h:outputText value="Update/Delete Customer Info"/> </f:facet> <h:outputLabel value="Select Customer:"/> <h:selectOneMenu value="#{customer.selectedname}" id="ulist"> <f:selectItems value="#{customer.allCustomers}"/> <f:ajax event="change" render="cid fname lname email sd" listener="#{customer.fullInfo}"/> </h:selectOneMenu> <h:outputLabel value="Customer ID:"/> <h:inputText value="#{customer.custId}" id="cid" readonly="true"/> <h:outputLabel value="First Name:"/> <h:inputText value="#{customer.firstName}" id="fname"/> <h:outputLabel value="Last Name:"/> <h:inputText value="#{customer.lastName}" id="lname"/> <h:outputLabel value="Email:"/> <h:inputText value="#{customer.email}" id="email"/> <h:outputLabel value="Date of Birth:"/> <h:inp…
has answer: http://stackoverflow.com/a/28985396

http://stackoverflow.com/comment/43149671
comment on: http://stackoverflow.com/a/27347424
type: AnswerComment
type: Comment
has text: An integer division might not be ideal, for an average temperature.
score: 1

http://stackoverflow.com/a/27463186
type: Answer
score: 2
answers question: http://stackoverflow.com/q/27463098
upvote count: 2
has body: Remove the broken ..\appcompat_v7 from your libraries. And do remove the android-support-v4.jar from libs folder of your project as it is already present in android-support-v7-appcompat
accepted answer of: http://stackoverflow.com/q/27463098
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27333329
possible better answer: http://stackoverflow.com/a/27333772
has answer: http://stackoverflow.com/a/27333772
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27333568
has answer: http://stackoverflow.com/a/27333683
has comment: http://stackoverflow.com/comment/43125169
linked to: http://stackoverflow.com/q/27327721
downvote count: 1
type: Question
tagged with: java
score: -1
answer count: 3
upvote count: 0
has answer: http://stackoverflow.com/a/27333568
has comment: http://stackoverflow.com/comment/43124311
tagged with: countdown
has body: I need to update time every second on a countdown timer which counts down to Christmas. How do I update the time in my text view.I do not have the code in the onCreate method. here is some of my code. When I run the code it gives the exact time, but it does not countdown live on screen. Any ideas? Edit: the readThisPeriod is for calculating the time left until Christmas. public void DateCalculator() { Calendar today = Calendar.getInstance(); Calendar thatDay = Calendar.getInstance(); thatDay.set(Calendar.DAY_OF_MONTH, 25); thatDay.set(Calendar.MONTH, 11); // 0-11 so 1 less thatDay.set(Calendar.YEAR, 2014); thatDay.set(Calendar.HOUR, 0); thatDay.set(Calendar.MINUTE, 0); thatDay.set(Calendar.SECOND, 0); thatDay.set(Calendar.AM_PM, 0); System.out.println(thatDay.getTime()); ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1); scheduledExecutorService.scheduleAtFixedRate(new ReadThisPeriod(thatDay), 0, 1, TimeUnit.SECONDS); long diff = (thatDay.getTimeInMillis() - today.getTimeInMillis()) / 1000; long days = diff / (60 * 60 * 24); long hours = diff / (60 * 60) % 24; long minutes = diff / 60 % 60; long seconds = diff % 60; daysBox = (TextView) findViewById(R.id.s1Days); daysBox.setText("" + "" + days + "" + hours + "" + minutes + "" + seconds + " ); }
favorite count: 0
has comment: http://stackoverflow.com/comment/43124284
has title: Update time every second
tagged with: android

http://stackoverflow.com/comment/43348795
score: 0
type: Comment
type: QuestionComment
has text: Don't expect a servlet container managed object to be processed as a bean by Spring.
comment on: http://stackoverflow.com/q/27455245

http://stackoverflow.com/comment/43151341
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27348326
score: 1
has text: I don't think your answers are correct but I do think Peter should do his own homework.

http://stackoverflow.com/comment/43366937
score: 0
has text: Only thing is, that even if I type Stop, the program continues. Ill post the code in a second!
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27464434

http://stackoverflow.com/q/27458965
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43354975
has body: I decided to make an app in android for my science exhibition and I have reached a dead end! I am trying to make a unit converter using radio buttons as the unit selection method. All is fine but when I select another radio button, the app crashes! I have no idea what is going on? Here is my XML layout: &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;TableLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/TableLayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_marginTop="30dp" &gt; &lt;RadioGroup android:id="@+id/from" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left" &gt; &lt;RadioButton android:id="@+id/km" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:onClick="radioClicked" android:text="KiloMeters" /&gt; &lt;RadioButton android:id="@+id/m" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="radioClicked" android:text="Meters" /&gt; &lt;RadioButton android:id="@+id/cm" android:layout_width="wrap_content" android:layout_height="wrap_content" android:onClick="radioClicked" android:text="Centimeters" /&gt; &lt;/RadioGroup&gt; &lt;Space android:id="@+id/Space1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="fill_vertical" /&gt; &lt;EditText android:id="@+id/KmValue" android:layout_width="115dp" android:layout_height="wrap_content" android:layout_marginBottom="24dp" android:layout_marginLeft="0dp" android:ems="10" android:inputType="numberDecimal" /&gt; &lt;RadioGroup android:id="@+id/to" android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;RadioButton android:id="@+id/mTo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="38dp" android:checked="true" android:onClick="radioClicked" android:text="Meters" /&gt; &lt;Radio…
score: 0
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/27459065
has answer: http://stackoverflow.com/a/27459070
has title: Radio Buttons: Listener in XML or JAVA?
tagged with: http://stackoverflow.com/tag/xml
tagged with: android-fragments
tagged with: java
tagged with: eclipse

http://stackoverflow.com/a/59466315
has body: Just add this to the gradle file: android{ testOptions { .... unitTests.all { jvmArgs "-Xmx2g" // to avoid outOfMemory exception } .... } }
upvote count: 0
score: -2
answers question: http://stackoverflow.com/q/27438145
type: Answer
downvote count: 2

http://stackoverflow.com/a/27348763
downvote count: 0
score: 4
type: Answer
has body: No, the final keyword is unnecessary for private methods. Per definition, there is no difference between private and private final. For more information, see 'final methods' in the Java Language Specification.
upvote count: 4
answers question: http://stackoverflow.com/q/27348577

http://stackoverflow.com/a/27359249
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27359173
has body: You cannot remove the url bar from a window using script inside a website. This would be a security issue.
downvote count: 0
type: Answer

http://stackoverflow.com/q/27436579
answer count: 2
tagged with: arrays
has answer: http://stackoverflow.com/a/27436799
has title: Working with arrays and manipulating them - Computer Science Homework
type: UnansweredQuestion
has body: The instructions here were to create a BowlingScores class and BowlingScoresViewer client class: In the BowlingScores class, create a method named printScores(): This class should keep track of scores for multiple bowlers. Scores are integer values between 0 and 300. Create a normal one-dimensional array to keep track of bowler nicknames. Use an initializer list to populate this array with 6 bowler nicknames (6 elements). Create a two-dimensional array to keep track of multiple scores per bowler Each bowler has bowled 4 games. -Each row number of this array will correspond to the index of the bowler from the “bowler nicknames” array you just created. Each column represents one of the four scores for the bowler. Use an initializer list to populate the scores for each bowler. Write a loop to process the two arrays as follows: Loop through each bowler in the bowler array For each bowler, loop through the corresponding scores for that bowler Output the bowler nickname and a list of his/her scores to the console similar to the following. Also, calculate the average score for the bowler Here is the link to the BowlerScoresViewer class Here is the link to the BowlerScores class Right now here is what I have in terms of code I need help with finding the averages and making sure I am doing this right.: package javaconcepts; // import javax.swing.JOptionPane; //BowlingScores is used to practice using parallel arrays and 2-dimensional arrays public class BowlingScores_MatthewBall { public void printScores() { System.out.println("BOWLING SCORES:"); String[] bowlers = {"L'Carpetron Dookmarriot", "Jackmerius Tacktheritrix", "Hingle McCringleberry", "Beezer Twelve Washingbeard", "X-Wing @Aliciousness", "Shakiraquan T.G.I.F. Carter"}; int[][] bowlerScores = {{110, 90, 160, 140, 110}, // row 0 {92, 96, 80, 112, 204}, // row 1 {200, 200, 200, 190, 210}, // row 2 {103, 90, 90, 150, 170}, // row 3 {118, 120, 116, 102, 200}, // row 4 {96, 96, 80, 112, 200}}; // row 5 /* for (int i = 0; …
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27436911
type: Question

http://stackoverflow.com/q/27427059
score: 1
tagged with: java
tagged with: h2
has body: I am using play framework for the first time and I need to link objects of the same type. In order to do so I have added a self referencing many to many relationship like this: @ManyToMany(cascade=CascadeType.ALL) @JoinTable(name="journal_predecessor", joinColumns={@JoinColumn(name="journal_id")}, inverseJoinColumns={@JoinColumn(name="predecessor_id")}) public List&lt;Journal&gt; journalPredecessor = new ArrayList&lt;Journal&gt;(); I obtain the table journal_predecessor which contains the two columns: journal_id and predecessor_id, both being FKs pointing to the primary key of the table journal. My question is how can I query this table using raw queries if I am using H2 in-memory database. thanks!
has comment: http://stackoverflow.com/comment/43310510
tagged with: playframework
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/27441592
type: AnsweredQuestion
has title: how to write raw play queries for a table which is not mapped to an entity
upvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27441592

http://stackoverflow.com/q/27399762
has comment: http://stackoverflow.com/comment/43245097
has comment: http://stackoverflow.com/comment/43245152
score: 0
has comment: http://stackoverflow.com/comment/43245498
has answer: http://stackoverflow.com/a/27404720
has title: Not able to retrieve data from SQLite database
tagged with: android
tagged with: sqlite
has body: I created an sqlite database and was trying to view data entered into my database on a button click. the button click would open a new activity and display the data in a textview but nothing seems to happen. Please tell me what is wrong with my code. Thanks. View.java package com.firstproject.aditya; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class View extends Activity{ @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.view); TextView tv= (TextView)findViewById(R.id.tvSQLinfo); Database info= new Database(this); info.open(); String data=info.getData(); info.close(); tv.setText(data); } } Activity2.java package com.firstproject.aditya; import android.app.Activity; import android.app.Dialog; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class Activity2 extends Activity implements View.OnClickListener { Button startDate, targetDate, remDate, save, cancel; TextView goalInfo, title, des, stDate, tgDate,rdDate; EditText edTitle; @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); setContentView(R.layout.act2); initialize(); startDate.setOnClickListener(this); cancel.setOnClickListener(this); targetDate.setOnClickListener(this); save.setOnClickListener(this); remDate.setOnClickListener(this); /* * Bundle gotBasket = getIntent().getExtras(); String * gotBread1=gotBasket.getString("key"); edsd.setText(gotBread1); */ } private void initialize() { // TODO Auto-generated method stub startDate = (Button) findViewById(R.id.bStart); targetDate = (Button) findViewById(R.id.bTarg); remDate = (Button) findViewById(R.id.brem); save = (Button) findViewById(R.id.bsave); cancel = (Button) findViewById(R.id.bcancel)…
has comment: http://stackoverflow.com/comment/43245384
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43245598
has comment: http://stackoverflow.com/comment/43245238
tagged with: java
type: Question
answer count: 1

http://stackoverflow.com/a/27339501
score: 2
has body: Change to Quadratic_Formula work = new Quadratic_Formula(); double posAnswer = work.posquadForm(ax, bx, c); double negAnswer = work.negquadForm(ax, bx, c); System.out.println("Your answer is" +posAnswer +"or" + negAnswer +"."); Your functions posquadForm &amp; negquadForm have already computed the answers, you just need to store them in variables and print them out?
downvote count: 0
answers question: http://stackoverflow.com/q/27339470
upvote count: 2
type: Answer

http://stackoverflow.com/q/27453979
tagged with: tokenize
has comment: http://stackoverflow.com/comment/43346169
linked to: http://stackoverflow.com/q/13647657
tagged with: java
has body: I'm making a library that holds media items, such as dvds or video games, and saves a file for the list of the media items. I have to make a method that can read in the data from the save file, recreate the media items, and put them into the list. I was thinking of tokenizing it but I can't figure out how to get it started. Any suggestions? I'm using java. Each media item holds a String title, String format, Boolean borrowed, String name, and String date. This method is going to be used to load the save file upon starting the program.
downvote count: 1
has comment: http://stackoverflow.com/comment/43348166
has comment: http://stackoverflow.com/comment/43348150
has comment: http://stackoverflow.com/comment/43346188
upvote count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/26579729
has title: Ideas for splitting up a string?
tagged with: string
favorite count: 0
type: Question
tagged with: field
tagged with: swing
has comment: http://stackoverflow.com/comment/43346164
answer count: 1
score: -1
has answer: http://stackoverflow.com/a/27454372

http://stackoverflow.com/q/27448158
type: Question
has answer: http://stackoverflow.com/a/27448456
has comment: http://stackoverflow.com/comment/43335489
has comment: http://stackoverflow.com/comment/43335687
has comment: http://stackoverflow.com/comment/43335467
has comment: http://stackoverflow.com/comment/43335338
has comment: http://stackoverflow.com/comment/43336050
tagged with: distance
has title: Faster measure of distance
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43335314
has comment: http://stackoverflow.com/comment/43335667
type: UnansweredQuestion
has body: I'm currently working with a game and I need to send packets from the server to the client to produce certain particle effects on the client, however, clients are only able to render this particles if they are within a radius of 64 cubic units in the game. In order to avoid sending packets to all the clients I will measure the distance between the client and the point where the particles originate, but the distance will be calculated for each client and should run in less than a game tick (50 ms). The particles will be played with the player movement, and will be sent to all clients within the distance, so performance is a bit crucial (considering a several amount of players). The game API provides this formula (no square root) for the distance between two locations: square(x1 - x2) + square(y1 - y2) + square(z1 - z2); My idea was to create a 'box' of 128 length on each axis using the particle as the center point, the downside of this is that the clients on the corner will not render the particle but will get the packet, wasting a bit of bandwidth. Question is, measuring the distance using euclidean distance will be faster than simply creating a 'box' around the particles and comparing if the clients are inside of it? Are there any other methods to get a faster distance measurement?
has comment: http://stackoverflow.com/comment/43335759
score: 3
has comment: http://stackoverflow.com/comment/43335685
tagged with: performance
has comment: http://stackoverflow.com/comment/43335699
has comment: http://stackoverflow.com/comment/43335354
has comment: http://stackoverflow.com/comment/43335635
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/43335613
has comment: http://stackoverflow.com/comment/43335540

http://stackoverflow.com/comment/43306900
type: Comment
type: QuestionComment
has text: How do you know the setters doesn't recalculate if you have to call a getter to know it for sure, but then the getter recalculates ? How can you affirm it was the getter and not the setter that recalculated ? Question is not clear.
comment on: http://stackoverflow.com/q/27432742
score: 0

http://stackoverflow.com/comment/128327993
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/72645131
has text: Maybe for very old versions, mine was out of support for 5 years; removed JDK 8 and it broke. Indeed would need a new license for a version supporting the current JDK 11.
score: 0

http://stackoverflow.com/a/27410328
answers question: http://stackoverflow.com/q/27409866
upvote count: 1
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43265174
has comment: http://stackoverflow.com/comment/43265208
has body: You need a new constructor that takes your HashMapOfArrayList as an argument, and then all you need to do is clone the Integers in the ArrayList. public HashMapOfArrayList(HashMapOfArrayList source) { HashMap&lt;Integer, ArrayList&lt;Integer&gt;&gt; graph = source.getGraph(); // get the source graph my_graph = new HashMap&lt;Integer, ArrayList&lt;Integer&gt;&gt;(); //define our graph for(Map.Entry&lt;Integer, ArrayList&lt;Integer&gt;&gt; entry : graph.entrySet()) { //iterate through the graph ArrayList&lt;Integer&gt; sourceList = entry.getValue(); ArrayList&lt;Integer&gt; clonedList = new ArrayList&lt;Integer&gt;(); clonedList.addAll(sourceList); //put value into new graph my_graph.put(entry.getKey(), clonedList); } } Then, you can replace your original read with the cloning constructor and transform it. for(int i = 0; i &lt; 1000; i++){ HashMapOfArrayList clone = new HashMapOfArrayList(graph); clone.transformation(); }
has comment: http://stackoverflow.com/comment/43283514
type: Answer
has comment: http://stackoverflow.com/comment/43274731
has comment: http://stackoverflow.com/comment/43265662
has comment: http://stackoverflow.com/comment/43267785
has comment: http://stackoverflow.com/comment/43265691
accepted answer of: http://stackoverflow.com/q/27409866
downvote count: 0
score: 1

http://stackoverflow.com/comment/43265709
type: Comment
type: QuestionComment
has text: Because it can be useful when I want to store entity that comes outside with minimal changes. For example someone can have own implementation of User, and pass me only interface.
score: 0
comment on: http://stackoverflow.com/q/27410581

http://stackoverflow.com/q/27355554
type: UnansweredQuestion
tagged with: multithreading
has title: Can't start java threads directly after booting BananaPi
tagged with: node.js
answer count: 0
has comment: http://stackoverflow.com/comment/43408891
tagged with: java
type: Question
has body: At this moment i'm working on a small NodeJs server running on my BananaPi running lubuntu. The server starts as soon as the BananaPi boots and this works; I can reach and interact with it's API interface. Via this API, I can send a command to start a runnable (java) jar. This jar should start a few threads which analyze some images. When I start the server myself from the command line, this works perfectly; once I tell the BananaPi to start the jar (via the API), I can see it running via the process list and the debug log it outputs. The problem arises when the server is started by the system itself when booting the system. The server just starts normally and behaves the same as when I would start in manually. However, when I give the command to start the jar (via the API) it just exits after it is started. I've put some logging around the starting of the first thread which looks like: log(fh, LOGLEVEL_INFO, "Starting Thread 1"); thread1 = new Thread(new FirstThread()); log(fh, LOGLEVEL_INFO, "Created Thread 1"); thread1.start(); log(fh, LOGLEVEL_INFO, "Started Thread 1"); The subsequently generated log only contains: Dec 08, 2014 10:53:29 AM project1.MainThread log INFO: 2014-12-08 10:53:29 Starting Thread 1 It looks like if the creation of a thread fails, but I cant figure out why, especially since all of this works when I start the server myself. Suggestions on how to fix this are welcome :)
score: 0
has comment: http://stackoverflow.com/comment/43168240
has comment: http://stackoverflow.com/comment/43163999
tagged with: linux

http://stackoverflow.com/comment/43114789
type: AnswerComment
type: Comment
has text: I got different output using that, I think it has something to do with my brackets
comment on: http://stackoverflow.com/a/27327777
score: 0

http://stackoverflow.com/q/27360679
has answer: http://stackoverflow.com/a/27360711
answer count: 5
has answer: http://stackoverflow.com/a/27360781
type: AnsweredQuestion
has body: I have a part of a program which looks like this. for(int i=0;i&lt;50;i++) { Random t = new Random(); // random integers in [0, 100] System.out.println(t.nextInt(100)); } I need to redirect just the last value to a text file. Any way I can print just the last value on the console? The very last value and nothing else.
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27360732
possible better answer: http://stackoverflow.com/a/27360711
score: 0
has answer: http://stackoverflow.com/a/27360732
has comment: http://stackoverflow.com/comment/43173441
has answer: http://stackoverflow.com/a/27360759
has answer: http://stackoverflow.com/a/27360746
has title: Need to read the last value from an output of n numbers

http://stackoverflow.com/comment/43120037
has text: Why dumb? It gets my vote as going someway to controlling the complete chaos that was my SDCard in the past and is definitely a security enhancement. What's wrong with it?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27331074
type: Comment

http://stackoverflow.com/a/27365938
answers question: http://stackoverflow.com/q/27365794
accepted answer of: http://stackoverflow.com/q/27365794
score: 0
type: AcceptedAnswer
has body: To get a value which can be devided be 4 without a rest you can use the modulo operator '%': if(year % 4 == 0) { ... } To disallow the Selection of "year" itself, you have several ways. One could be to append an ItemListener to your ComboBox and check whether the user selected the "year" value. If the user selected this value you can print an error message or just select another value - maybe the next possible one. You also can do more fancy stuff like disabling the save Button if the user selected an invalid value.. I think this should help you to get to the right direction.
type: Answer

http://stackoverflow.com/q/27452831
has body: I have an algorithm required single if statement with different &amp;&amp; condition in each iteration. For example, let we have the following code: int k = 0, d = 2; if (arr[i] != b[0] &amp;&amp; arr[i] != b[1]) { a[k] = arr[i]; k = k + 1; } Here the number of conditions depend on d and d are selected randomly each time, that is if d == 3, then I need if statement to be as follows if (arr[i] != b[0] &amp;&amp; arr[i] != b[1] &amp;&amp; arr[i] != b[2]) { ... } also, if d == 4 I need four conditions, and so on. My code require this final step to be done. However, I couldn't solve this step yet, I will really grateful for any help.
has comment: http://stackoverflow.com/comment/43344125
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27452889
has comment: http://stackoverflow.com/comment/43344707
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27453126
score: 1
tagged with: java
upvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/27452891
tagged with: conditional-statements
tagged with: if-statement
has answer: http://stackoverflow.com/a/27452891
accepted answer: http://stackoverflow.com/a/27452889
answer count: 3
tagged with: for-loop
has title: Java different number of conditions inside a single IF statement

http://stackoverflow.com/comment/43311689
has text: There is not enough information here to discover your problem post more of your code, the list creation, what is in the list and your swap function
type: Comment
comment on: http://stackoverflow.com/q/27435243
type: QuestionComment
score: 0

http://stackoverflow.com/q/27467581
answer count: 1
has comment: http://stackoverflow.com/comment/43372964
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43690171
has comment: http://stackoverflow.com/comment/43682763
downvote count: 0
has comment: http://stackoverflow.com/comment/43706619
score: 1
tagged with: java
tagged with: selenium
has body: I am beginner in selenium webdriver, I am trying to work with different locator by reading excel sheet but in these it take only one data put it in one field by finding locator "id", and when it come to the second text field for this we are using locator by "Xpath" but its not taking. So, my question is how can I work with different locator also by don't using switch case if possible. Below are my code: public class MainClass { private static final String BROWSER_PATH = "D:\\firefox.exe"; private static final String TEST_SUITE_PATH = "D:\\GmailTestSuite.xls"; private static final String OBJECT_REPOSITORY_PATH = "D:\\objectrepository.xls"; private static final String ADDRESS_TO_TEST = "https://www.gmail.com"; // other constants private WebDriver driver; private Properties properties; /*private WebElement we;*/ public MainClass() { File file = new File(BROWSER_PATH); FirefoxBinary fb = new FirefoxBinary(file); driver = new FirefoxDriver(fb, new FirefoxProfile()); driver.get(ADDRESS_TO_TEST); } public static void main(String[] args) throws IOException, BiffException { MainClass main = new MainClass(); main.handleTestSuite(); } private void handleTestSuite() throws BiffException, IOException { ReadPropertyFile readConfigFile = new ReadPropertyFile(); properties = readConfigFile.loadPropertiess(); ExcelHandler testSuite = new ExcelHandler(TEST_SUITE_PATH, "Suite"); testSuite.columnData(); int rowCount = testSuite.rowCount(); System.out.println("Total Rows=" + rowCount); for (int i = 1; i &lt; rowCount; i++) { String executable = testSuite.readCell(testSuite.getCell("Executable"), i); System.out.println("Executable=" + executable); if (executable.equalsIgnoreCase("y")) { // exe. the process String scenarioName = testSuite.readCell(testSuite.getCell("TestScenario"), i); System.out.println("Scenario Name=" + scenarioName); handleScenario(scenarioName); } } } private void handleScenario(String scenarioName) throws BiffException, IOException { ExcelHandler testScenarios = new…
tagged with: excel
type: Question
has comment: http://stackoverflow.com/comment/43408581
has comment: http://stackoverflow.com/comment/43544191
has answer: http://stackoverflow.com/a/34806412
has comment: http://stackoverflow.com/comment/43370936
has comment: http://stackoverflow.com/comment/43600505
has comment: http://stackoverflow.com/comment/43390438
has title: How to locate or work with different locator in selemium webdrier frameowrk?
upvote count: 1

http://stackoverflow.com/q/27326645
type: UnansweredQuestion
score: 3
answer count: 0
upvote count: 3
tagged with: java
type: Question
tagged with: admob
tagged with: sdl
has title: admob is not show in my SDL game
downvote count: 0
tagged with: android
has body: i have wrote SDL game and ported it to andorid and now I tried to integrate it with admob but i failed AndroidManifest <?xml version="1.0" encoding="utf-8"?> <uses-permission android:name="android.permission.INTERNET"/> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" /> <uses-feature android:glEsVersion="0x00020000" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> main.xml <?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" ads:adSize="BANNER" ads:adUnitId="xxxxx" /> my SDLActivity.java // Setup @Override protected void onCreate(Bundle savedInstanceState) { Log.v("SDL", "onCreate():" + mSingleton); super.onCreate(savedInstanceState); setContentView(R.layout.main); // Prepare the Interstitial Ad interstitial = new InterstitialAd(SDLActivity.this); // Insert the Ad Unit ID interstitial.setAdUnitId("xxxxxxx"); //Locate the Banner Ad in activity_main.xml AdView adView = (AdView) this.findViewById(R.id.adView); // Request for Ads AdRequest adRequest = new AdRequest.Builder() // Add a test device to show Test Ads .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .addTestDevice("CC5F2C72DF2B356BBF0DA198") .build(); // Load ads into Banner Ads adView.loadAd(adRequest); // Load ads into Interstitial Ads interstitial.loadAd(adRequest); // Prepare an Interstitial Ad Listener interstitial.setAdListener(new AdListener() { public void onAdLoaded() { // Call displayInterstitial() function displayInterstitial(); } }); SDLActivity.initialize(); // So we can call stuff from static callbacks mSingleton = this; // Set up the su…
favorite count: 0

http://stackoverflow.com/a/27358861
score: 4
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27358792
type: Answer
upvote count: 4
answers question: http://stackoverflow.com/q/27358792
has body: This code will compile because you pass an object as a parameter, and cast it explicitly into SomeClass&lt;L, R&gt;. Due to type erasure, this will work at runtime as long as you pass any instance of SomeClass, because all generic types will have disappeared by then. I'm guessing you're getting a Type safety: Unchecked cast from Object to SomeClass&lt;String, String&gt; warning during compilation (unless you specified @SuppressWarnings("unchecked")). To avoid this, you'll have to specify the type of the object you're allowed to pass as a parameter, doing for instance: public someMethod(SomeClass&lt;L, R&gt; obj)

http://stackoverflow.com/comment/43088442
comment on: http://stackoverflow.com/a/27314170
type: AnswerComment
score: 0
has text: Can You please give me whole code?..@fge
type: Comment

http://stackoverflow.com/comment/43272207
score: 0
type: Comment
type: QuestionComment
has text: @adamdc78 please find link to SensorInfo in my edits
comment on: http://stackoverflow.com/q/27413940

http://stackoverflow.com/comment/43302128
has text: Those newWindow.setVisible(true); should be reversed in order, with (false); in the init method and (true); in the ActionEvent. My bad, I threw that together pretty quick.
score: 0
comment on: http://stackoverflow.com/q/27430450
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43144317
type: Comment
comment on: http://stackoverflow.com/a/27344224
has text: 1) Typo corrected 2) `firstName` is a member variable of `User` not `Address`
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43146508
type: Comment
comment on: http://stackoverflow.com/a/27345599
has text: Like almost all UI toolkits, JavaFX is single threaded. You have to create the stage and show it on that thread, and any access to the scene graph must be on that thread. You can perform other actions in user-defined threads. Have a look at the [`Task`](https://docs.oracle.com/javase/8/javafx/api/javafx/concurrent/Task.html) class for examples of background thread interaction. Maybe explain more clearly what you are trying to do and why you need a background thread.
score: 0
type: AnswerComment

http://stackoverflow.com/a/27325967
has body: Because Strings are Objects type in java, use .equals() instead of == you are thinking about primitives! testString.equals(toCompareToString) //boolean return happy coding! Doc's to Java string lib
answers question: http://stackoverflow.com/q/27325854
score: 0
has comment: http://stackoverflow.com/comment/65813061
has comment: http://stackoverflow.com/comment/43114680
type: Answer

http://stackoverflow.com/comment/43192748
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27370423
has text: I fixed the other problem. One jar file was not included for the ant build.

http://stackoverflow.com/q/27430975
has comment: http://stackoverflow.com/comment/43303769
has comment: http://stackoverflow.com/comment/43303868
has comment: http://stackoverflow.com/comment/43303265
tagged with: java
has answer: http://stackoverflow.com/a/27431392
has title: How does an abstract method differ when it is defined in an abstract class or an interface?
type: Question
has comment: http://stackoverflow.com/comment/43303328
linked to: http://stackoverflow.com/q/1913098
has comment: http://stackoverflow.com/comment/43304018
has comment: http://stackoverflow.com/comment/43303202
has answer: http://stackoverflow.com/a/27431041
has body: Assume an abstract class has only abstract methods declared in it and the interface has abstract methods. How does this affect the abstract method m? abstract class A { abstract void m(); } interface A { abstract void m(); }
has comment: http://stackoverflow.com/comment/43303163
has comment: http://stackoverflow.com/comment/43303722
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/43303471
tagged with: abstract
has comment: http://stackoverflow.com/comment/43303799
has comment: http://stackoverflow.com/comment/43303635
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43303383
tagged with: interface
has comment: http://stackoverflow.com/comment/43303544

http://stackoverflow.com/comment/43234516
has text: Java Strings (objects) are **immutable**. Noting stops you from reassigning reference variables (unless declared as final).
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27393675
type: AnswerComment

http://stackoverflow.com/q/27365196
has comment: http://stackoverflow.com/comment/43183055
score: 0
tagged with: java
type: Question
tagged with: algorithm
has comment: http://stackoverflow.com/comment/43182474
answer count: 1
has answer: http://stackoverflow.com/a/27366602
has title: Is my Directional Symmetry java algo correct?
type: UnansweredQuestion
has body: Using these values: double[] predicted = {2,2,3}; double[] expected = {2,1,3}; ... the below Directional Symmetry java algo is giving me 100% despite the directional difference between the predicted and the expected array: 2,2 VS 2,1 double d = 0; for (int i = 1; i &lt; expected.length || i &lt; predicted.length; i++) { double ex_i = expected[i]; double ex_i_ = expected[i-1]; double pr_i = predicted[i]; double pr_i_ = predicted[i-1]; if(((ex_i-ex_i_)*(pr_i-pr_i_))&gt;=0) { d+=1; } } return (100/(expected.length-1))*d; Is it normal for the Directional Symmetry or is my algo wrong ?

http://stackoverflow.com/a/27325804
score: 2
has body: You can usually achieve this. I am not sure about that particular bluetooth button, but I have done it with others, so the principle should be the same. These buttons usually are paired like bluetooth keyboards to the device. Once they are connected your activity gets signals that corresponds to a keyboard key clicks (usually the enter key, which triggers the shutter in the standard camera app). This means you can overwrite onKeyDown(int keyCode, KeyEvent event) and check if it was the keyCode your bluetooth button sends. If that is the case, just do your http request, or whatever else you like. In order to connect to the button, you have to write your own broadcast receiver and listen to the different actions. Take a look at ACTION_BOND_STATE_CHANGED and ACTION_PAIRING_REQUEST for bonding to the bluetooth button and then at ACTION_ACL_CONNECTED, ACTION_ACL_DISCONNECT_REQUESTED, ACTION_ACL_DISCONNECTED, ACTION_DISCOVERY_FINISHED for handling the different states. Also take a look at the developer documentation for bluetooth devices here: http://developer.android.com/guide/topics/connectivity/bluetooth.html
accepted answer of: http://stackoverflow.com/q/27324509
answers question: http://stackoverflow.com/q/27324509
has comment: http://stackoverflow.com/comment/59806307
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/comment/43245883
comment on: http://stackoverflow.com/q/27400352
has text: You say the DLL is 64-bit, but apparently your computer disagrees. Your computer is probably right. Are you sure it's picking up the right version of the DLL?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43345145
type: Comment
comment on: http://stackoverflow.com/q/27453400
type: QuestionComment
score: 1
has text: Do you use the same proxy for internet browsing as well? Can you view sites with the same credentials? Seems like you cant authenticate with your proxy.

http://stackoverflow.com/comment/43334281
score: 1
comment on: http://stackoverflow.com/q/27447706
has text: Think about what `if(myArray.get(i) % 1 == 0)` does mathematically. There are also other problems but start here.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43199768
type: QuestionComment
comment on: http://stackoverflow.com/q/27374637
score: 1
type: Comment
has text: It blocks until the thread exits. If the thread doesn't exit, it blocks forever. I've never used `Thread.join()` in production code in 17.5 years. Why do you think it's necessary?

http://stackoverflow.com/a/27379263
has comment: http://stackoverflow.com/comment/43213106
downvote count: 0
has body: For @Autowired to work in AnyOtherClass, AnyOtherClass needs to be a Spring bean. Something like this AppConfig @Configuration public class AppConfig { @Bean @Autowired public SomeBean BeanSomeBean() { return new SomeBean(); } @Bean @Autowired public AnyOtherClass BeanAnyOtherClass() { return new AnyOtherClass(); } } Main @EnableAutoConfiguration @Configuration @ComponentScan("com.somePackage") public class Main { ApplicationContext ctx= new AnnotationConfigApplicationContext(AppConfig.class); SomeBean myBean = ctx.getBean(SomeBean.class); myBean.doSomething();//succeeds AnyOtherClass aoc = ctx.getBean(AnyOtherClass.class); } If you instantiate a class using new AnyOtherClass(), it will bypass Spring and none of the annotations will work. You must get it out of Spring context in order for it to be a Spring bean.
has comment: http://stackoverflow.com/comment/43208673
has comment: http://stackoverflow.com/comment/43211409
accepted answer of: http://stackoverflow.com/q/27379216
has comment: http://stackoverflow.com/comment/43209967
type: Answer
has comment: http://stackoverflow.com/comment/43208055
upvote count: 2
has comment: http://stackoverflow.com/comment/43208333
score: 2
has comment: http://stackoverflow.com/comment/43207908
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27379216
has comment: http://stackoverflow.com/comment/43213049

http://stackoverflow.com/q/27458481
accepted answer: http://stackoverflow.com/a/27458569
has comment: http://stackoverflow.com/comment/43354040
has comment: http://stackoverflow.com/comment/43353979
has comment: http://stackoverflow.com/comment/43353946
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: applet
has body: I'm new to java: When i'm studying package, there are lots of packages available in java platform. This is my code: package day1.examples; import java.applet.*; import java.awt.*; public class HelloWorld extends Applet { public void paint(Graphics g) { g.drawString("Hello world!", 50, 25); } } When i run this code, it shows this warning :"The import java.applet is never used" My page look like this: Can anyone help me?
has answer: http://stackoverflow.com/a/27458569
favorite count: 0
has comment: http://stackoverflow.com/comment/43354080
type: Question
has comment: http://stackoverflow.com/comment/43353926
upvote count: 1
linked to: http://stackoverflow.com/q/5703078
answer count: 1
has comment: http://stackoverflow.com/comment/43354009
has title: Issue in run java applet program
has comment: http://stackoverflow.com/comment/43354052
has comment: http://stackoverflow.com/comment/43353956
tagged with: java

http://stackoverflow.com/comment/43369533
has text: That left me with this when debugged: "person.Name = name" and "person.Age = age". It gave me the attribute type name instead of the response attribute. This happened with GSON as well.
type: AnswerComment
comment on: http://stackoverflow.com/a/27466805
type: Comment
score: 0

http://stackoverflow.com/a/27320553
score: 2
answers question: http://stackoverflow.com/q/27320396
downvote count: 0
has body: In fact, what you see is not a memory address, but array's class name and hash value (in hex form). This is a behavior inherited from toString() method of java.lang.Object You can use a for-loop to print each array element individually. eg. for (int i = 0; i &lt; myArray.length; i ++) { System.out.println(myArray[i]); } Note that println prints the result of toString method of the array elements for non-primitive types. Make sure their toString is properly overriden if you want custom behaviour rather than "classname@hashvalue"
upvote count: 2
type: Answer

http://stackoverflow.com/comment/43173520
type: QuestionComment
has text: Add a conditional to ignore it or wrap it in a try-catch.
type: Comment
comment on: http://stackoverflow.com/q/27360733
score: 0

http://stackoverflow.com/comment/43257984
has text: That code is very inefficient. First, create the Random object only once at program start. Then call nextInt(), and use that int to remove the card by index rather than fetching it and removing by value. Or else shuffle the deck array and just deal with pop().
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27393338

http://stackoverflow.com/comment/43318085
comment on: http://stackoverflow.com/q/27438883
type: QuestionComment
type: Comment
has text: OK, then please tell us which line of the listing above is identified in the stack trace. As requested by immibis and Panther already.
score: 0

http://stackoverflow.com/a/27474869
accepted answer of: http://stackoverflow.com/q/27459902
answers question: http://stackoverflow.com/q/27459902
downvote count: 0
score: 1
upvote count: 1
type: AcceptedAnswer
has body: Caused by: java.security.AccessControlException: access denied ("java.util.PropertyPermission" "java.util.logging.config.file" "read") This applet needs to be trusted. Digitally sign the applet code.
type: Answer

http://stackoverflow.com/q/27342868
has answer: http://stackoverflow.com/a/27412921
has title: Bubble Sort compiling but out of bounds
has body: I am having issues with getting a simple bubble sort of an array to work properly. It compiles, but I'm getting an out of bounds exception when running the program. I know what an out of bounds error is but I can't see why it occurred in this case. Any geniuses there that know how to fix this? Thank you public class BubbleSort { public static void main(String[] args) { // create the array that we want to sort with buble sort alogorithm int intArray[] = new int[]{5, 90, 35, 45, 150, 3}; //print the array before the bubble sort System.out.println("Array before Bubble Sort"); for (int i = 0; i &lt; intArray.length; i++) { System.out.print(intArray[i] + " "); } // sort an array using bubble sort algorithm bubbleSort(intArray); System.out.println(""); // print array after sorting using bubble sort System.out.println("Array after Bubble Sort"); for (int i = 0; i &lt; intArray.length; i++) { System.out.print(intArray[i] + ""); } } private static void bubbleSort(int[] intArray) { int n = intArray.length; int hold = 0; for (int i = 0; i &lt; n; i++) //allows us to pass or loop around array { for (int j = 1; j &lt; (n - i); j++) //allows on pass or comparison { if (intArray[j] &gt; intArray[j + 1]) //swap the elements! { hold = intArray[j]; intArray[j] = intArray[j + 1]; intArray[j + 1] = hold; } } } } }
accepted answer: http://stackoverflow.com/a/27343044
answer count: 5
possible better answer: http://stackoverflow.com/a/27342901
has answer: http://stackoverflow.com/a/27343044
has answer: http://stackoverflow.com/a/27342901
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27342913
type: Question
tagged with: sorting
has answer: http://stackoverflow.com/a/27342942
tagged with: bounds
score: 0

http://stackoverflow.com/comment/43164621
type: Comment
type: QuestionComment
has text: @TacB0sS : can u illustrate this with an example?
comment on: http://stackoverflow.com/q/27354900
score: 0

http://stackoverflow.com/a/27335817
type: Answer
has body: You need to write a constructor for Glass that takes an argument. class Glass { int ounce; public Glass(int ounce) { this.ounce = ounce; } public void spill() { ounce = 0; } public void drink(int x){ ounce = ounce-x; } public void fill(int x){ ounce = ounce+x; } public int getOunce() { return ounce; } public void report() { int x = getOunce(); System.out.println("Glass has " + x + " ounces"); } }
score: 0
has comment: http://stackoverflow.com/comment/43128780
answers question: http://stackoverflow.com/q/27335794

http://stackoverflow.com/comment/43328844
score: 0
type: QuestionComment
type: Comment
has text: And also, if pattern was \\bcat\\b and line was cat cat cattie cat, why does the 2nd part \\b allow only full matches of cat?
comment on: http://stackoverflow.com/q/27401437

http://stackoverflow.com/q/27469094
upvote count: 1
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43375720
downvote count: 3
has comment: http://stackoverflow.com/comment/43373392
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43373378
tagged with: observer-pattern
tagged with: swing
has title: Implementing MVC and Observer Pattern
type: Question
tagged with: model-view-controller
accepted answer: http://stackoverflow.com/a/27469121
has body: For a group project for school we have to make a program that implements the MVC pattern. The difficulty I have is understanding how the MVC pattern is implemente in java with SWING, does the view make the SWING components? Another thing I have a hard time understanding is what updates what. For instance one article says the view 'executes' the controller, then the controller updates the model accordingly, the model the notifies the view and and the view then pulls the data from the model. While what i've learned about the MVC Pattern is that the controller has an instance of the model and the view so it can interact with both. but then if I push a button in the view how does the controller know to do something with the model? And for this example which clas(ses) is/are the Observer(s) and which clas(ses) are the Observable(s)? Another idea I had is that if we use the MVC Pattern as described above the view is the Observer and the model is the Observable, but that still leaves the question how does the controller know when to update the model? If it seems vague please ask for clarification in the comments and I will answer.
score: -2
tagged with: java
has answer: http://stackoverflow.com/a/27469121

http://stackoverflow.com/q/27370947
has comment: http://stackoverflow.com/comment/43193446
tagged with: scope
has body: This is a problem I've had a problem with for a long time, and it'd be nice if I could finally get an answer to this. My instructor at school always seems to comes up with a craft solution around this, but I need to know how to fix it. /** * This program lets you enter your students names and grades * * @author (Austin) * @version (1.0.0) */ import java.io.*; import java.util.*; public class Tester { public static void main (String args[]) { Scanner kb = new Scanner(System.in); System.out.println ("How many students do you have?"); int numOfStudents = kb.nextInt(); String studentName[] = new String [numOfStudents]; int studentGrade[] = new int[numOfStudents]; System.out.println ("Please enter student name, then hit enter. Then enter student grade."); int x; int y; for (x = 0; x &lt;= numOfStudents - 1; x++) { String name = kb.next(); studentName[x] = name; for (y = 0; y &lt;= 0; y++) { int grade = kb.nextInt(); studentGrade[y] = grade; } if (x != numOfStudents -1) { System.out.println (""); System.out.println ("Next Student:"); System.out.println (""); } } System.out.println ("What would you like to do?"); System.out.println ("1. Find class average\n2. Find student grade"); int user = kb.nextInt(); Grade_Methods g1 = new Grade_Methods(); int z; if (user == 1) { for (z = 0; z &lt;=numOfStudents - 1; z++) { int a =+ studentGrade[z]; } g1.gradeAverage(a,numOfStudents); } } } The problem is at the bottom of the code, inside the if statement. This program is meant to help me better understand arrays, and I don't know how to pull the data out of them except using a for loop. My problem is, when I try to store all the values from array studentGrade into int a as a total value for all grades, the line below, where I try to call it into a method, won't recognize that int a has been declared.
has title: The rules of the scope of for loops in java
has answer: http://stackoverflow.com/a/27371013
has answer: http://stackoverflow.com/a/27370976
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27370960
answer count: 4
tagged with: java
score: 0
type: Question
tagged with: for-loop
tagged with: arrays
has answer: http://stackoverflow.com/a/27370979

http://stackoverflow.com/comment/43393724
type: Comment
comment on: http://stackoverflow.com/a/27458225
has text: Thank You for your reply sol4me, your example working for statically but dynamically some changes need to done, with your example after making changes I am able to do that. Thank You
score: 0
type: AnswerComment

http://stackoverflow.com/q/27435527
type: Question
has answer: http://stackoverflow.com/a/27435635
type: AnsweredQuestion
has body: I am generating a file using the following syntax File file = new File("input.txt"); The problem is that it is saying that it is writing to the file but I am not able to locate where the file is created, I searched my entire workspace. The expectation was that it would be created in the same folder as my code which is executing. Any ideas? Rest of the code : File file = new File("input.txt"); // if file doesnt exists, then create it if (!file.exists()) { try { file.createNewFile(); } catch (IOException e) { e.printStackTrace(); } }
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/43312014
tagged with: file-io
linked to: http://stackoverflow.com/q/840190
has comment: http://stackoverflow.com/comment/43312006
has comment: http://stackoverflow.com/comment/43311996
accepted answer: http://stackoverflow.com/a/27435572
has title: Unable to located generated file
has answer: http://stackoverflow.com/a/27435572
tagged with: java
tagged with: file
possible better answer: http://stackoverflow.com/a/27435635
has comment: http://stackoverflow.com/comment/43312034

http://stackoverflow.com/comment/43337405
comment on: http://stackoverflow.com/a/27449269
type: Comment
score: 0
type: AnswerComment
has text: That is true, I missed the `Object` in front of it, thought it could have been a problem with the JSON serializer. Some JSON serializers do have the option to not quote strings, or maybe that's just when deserializing...

http://stackoverflow.com/a/27346309
type: Answer
score: 0
has body: Declare max not as String type but an Numeric(int or Integer) type. Like below Integer max = Integer.parseInt(input.nextLine()); and also for low too.
answers question: http://stackoverflow.com/q/27346261

http://stackoverflow.com/q/27360969
type: AnsweredQuestion
score: 3
has answer: http://stackoverflow.com/a/27373271
upvote count: 3
tagged with: java
has body: Im trying to use IntelliJ to create java classes from some xml - the steps im doing is following : Save xml from a specified partner url through a browser Use IntelliJ to generate XSD schema from XML file Use IntelliJ to generate java classes from xsd file My problem is that the only thing that happens is that it creates the specified package and copies the xsd to this package - no java classes is made. The xml im downloading looks like this <?xml version="1.0" encoding="UTF-8"?> <poolLink id="1082" relationship="child" type="H1"/> <prize numCorrect="10" winners="0" guarantee="0" value="11.70" size="11.7"/> <prize numCorrect="11" winners="0" guarantee="0" value="35.10" size="35.1"/> <prize numCorrect="12" winners="0" guarantee="0" value="70.20" size="70.2"/> and the xsd looks like this <?xml version="1.0" encoding="UTF-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:element name="oxip" type="oxipType"/> <xs:complexType name="oxipType"> <xs:sequence> <xs:element type="responseType" name="response"/> </xs:sequence> <xs:attribute type="xs:float" name="version"/> <xs:attribute type="xs:string" name="created"/> <xs:attribute type="xs:string" name="lastMsgId"/> <xs:attribute type="xs:float" name="requestTime"/> </xs:complexType> <xs:complexType name="poolType"> <xs:sequence> <xs:element type="poolLinkType" name="poolLink"/> <xs:element type="poolPrizesType" name="poolPrizes"/> <xs:element type="eventType" name="event" maxOccurs="unbounded" minOccurs="0"/> </xs:sequence> <xs:attribute type="xs:short" name="id"/> <xs:attribute type="xs:string" name="name"/> <xs:attribute type="xs:string" name="poolType"/> <xs:attribute type="xs:byte" name="poolTypeId"/> <xs:attribute type="xs:string" name="jackpot"/> <xs:attribute type="xs:string" name="provider"/> <xs:attribute type="xs:string" name="fracBetsAvail"/> <xs:attribute type="xs:string" name="quickPicksAvail"/> <xs:attribute type="xs:string" name=…
type: Question
tagged with: intellij-idea
accepted answer: http://stackoverflow.com/a/27373271
has title: Generate java classes from xsd using intelliJ
answer count: 1
downvote count: 0
tagged with: http://stackoverflow.com/tag/xml
favorite count: 0
tagged with: xsd

http://stackoverflow.com/comment/43358652
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27454483
has text: That's the issue. Is there a different between `Scala.Serializable` and `java.io.Serializable`?
type: AnswerComment

http://stackoverflow.com/a/27432478
has body: From what I understand, some Java implementations implement identityHashCode by reserving two bits the an object header to divide objects into three categories: Those for which identityHashCode() has never been called. Those for which the first-ever call to identityHashCode() occurred after the most recent time the object moved. Those for which the first-ever call to identityHashCode() occurred before the most recent time the object moved. For an objects of the first category, a call to identityHashCode() will return a value related to the object's address and set a flag to change the object into the second category. For an object in the second category, the identityHashCode() will compute the same value from the address as the first call. Any time the GC is going to move an object, it checks whether it is in the second category above. If so, the GC reserves an extra four bytes at the destination which will be used to hold the identity hash value the object had before it moved. If an object has its hash code taken, the effective size of the object will increase by four bytes the next time the GC has to move it. Most objects never have their identity hash code taken, however, and some of them have their identity hash code taken but are immediately collected. Having an object's first call to identityHashCode() allocate an extra four bytes for an object would be difficult, but allocating an extra four bytes when the object is moved is not a problem. Using the object's address as its hash value between the first call to identityHashCode() and the next time the object moves avoids the need to allocate the storage when the space following the object is in use. Note that while an identity hash method could "legally" use the bit pattern of the address directly, doing so could cause excessive number of hash duplicates (e.g. the first object created following one GC cycle could easily have the same address as the first object created after another). A simple way to avoid that…
answers question: http://stackoverflow.com/q/27425432
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27425432
upvote count: 2

http://stackoverflow.com/comment/63912566
has text: @vtd-xml-author what should be the approach if my split should be based on size or number of nodes per file. Ex : 1st split file should contain 500 nodes so on second.
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27464636

http://stackoverflow.com/comment/43128404
comment on: http://stackoverflow.com/a/27335790
score: 0
type: AnswerComment
has text: Each time you do `toCharArray()`, you are creating a new object. Instead, you can check the first index of the string by using `i.charAt(0)` (returns the letter at the first index of the string) or you could just do `i.startsWith(letter)`. No need for the extra objects for each name
type: Comment

http://stackoverflow.com/comment/43365996
type: QuestionComment
has text: @kriegaex, Kryo uses ReflectASM which is few times slower than direct field access.
comment on: http://stackoverflow.com/q/27460873
score: 0
type: Comment

http://stackoverflow.com/q/27458407
tagged with: jdeveloper
type: AnsweredQuestion
tagged with: ejb-3.0
score: 0
tagged with: java
type: Question
accepted answer: http://stackoverflow.com/a/27462411
has body: I have stateful bean with JPA and when I test locally, it connects to database and displays correct values. I have added a JSP to the project and when I run JSP file from Jdeveloper, I am getting the following errors - Exception creating EntityManagerFactory using PersistenceProvider class oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider for persistence unit Project3. at com.evermind.server.ejb.exception.DeploymentException.exceptionCreatingEntityManagerFactory(DeploymentException.java:130) at com.evermind.server.ejb.persistence.PersistenceUnitManagerImpl.createContainerEntityManagerFactory(PersistenceUnitManagerImpl.java:197) at com.evermind.server.ejb.persistence.PersistenceUnitManagerImpl.initializePersistenceUnit(PersistenceUnitManagerImpl.java:159) at com.evermind.server.ejb.persistence.PersistenceUnitManagerImpl.initialize(PersistenceUnitManagerImpl.java:87) at com.evermind.server.ejb.EJBPackageDeployment.initializePersistenceUnitManager(EJBPackageDeployment.java:1074) at com.evermind.server.ejb.EJBContainer.postInit(EJBContainer.java:841) at com.evermind.server.ApplicationStateRunning.initializeApplication(ApplicationStateRunning.java:235) at com.evermind.server.Application.setConfig(Application.java:460) at com.evermind.server.Application.setConfig(Application.java:361) at com.evermind.server.ApplicationServer.addApplication(ApplicationServer.java:1919) at com.evermind.server.ApplicationServer.initializeDeployedApplications(ApplicationServer.java:1667) at com.evermind.server.ApplicationServer.setConfig(ApplicationServer.java:1050) at com.evermind.server.ApplicationServerLauncher.run(ApplicationServerLauncher.java:131) at java.lang.Thread.run(Thread.java:662) Caused by: javax.persistence.PersistenceException: Exception [TOPLINK-28018] (Oracle TopLink Essentials - 2.1 (Build b52-fcs (09/24/2008))): oracle.toplink.essentials.exceptions.EntityManagerSetupException Exception Description: predeploy for PersistenceUnit [Project3] failed. Internal Exc…
answer count: 1
tagged with: jpa
tagged with: toplink
has title: Toplink - Exception creating EntityManagerFactory using PersistenceProvider
has answer: http://stackoverflow.com/a/27462411

http://stackoverflow.com/a/27421080
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27419590
has body: Try something like this: container_table.addMouseListener(new MouseAdapter() { public void mouseClicked (MouseEvent me) { if (me.getClickCount() == 2) { //Double clicked } } }); This way, you know that the 'container_table' has been clicked twice, and then you can get the selected row, and make things with it. Hope it helps.

http://stackoverflow.com/comment/43130559
type: AnswerComment
score: 0
type: Comment
has text: For just printing out all of the cards of the deck alone, can I use Arrays.toString(deck)? I'm trying to just create the object Deck and print its contents (52 cards in order in one list). Thanks!
comment on: http://stackoverflow.com/a/27336770

http://stackoverflow.com/comment/43092206
score: 1
has text: Can you please reformat your code? It seems that the `for` and `if` are not closed.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27316098

http://stackoverflow.com/comment/43315473
has text: You could also use Math.abs(int2 - int1) if you want to ensure that the range is positive and don't trust the user to follow the instructions :)
comment on: http://stackoverflow.com/a/27437510
type: Comment
score: 1
type: AnswerComment

variables
tag name: variables
tags question: http://stackoverflow.com/q/27420646
tags question: http://stackoverflow.com/q/27342262
tags question: http://stackoverflow.com/q/27325113
tags question: http://stackoverflow.com/q/27430285
tags question: http://stackoverflow.com/q/27316365
tags question: http://stackoverflow.com/q/27333758
type: Tag
tags question: http://stackoverflow.com/q/27385798
tags question: http://stackoverflow.com/q/27360733
tags question: http://stackoverflow.com/q/27414699
tags question: http://stackoverflow.com/q/27400919
tags question: http://stackoverflow.com/q/27322043

http://stackoverflow.com/a/27332272
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/43122209
accepted answer of: http://stackoverflow.com/q/27332255
has body: Direct super-interfaces are all the interfaces that a class implements directly. For example, if class X implements Y,Z Y &amp; Z are direct super-interfaces of class X. In addition to implementing its direct super-interfaces, a class also implements indirectly all the interfaces that its direct super-class implements and all the interfaces that its direct super-interfaces extend. JLS 8.1.5: The optional implements clause in a class declaration lists the names of interfaces that are direct superinterfaces of the class being declared.
answers question: http://stackoverflow.com/q/27332255
downvote count: 0
has comment: http://stackoverflow.com/comment/43122571
type: AcceptedAnswer
score: 4

http://stackoverflow.com/q/27407979
score: -3
accepted answer: http://stackoverflow.com/a/27410491
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/43260475
tagged with: java
has answer: http://stackoverflow.com/a/27410491
type: Question
has body: I am new to java and I really need some help with this project. I am have no idea where to go from here.I am writing a program that allows the user to input as many numbers as he wants up to 100. At any time he can hit q and the loop should stop running. Once it stops then my program displays the minimum and maximum numbers for inputted numbers on the console and also calculates/displays the count, sum, and average of all inputted numbers on the console. The calculation and program's console output should be implemented in their own methods. I just need some guidance import java.util.Scanner; public class test { public static void main(String[] args) { double [] myList = new double[100]; Scanner input = new Scanner(System.in); System.out.println("Enter floating point numbers"); for ( int i = 0; i&lt; 100; i++) myList[i] = input.nextDouble(); public static void stopInput(double [] array){ } public static void calculate(){ } } }
downvote count: 3
answer count: 1
favorite count: 0
has title: Arrays and methods

http://stackoverflow.com/comment/43320612
score: 0
comment on: http://stackoverflow.com/q/27439227
has text: Does your database trigger things when records are inserted/updated/deleted? (What DB type is it?)
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27435094
has comment: http://stackoverflow.com/comment/46671462
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43761130
has title: Processing all exceptions in multiple streams
downvote count: 0
tagged with: stdout
has comment: http://stackoverflow.com/comment/46571672
linked to: http://stackoverflow.com/q/2344654
has body: I want my program exceptions to be sent to each of the following, preferably simultaneously: the console which starts it (not necessarily) a gui a txt file. How can I achieve this? My attempts: System.setErr(PrintStream err) will forward all exceptions to a new stream. I am not able to state more than one stream though. Calling System.setErr(PrintStream err) on a manually written OutputStream: "You can write your own stream class that forwards to multiple streams and call System.setOut on an instance of that class" – Jeffrey Bosboom I found a way to do this. It is very nasty though. It "collects" PrintStream's write-bytes, puts them in a puffer (500 ms timeout) and finally shows it to the user (Proceed): /* ErrorOutput.java */ public static t_ErrBuffer t_activeErrBuffer = new t_ErrBuffer(""); public static void setStdErrToFile(final File file) { ps = new PrintStream(fos) { @Override public void write(byte[] buf, int off, int len) { byte[] bn = new byte[len]; for (int i = off, j = 0; i &lt; (len + off); i++, j++) { bn[j] = buf[i]; } String msg = null; try { msg = new String(bn, "UTF-8"); } catch (UnsupportedEncodingException e1) {} if (msg.matches("[\\w\\W]*[\\w]+[\\w\\W]*")) { // ^= contains at least one word character if( ! t_activeErrBuffer.isAlive() ) { t_activeErrBuffer = new t_ErrBuffer(msg); t_activeErrBuffer.start(); } else { t_activeErrBuffer.interrupt(); t_activeErrBuffer = new t_ErrBuffer(t_activeErrBuffer.getErrBuffer() + "\n" + msg); // ^= append to buffer and restart. t_activeErrBuffer.start(); } } } }; System.setErr(ps); } /* t_ErrBuffer.java */ public class t_ErrBuffer extends Thread { private String errBuffer; public t_ErrBuffer(String buffer) { this.errBuffer = buffer; } protected class Proceed implements Runnable { public String msg = null; public Proceed(String msg) { this.msg = msg; } @Override public void run() { // todo PRINT ERROR MESSAGE: DO THINGS WITH msg: console, gui, JOptionPane } } @Override public void run() { try { Thread.sleep(500); …
has answer: http://stackoverflow.com/a/29232558
has answer: http://stackoverflow.com/a/29269563
score: 7
tagged with: throw
favorite count: 0
tagged with: exception
possible better answer: http://stackoverflow.com/a/29269563
has comment: http://stackoverflow.com/comment/46289994
tagged with: stderr
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/29232558
has comment: http://stackoverflow.com/comment/43311099
tagged with: java
upvote count: 7

http://stackoverflow.com/comment/43365762
has text: httpURLConnection worked for GET ... but it doesnt support PATCH
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27464305

http://stackoverflow.com/comment/43235700
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27394353
has text: I added the tag that effectively answers the question. Put 'look feel java tutorial' into your favorite search engine and go from there.
type: Comment

http://stackoverflow.com/q/27376197
type: Question
answer count: 2
tagged with: mobile
upvote count: 0
tagged with: android
has answer: http://stackoverflow.com/a/27376352
favorite count: 0
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/29122057
accepted answer: http://stackoverflow.com/a/27376352
tagged with: java
has body: Implementing multiple sign-in methods in my Android app (G+ , Facebook , LinkedIn). I'm trying to select the best approach for the design. 3 Services that handles each social network or 1 Super class that defines the common methods and 3 classes that extends it and implements the specific login internal Any other approach, code reference or any other input would be welcomed
has title: Android - Sign-in with multiple social networks
score: -1
tagged with: authentication
downvote count: 1
possible better answer: http://stackoverflow.com/a/29122057

http://stackoverflow.com/comment/43362183
comment on: http://stackoverflow.com/q/27462931
score: 0
type: QuestionComment
type: Comment
has text: Let's say a=1, b=2, c=3, d=4. do you want the output be the string "1234"?

http://stackoverflow.com/q/27466739
type: Question
has comment: http://stackoverflow.com/comment/43369559
has comment: http://stackoverflow.com/comment/43369402
has title: I can't load image and text in some platform from res/raw
type: UnansweredQuestion
tagged with: android
tagged with: getresource
has body: I have layout that my images and text files in "res/raw" folder are load by user search. image's name start with ("p"+month+"_"+day) and the text file start with "t". when user search date java create file name by month and day. but this is not show image and text on the some platform like tablet 10" &amp; sony xperia T Image String MD = (jCal.toString().substring(5)); // 2014-03-25 =&gt; 03-25 String[] Split_MD = MD.split("-"); String mDrawableName = ("p"+Split_MD[0]+"_"+Split_MD[1]); ImageView Pic = (ImageView) findViewById(R.id.imageView); Resources res = getResources(); int resId = res.getIdentifier(mDrawableName, "raw", getPackageName()); Pic.setImageResource(resId); Text TextView txtContent = (TextView) findViewById(R.id.date); String mAssetsName = ("raw/t"+Split_MD[0]+"_"+Split_MD[1]); txtContent.setTypeface(face); try { Resources res1 = getResources(); InputStream in_s = res1.openRawResource(getResources().getIdentifier(mAssetsName,"raw", getPackageName())); byte[] b = new byte[in_s.available()]; in_s.read(b); txtContent.setText(new String(b)); } catch (Exception e) { // e.printStackTrace(); txtContent.setText("Error: can't show help."); } Logcat: D/dalvikvm﹕ Not late-enabling CheckJNI (already on) E/Trace﹕ error opening trace file: No such file or directory (2) D/dalvikvm﹕ GC_FOR_ALLOC freed 39K, 7% free 2430K/2592K, paused 72ms, total 77ms I/dalvikvm-heap﹕ Grow heap (frag case) to 3.075MB for 614416-byte allocation D/dalvikvm﹕ GC_FOR_ALLOC freed 1K, 6% free 3029K/3196K, paused 66ms, total 66ms D/dalvikvm﹕ GC_CONCURRENT freed &lt;1K, 6% free 3029K/3196K, paused 8ms+5ms, total 90ms D/gralloc_goldfish﹕ Emulator without GPU emulation detected. I/Choreographer﹕ Skipped 32 frames! The application may be doing too much work on its main thread. I/Choreographer﹕ Skipped 68 frames! The application may be doing too much work on its main thread. D/dalvikvm﹕ GC_FOR_ALLOC freed 21K, 5% free 3184K/3328K, paused 253ms, total 273ms I/dalvikvm-heap﹕ Grow heap (frag case) to…
has comment: http://stackoverflow.com/comment/43399355
answer count: 0
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43369360

http://stackoverflow.com/q/27426036
answer count: 0
has comment: http://stackoverflow.com/comment/43295666
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43297518
score: 0
has comment: http://stackoverflow.com/comment/43294124
has comment: http://stackoverflow.com/comment/43297454
tagged with: parse-platform
type: UnansweredQuestion
tagged with: android
has body: I'm making an android app that have 2 user types the first is an ordinary user that browses through news, the second type is administrator that can add news, edit them and delete.The admin can also add users and delete them .My question is about how can the administrator delete a user or multiple users at the same time ???
has title: How to delete multiple parse users from an android app?

http://stackoverflow.com/a/63017150
score: -2
answers question: http://stackoverflow.com/q/27393098
upvote count: 0
downvote count: 2
type: Answer
has body: InputStream responseBody = (InputStream) response.getEntity();

http://stackoverflow.com/a/27376026
has comment: http://stackoverflow.com/comment/44149358
has body: You're running into DATAREST-394 which has been fixed a few days a go and will be making it into 2.2.2 and 2.3 RC1. It's already available in the snapshots for said versions, feel free to give them a spin.
accepted answer of: http://stackoverflow.com/q/27354743
score: 5
type: AcceptedAnswer
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/43360588
answers question: http://stackoverflow.com/q/27354743
has comment: http://stackoverflow.com/comment/43273533
type: Answer

http://stackoverflow.com/q/27437603
tagged with: http://stackoverflow.com/tag/xml
upvote count: 3
type: UnansweredQuestion
has title: Setting standalone = 'YES' using XMLEventWriter
type: Question
has answer: http://stackoverflow.com/a/30095844
score: 3
tagged with: java
tagged with: java-7
answer count: 1
downvote count: 0
has body: I'm using 'XMLEventWriter' to generate an XML file in Java. Code snippet is as below: XMLEventWriter writer = outputFactory.createXMLEventWriter(new FileWriter(outFile)); XMLEvent startEvent = eventFactory.createStartDocument("UTF-8","1.0",true); writer.add(startEvent); In spite of setting the third argument to 'true', I'm seeing that the generated XML document's header does not have standalone="YES" Could anyone suggest the changes (if any) to be made to make standalone="yes" appear in the generated XML file's document header ?
favorite count: 0
linked to: http://stackoverflow.com/q/28629709

http://stackoverflow.com/comment/43205924
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27374799
has text: No, they can't. Actually we should improve `TriggerSourceOptionsMetadata#isValid()` that all those options are mutually exclusive. Please, raise an issue to address them all.
score: 0

http://stackoverflow.com/comment/43281647
type: Comment
has text: It's not possible to change the height of the system bar (back button, home button, recents button). You can only change the height of the action bar. (See here: [link](http://stackoverflow.com/questions/17439683/how-to-change-action-bar-size))
comment on: http://stackoverflow.com/a/27418662
type: AnswerComment
score: 0

http://stackoverflow.com/q/27368525
tagged with: android
score: 7
favorite count: 0
has title: finishAndRemoveTask() available on API 21
has answer: http://stackoverflow.com/a/27369159
type: Question
answer count: 2
upvote count: 7
has comment: http://stackoverflow.com/comment/43189502
has comment: http://stackoverflow.com/comment/43190105
tagged with: java
has body: I would terminate my app and cancel it from the list of recent task. finishAndRemoveTask() is available only on API 21. What should I use on API lower than 21??
accepted answer: http://stackoverflow.com/a/27369159
tagged with: api
tagged with: compatibility
has answer: http://stackoverflow.com/a/45649582
downvote count: 0
has comment: http://stackoverflow.com/comment/43189262
has comment: http://stackoverflow.com/comment/43189424
possible better answer: http://stackoverflow.com/a/45649582
type: AnsweredQuestion

http://stackoverflow.com/comment/43099062
has text: Notice your `url-pattern`. Then look at the URL of your request.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27319524

http://stackoverflow.com/comment/43230309
type: QuestionComment
type: Comment
has text: It's on r1==r2, and the error message is "identifier expected".
comment on: http://stackoverflow.com/q/27391135
score: 0

gridbaglayout
tags question: http://stackoverflow.com/q/27366614
tags question: http://stackoverflow.com/q/27351124
tags question: http://stackoverflow.com/q/27332964
type: Tag
tag name: gridbaglayout
tags question: http://stackoverflow.com/q/27371956
tags question: http://stackoverflow.com/q/27393795
tags question: http://stackoverflow.com/q/27348688

http://stackoverflow.com/q/27326463
upvote count: 1
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: intentfilter
has title: Launching app outside of sender using Intent Filter
answer count: 0
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43112195
has body: So I'm trying to capture geo addresses from outside my app, and I've set up the code that follows in my manifest: &lt;intent-filter android:priority="0"&gt; &lt;action android:name="android.intent.action.VIEW" /&gt; &lt;category android:name="android.intent.category.DEFAULT" /&gt; &lt;category android:name="android.intent.category.BROWSABLE" /&gt; &lt;data android:scheme="geo" /&gt; &lt;/intent-filter&gt; that works great, when I click a postal address or lat/lng pair in the browser, it has my app in the picker that pops up. The issue I have is that when selecting my app from said popup picker, it starts the Intent in the browser. I want to actually start my app outside of the browser, like what the Google Maps app does, as monopolizing the browser wouldn't be a very nice thing to do to my users. Thanks in advance for any suggestions, and apologies if this is already a question, I couldn't find something similar searching around.
type: Question
has comment: http://stackoverflow.com/comment/43112975

http://stackoverflow.com/comment/138377625
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27382100
has text: Hmm, just noticed curly braces in some code. Never used them myself.
score: 0

http://stackoverflow.com/q/27449611
tagged with: spring-security
possible better answer: http://stackoverflow.com/a/57618580
upvote count: 1
has title: Spring security, session is created without logging-in after session timeout
favorite count: 0
accepted answer: http://stackoverflow.com/a/27621080
tagged with: servlet-filters
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/27621080
tagged with: java
type: Question
answer count: 2
has body: I have created a default form-login authentication and below is my configuration. <request-cache ref="authenticationRequestCache" /> <access-denied-handler error-page="/rest/login?error=denied" /> <form-login login-page="/rest/login" authentication-success-handler-ref="successHandler" authentication-failure-url="/rest/login?error" /> <intercept-url pattern="/rest/devices" access="denyAll" /> <intercept-url pattern="/rest/devices/**" access="denyAll" /> <intercept-url pattern="/rest/super/**" access="hasRole('ROLE_SUPER')" /> <intercept-url pattern="/rest/**" access="isAuthenticated()" /> <intercept-url pattern="/cavirinRest/*" /> <session-management invalid-session-url="/rest/login?error=sessionExpired" session-authentication-strategy-ref="sas" /> <logout invalidate-session="true" logout-success-url="/rest/login" delete-cookies="JSESSIONID"/> Authentication works fine as expected, but recently i added session-timeout to the application. My application polls server for every 5 seconds, hence the default time out does not work. I googled and found below solution with filter and implemented it. from web.xml: XhrSessionTimeoutFilter com.cavirin.security.filter.XhrSessionTimeoutFilter XhrSessionTimeoutFilter /rest/* COOKIE 2 @Override protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException { HttpSession session = request.getSession(false); if (session != null) { logger.trace("doFilterInternal(): session object is not null."); session.setMaxInactiveInterval(120); //2 mins for testing //set max inactive interval to 30 mins // if requestURI is not null if (request.getRequestURI() != null) { logger.trace("doFilterInternal(): request.getRequestURI() : {} ", request.getRequestURI()); String ajaxHeader = request.getHeader("X-Requested-With"); logger.trace("doFilterInternal(): ajaxHeader : {} ", ajaxHeader); //if it is an AJAX call if ("XMLHttpRequest".equals(ajaxHeader)) { logger.tra…
has answer: http://stackoverflow.com/a/57618580

http://stackoverflow.com/comment/43214980
has text: for using javax.mail the user has to typ in their email adress etc. right? Multipel users are using this program, i just want to open an email client with the text-.-
type: Comment
comment on: http://stackoverflow.com/a/27382132
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43156480
type: QuestionComment
comment on: http://stackoverflow.com/q/27351172
has text: why do not you use next() since is gonna recognize a token ?
score: 1
type: Comment

http://stackoverflow.com/comment/43173040
comment on: http://stackoverflow.com/a/27360399
has text: Both the documentation and the source clearly show what the fields are used for, so in my opinion there is no more definitive answer than this.
type: AnswerComment
type: Comment
score: 0

http://stackoverflow.com/a/27318012
score: 0
answers question: http://stackoverflow.com/q/27317795
type: Answer
has body: Look into fpdf and fpdi, both free libraries for PHP are used in the creation of PDF docs. Since the SMTP protocol has conventions, actually strict rules, you can always count on the first empty line to be the before the content of the message. So you can definitely parse everything after the first part of the line to get the entirety of the message. For embedded images, you'll need a base 64 decoder (usually) or some other decoder based on the email's attachment encoding type to transform the data into a human readable image.

http://stackoverflow.com/comment/43248795
comment on: http://stackoverflow.com/a/27402011
has text: Maroun, is it possible to create arrays dynamically based on given input eg:num=81 so that i can create 9 array.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43416227
score: 2
comment on: http://stackoverflow.com/a/27432885
has text: AKS is insanely slow, and will not be faster than APR-CL for any number computable in geological scale time, much less human scale. APR-CL and ECPP were already around in 1997. As Brett mentions, ECPP is a good choice if we want a proof. All of these are slow compared to probable prime methods (e.g. M-R, BPSW, Frobenius).
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43174308
has text: You literally saved my project! THX
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27358255

http://stackoverflow.com/comment/43230571
type: AnswerComment
has text: I actually did override toString(), we are learning about inheritance right now and we are supposed to do it this way so that we are forced to use instanceof. I agree, your approach would be much better. Thanks!
type: Comment
comment on: http://stackoverflow.com/a/27391410
score: 0

http://stackoverflow.com/comment/43326538
type: QuestionComment
score: 0
has text: The question how to fork a VM per test is a valid question - but your "new findings" are not clarifying anything but rather adding confusion. Either remove them or move them to an answer.
comment on: http://stackoverflow.com/q/27440926
type: Comment

http://stackoverflow.com/comment/43149134
score: 0
type: Comment
type: QuestionComment
has text: oh, interesting, would you mind posting your answer? it may come handy and if it does ill vote it up
comment on: http://stackoverflow.com/q/27345193

http://stackoverflow.com/comment/43320822
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27440496
score: 0
has text: @POHH I think that was clear enough, you uselessly mark it down.

http://stackoverflow.com/a/27392106
accepted answer of: http://stackoverflow.com/q/27392006
answers question: http://stackoverflow.com/q/27392006
upvote count: 2
has body: IntegerTester must be in the same package as PrimeNumberProgram, otherwise you cannot access one from the other without importing.
type: AcceptedAnswer
type: Answer
score: 2
downvote count: 0

http://stackoverflow.com/comment/43407061
type: Comment
has text: Unfortunately, I can't help you any further with that because I'm not familiar with the SMSC and protocol your having to use, the guide will explain it to you, you'll just need to read it all thoroughly.
type: AnswerComment
comment on: http://stackoverflow.com/a/27433800
score: 0

http://stackoverflow.com/comment/43165328
comment on: http://stackoverflow.com/a/27356115
type: AnswerComment
score: 0
has text: In UncaughtExceptionHandler example, should I pass single object of Thread.UncaughtExceptionHandler to every thread or should I create individual object for every thread?
type: Comment

http://stackoverflow.com/comment/43377061
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27471123
has text: i can show tmp's entries but when i add to something else to map i lose old variable and it is show only new elements.

http://stackoverflow.com/comment/43179267
type: Comment
has text: OP has arrays. Don't make it more complicated.
comment on: http://stackoverflow.com/a/27363707
type: AnswerComment
score: 0

http://stackoverflow.com/q/27385363
has comment: http://stackoverflow.com/comment/43245886
has comment: http://stackoverflow.com/comment/43325224
type: Question
has body: I added a jar file mysql-connector-java-5.1.34-bin.jar to my $CATALINA_HOME/lib/ folder so I could use this library for connection pooling for mysql. I running a dedicated server with Centos 6.6 X64 with Cpanel. I installed jdk8 in /opt/jdk1.8.0_25 and installed tomcat 8 by untarring the download in the /home/username/ folder. I followed this tutorial: http://tecadmin.net/install-tomcat-8-on-centos-rhel-and-ubuntu/ A simple "Hello World" servlet is running by deploying a .war file in the public_html folder However now when I start up Tomcat (8.0.15) in the catalina.out file I see the error: 09-Dec-2014 17:45:49.152 INFO [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.15 09-Dec-2014 17:45:49.182 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive /home/username/public_html/J.war 09-Dec-2014 17:45:49.592 INFO [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time. 09-Dec-2014 17:46:04.623 INFO [localhost-startStop-1] org.apache.catalina.util.SessionIdGeneratorBase.createSecureRandom Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [14,997] milliseconds. 09-Dec-2014 17:46:04.657 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive /home/username/public_html/J.war has finished in 15,474 ms And the connection pooling doesn't work. At my previous server the hosting company had setup tomcat with Cpanel and this worked just fine. I did not change the servlets so that cannot be the problem either. My environment variables are: CATALINA_HOME=/home/username/apache-tomcat-8.0.15 JRE_HOME=/opt/jd…
has comment: http://stackoverflow.com/comment/43331630
tagged with: java
tagged with: mysql
score: 0
has comment: http://stackoverflow.com/comment/43219278
has title: Mysql-connector-java jar creates No TLDs error
has comment: http://stackoverflow.com/comment/43325264
tagged with: tomcat
tagged with: jdbc
tagged with: connection-pooling
answer count: 0
type: UnansweredQuestion

http://stackoverflow.com/comment/43290099
comment on: http://stackoverflow.com/a/27423874
type: Comment
has text: Its now working but here is something odd that is happening. When I check if a student exists in the database it automatically adds another student to my database. I think its linked to the code I created earlier where I was inserting a student to my database. Its inserting the same values I used before
score: 0
type: AnswerComment

http://stackoverflow.com/a/27524315
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/27458600
upvote count: 2
has body: I've found the solution. If it can help someone :) I just create a java class table2 with canal String, action String, time Date, timeend Date, Client String, and then : JavaRDD&lt;Table2&gt; table2 = session_7.map(new Function&lt;Tuple2&lt;KeyTable2, ValueTable2&gt;, Table2&gt;() { @Override public Table2 call(Tuple2&lt;KeyTable2, ValueTable2&gt; keyTable2ValueTable2Tuple2) throws Exception { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); Date startdate = formatter.parse(keyTable2ValueTable2Tuple2._1.time.replace("+",".")); Date endtdate = formatter.parse(keyTable2ValueTable2Tuple2._1.endtime.replace("+",".")); Table2 t = new Table2(keyTable2ValueTable2Tuple2._2.canal,keyTable2ValueTable2Tuple2._2.motif,startdate,endtdate,keyTable2ValueTable2Tuple2._1.client); return t; } }); javaFunctions(table2).writerBuilder("Schema", "Table", mapToRow(Table2.class)).saveToCassandra(); Note : you must add the getters in the class even if the differents variables are public.
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27458600

http://stackoverflow.com/q/27417494
tagged with: jsp
tagged with: servlets
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27417546
tagged with: multimap
type: Question
has title: how to Iterate multimap values in jsp
answer count: 1
tagged with: foreach
score: 0
tagged with: java
has body: How do I iterate or receive the value from a multimap? I have one key and that is associated with some array value. I want the first key, then all values, then second key other values, but I don't know how to iterate over multimap. Here is my code: Here is my servlet where I am calling my business logic class method public class Emp_Mapping extends HttpServlet { protected void processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { HttpSession session = request.getSession(true); Employee emp1 = (Employee)session.getAttribute("emp1"); session.setAttribute("emp1",emp1); EmployeeBean eb = new EmployeeBean(); List&lt;Employee&gt; detail2 = eb.emp_map_detail1(emp1);//here i am calling System.out.println(detail2); request.setAttribute("detail2",detail2); request.getRequestDispatcher("/EmployeeMapping.jsp").forward(request, response); }} Here is my method which of Employee class which I have kept as business logic class where all request coming after servlet to specific method by method call. Here it's working fine and it is holding the required value as I want: public List&lt;Employee&gt; emp_map_detail1(Employee emp1) { Connection con = null; Statement stmt2,stmt3,stmt4 = null; ResultSet rs2 =null; ResultSet rs3 =null; ResultSet rs4 =null; int e1=0, e2=0,e3=0,e4=0; String n2=null,n1=null,n4=null; List&lt;Employee&gt; detail2 = new ArrayList&lt;Employee&gt;(); Multimap&lt;String, String&gt; multimap1 = ArrayListMultimap.create(); Multimap&lt;String, String&gt; multimap2 = ArrayListMultimap.create(); List&lt;String&gt; myList2 = new ArrayList&lt;String&gt;(); try{ con = ConnectionManager.getConnection(); stmt2 = con.createStatement(); String Query12 = "select empId, empName from empinfo where access_type='manager'"; System.out.println("Query1 is" +Query12); rs2 = stmt2.executeQuery(Query12); while(rs2.next()) { e1 =Integer.parseInt(rs2.getString("empId")); n1 = rs2.getString("empName"); myList2.add(n1); stmt3 = con.cr…
has answer: http://stackoverflow.com/a/27417546

http://stackoverflow.com/q/27389552
accepted answer: http://stackoverflow.com/a/27444095
answer count: 4
favorite count: 0
type: AnsweredQuestion
upvote count: 2
tagged with: android-actionbar
downvote count: 1
type: Question
possible better answer: http://stackoverflow.com/a/29298161
has answer: http://stackoverflow.com/a/30204731
has answer: http://stackoverflow.com/a/29298161
score: 1
has comment: http://stackoverflow.com/comment/43227508
tagged with: java
has title: Android Toolbar
has answer: http://stackoverflow.com/a/33109696
has comment: http://stackoverflow.com/comment/43228394
has answer: http://stackoverflow.com/a/27444095
has body: I am very confused about how to change from ActionBar to toolbar in my application. I see a lot of documentation, and I cannot find any solution for my problem. Any help with my code is welcome. I need to change all my actionbar (deprecated) for the new toolbar and I cannot set the toolbar in the class that I have. A clue to the problem is in my extends or implements. i don't know, thanks for the advice! public class Quizz_View extends FragmentActivity implements ActionBar.TabListener { private ViewPager viewPager; private TabsPagerAdapter mAdapter; private ActionBar actionBar; private DrawerLayout leftDrawer; private ListView drawerListView; private ActionBar ldActionBar; private Toolbar toolBar; private ActionBarDrawerToggle abDrawerToggle; // private ArrayList&lt;Class_Questions&gt; questionsList = new // ArrayList&lt;Class_Questions&gt;(); GridView gridView; float xInicial; float yInicial; float xActual; float yActual; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.view_pager); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); //setSupportActionBar(toolbar); //menu del toolbar //toolbar.inflateMenu(R.menu.MENU); //toolbar.setTitle("AD NORMA"); //toolbar.setSubtitle("INGENIAT"); Button reply = (Button) findViewById(R.id.replyBtn); reply.setOnClickListener(new OnClickListener() { public void onClick(View v) { } }); final Button finish = (Button) findViewById(R.id.finishBtn); finish.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { } }); finish.setVisibility(View.INVISIBLE); /********************/ actionBar = getActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setDisplayShowHomeEnabled(true); // get ListView defined in activity_main.xml drawerListView = (ListView) findViewById(R.id.left_drawer); // crea_menu_navegacion(); // Set the adapter for the list view // drawerListView.setAdapter(); leftDrawer = (DrawerLayout) findViewById(R.id.dra…
has comment: http://stackoverflow.com/comment/43228314
has comment: http://stackoverflow.com/comment/43227482
tagged with: toolbar
tagged with: android
has comment: http://stackoverflow.com/comment/43227038

dictionary
tags question: http://stackoverflow.com/q/27433072
tags question: http://stackoverflow.com/q/27335073
tags question: http://stackoverflow.com/q/27384678
tags question: http://stackoverflow.com/q/27370398
tags question: http://stackoverflow.com/q/27352496
tags question: http://stackoverflow.com/q/27461443
tags question: http://stackoverflow.com/q/27462297
tags question: http://stackoverflow.com/q/27397114
tags question: http://stackoverflow.com/q/27344738
tag name: dictionary
tags question: http://stackoverflow.com/q/27472712
tags question: http://stackoverflow.com/q/27337508
tags question: http://stackoverflow.com/q/27364907
tags question: http://stackoverflow.com/q/27326576
tags question: http://stackoverflow.com/q/27341502
tags question: http://stackoverflow.com/q/27454911
tags question: http://stackoverflow.com/q/27352497
tags question: http://stackoverflow.com/q/27367207
tags question: http://stackoverflow.com/q/27333385
tags question: http://stackoverflow.com/q/27354481
type: Tag
tags question: http://stackoverflow.com/q/27458493
tags question: http://stackoverflow.com/q/27332319
tags question: http://stackoverflow.com/q/27454608
tags question: http://stackoverflow.com/q/27389882
tags question: http://stackoverflow.com/q/27469768
tags question: http://stackoverflow.com/q/27316635

http://stackoverflow.com/comment/43225226
type: Comment
has text: Maybe I worded badly, I need the key as soon as it gets created, I already know the key is being created. Everything is working fine no errors, the issue is that I need the key of the profile that gets created. It gets created when updating the user through a service call to the dao. I get the user key when update is successful, I need the profile key instead, but how? calling user.getprofilekey wont work because profiles is a set, I need the one that was just persisted
comment on: http://stackoverflow.com/q/27384322
score: 0
type: QuestionComment

http://stackoverflow.com/q/27386132
upvote count: 1
type: Question
tagged with: java
has body: I'm working with the US Census API (examples), in which there are optional parameters, which are space-separated. I needed a general-purpose URL templating mechanism, and Google led me to RFC 6570 and its implementations. But as I understand it, RFC 6570 can't template a query substring like: ...&amp;in=state:02+county:170&amp;... where "county" may be undefined and should be omitted if so, along with the preceding "+"-encoded space, to leave just ...&amp;in=state:02&amp;... Can RFC 6570 encode this? If not, is there an alternative templating syntax for general-purpose URI templating in common use I should consider that's implemented in Javascript and maybe Java? Is use of a "+" to delimit query sub-elements, as done here, common, or extremely quirky? (I'm asking about frequency-of-use, not whether it's wise!) Is RFC 6570 too restrictive for an application where one is not in control of the URI query syntaxes used? UPDATE I see two problems: one is the "+" separator, and the other is the use of ":" in e.g. "state:02", which I don't see how to do either.
downvote count: 0
tagged with: uritemplate
tagged with: url
tagged with: javascript
score: 1
favorite count: 0
answer count: 0
type: UnansweredQuestion
has title: Can RFC 6570 URI Templates encode space separators for optional parameters?

http://stackoverflow.com/q/27354441
favorite count: 0
upvote count: 5
has title: What to test with Robolectric?
tagged with: robolectric
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: unit-testing
type: Question
has comment: http://stackoverflow.com/comment/43194003
has comment: http://stackoverflow.com/comment/43164402
score: 5
has answer: http://stackoverflow.com/a/27379879
accepted answer: http://stackoverflow.com/a/27379879
has body: It seems to me that I am fundamentally misunderstanding the purpose of Robolectric. I've been battling with it for a week already, and so far getting a new error message is considered as making progress. I am able to test some basic stuff like static views in an activity, but when something more complicated things come into play things just fall apart. I had to extend Robolectric to support 3-rd party libraries with certain parameters, Appcompat action bars and numerous other things which was extremely time-consuming and wasn't really documented anywhere, and things are advancing at a pretty much glacial pace. I am starting to think that I am using it in a wrong way and it simply isn't supposed to do what I want it to do. The general app logic is quite straightforward so there isn't really much to unit test, the most complicated stuff is in the UI and remote API calls. Is Robolectric just supposed to make unit testing for Android less painful than with JUnit because it can run on the JVM and supports a few Android classes? Perhaps a black-box behaviour testing framework like Espresso would be more suitable for my needs? But we use continuos integration, and Robolectric was nice and easy to set up to run tests on the CI server, and I'd kind of like to keep it that way. What do you use Robolectric for? A lot of blog posts recommend it for "activity lifecycle testing", but since I'm also quite new in the Android world, I don't really understand the purpose of it, especially since the app I'm testing is portrait-only. Could someone please give an overview of what you use Robolectric for, and how do you do it, preferably with code examples and explain why and how those tests are important?
linked to: http://stackoverflow.com/q/26154337
tagged with: android
answer count: 1
tagged with: junit

http://stackoverflow.com/comment/43378410
type: QuestionComment
comment on: http://stackoverflow.com/q/27471868
score: 4
has text: Then you go and practice by reading documentation and tutorials.
type: Comment

http://stackoverflow.com/a/27390817
answers question: http://stackoverflow.com/q/27390775
score: 0
type: AcceptedAnswer
type: Answer
has body: your code if it did work only only add 0s it wont change the number just divide your number by 100.0d and it will be a double as 100.0d is a double or just rS = new String("0.0"+rI); if you want say the number 55 to be 0.055 not 0.55
accepted answer of: http://stackoverflow.com/q/27390775

http://stackoverflow.com/a/39148988
score: 0
has body: There is a way to change fonts for Java output. See details here: http://mrhaki.blogspot.com/2008/06/change-font-in-output-window-in.html
answers question: http://stackoverflow.com/q/27443510
type: Answer

http://stackoverflow.com/a/27446087
answers question: http://stackoverflow.com/q/27445848
score: 0
type: AcceptedAnswer
type: Answer
has body: Regardless of whether it works or not (because it likely will), if your platform is not listed in the Supported Platforms document if you run into difficulties you will be required to duplicate the issue on a supported platform.
accepted answer of: http://stackoverflow.com/q/27445848

http://stackoverflow.com/comment/43301782
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27429992
has text: @duffymo I think he wants to know **why** it's `final`, instead of just being a robot and doing what the compiler says...

http://stackoverflow.com/comment/43320288
comment on: http://stackoverflow.com/q/27433291
has text: @VinceEmigh Acknowledged. I don't want to switch to the "blame" rhetoric, the dev team could simply say that this was not a public API anyway. But it's not a nice situation. I hope I'll pursuade the to revert the change. Bytecode manipulation is a bit too low-level, probably not an option.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43152576
comment on: http://stackoverflow.com/a/27348050
type: Comment
has text: I fixed it, the for condition was indeed wrong since I looked at the value of the wrong node
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43421936
comment on: http://stackoverflow.com/q/27429873
score: 0
type: QuestionComment
has text: I suspect that you are losing your authentication when the application switches to a new thread. You can check for this by adding the thread ID to your logging output. For example, with log4j you can add "%t to your ConversionPattern.
type: Comment

http://stackoverflow.com/a/27588231
has body: I am not an expert in Java, but just from reading the first couple lines of your code, I noticed that you are initializing r=new TrieNode(name.charAt(0));. This doesn't work in Java because the objects are passed by value not by reference, so you basically can't change what they are pointing to inside the function. Read this article for more details.
answers question: http://stackoverflow.com/q/27458079
score: 0
type: Answer

http://stackoverflow.com/q/27316485
favorite count: 0
has body: I use Jackson 2.2.3 to serialize POJOs to JSON. Then I had the problem, that I couldn't serialize recursive structures...I solved this problem by using @JsonIdentityInfo => works great. But, I don't want this annotation on the top of my POJO. So my question is: Is there any other possibility to set the default behavior of my ObjectMapper to use the feature for every POJO? So I want to transform this annotation code @JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@id") to something like ObjectMapper om = new ObjectMapper(); om.setDefaultIdentityInfo(ObjectIdGenerators.IntSequenceGenerator.class, "@id"); Any ideas?
tagged with: serialization
possible better answer: http://stackoverflow.com/a/33428573
upvote count: 5
has answer: http://stackoverflow.com/a/33428573
accepted answer: http://stackoverflow.com/a/27324281
type: AnsweredQuestion
downvote count: 0
has answer: http://stackoverflow.com/a/27324281
tagged with: java
has title: Using @JsonIdentityInfo without annotations
type: Question
tagged with: http://stackoverflow.com/tag/json
answer count: 2
score: 5
tagged with: jackson

http://stackoverflow.com/q/27393785
has comment: http://stackoverflow.com/comment/43818241
has comment: http://stackoverflow.com/comment/43243704
has comment: http://stackoverflow.com/comment/43850443
has comment: http://stackoverflow.com/comment/43790821
tagged with: jdbc
has comment: http://stackoverflow.com/comment/43243094
has comment: http://stackoverflow.com/comment/43235640
has comment: http://stackoverflow.com/comment/43234780
has comment: http://stackoverflow.com/comment/43851847
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43865165
linked to: http://stackoverflow.com/q/11516747
has comment: http://stackoverflow.com/comment/43235689
has comment: http://stackoverflow.com/comment/43852996
has comment: http://stackoverflow.com/comment/43789925
has comment: http://stackoverflow.com/comment/43243412
upvote count: 7
has comment: http://stackoverflow.com/comment/43243457
has comment: http://stackoverflow.com/comment/43788523
has comment: http://stackoverflow.com/comment/43868622
has comment: http://stackoverflow.com/comment/43811916
has answer: http://stackoverflow.com/a/27644692
score: 4
tagged with: java
has comment: http://stackoverflow.com/comment/43244005
downvote count: 3
has comment: http://stackoverflow.com/comment/43235437
has body: I am running tomcat 7.0.47 on my windows and there I am having the Mysql database connection to the data stored at BlueHost .When I run it locally it runs successully and makes conenction to the BlueHost database without any error .But when I try to deploy its war file at the linux environment running tomcat 7.0.42 it gives me following error: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' Also , I have imported the tomcat.dbcp jar to the online server as linux has some issues with this jar . Also, Server is working if I donot follow connection pooling approach . I am not able to find out What can be the issue with pooling ? Following is my context.xml file: &lt;Context antiJARLocking="true" path="/web_app"&gt; &lt;Resource name="jdbc/DB" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="DBUser" password="DBPassword" driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://xx.xx.xx.xx:xx/DB_app?useUnicode=true&amp;#38;characterEncoding=UTF-8"/&gt; &lt;/Context&gt; web.xml: &lt;resource-ref&gt; &lt;description&gt;MySQL Datasource&lt;/description&gt; &lt;res-ref-name&gt;jdbc/DB&lt;/res-ref-name&gt; &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt; &lt;res-auth&gt;Container&lt;/res-auth&gt; &lt;/resource-ref&gt; DatabaseConnection.java: public class Get_Database_Connection { static DataSource ds; public static Connection con=null; public static Connection get_DB_Connection() throws NamingException,SQLException { if(ds==null) { Context ctx = new InitialContext(); ds = (DataSource) ctx.lookup("java:comp/env/jdbc/DB"); return ds.getConnection(); } else { return ds.getConnection(); } } }
has comment: http://stackoverflow.com/comment/43235056
has comment: http://stackoverflow.com/comment/43788504
has comment: http://stackoverflow.com/comment/43243754
tagged with: mysql
has comment: http://stackoverflow.com/comment/43790011
type: Question
has comment: http://stackoverflow.com/comment/43707980
has title: Getting Null for JDBC connection
has comment: http://stackoverflow.com/comment/43850703
has comment: http://stackoverflow.com/comment/43788634
has comment: http://stackoverflow.com/comment/43234802
has comment: http://stackoverflow.com/comment/77117709
answer count: 1
tagged with: tomcat
has comment: http://stackoverflow.com/comment/43788728
favorite count: 0

http://stackoverflow.com/comment/90422116
type: AnswerComment
has text: Just updated the answer as per the comments. Thank you.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/28686920

http://stackoverflow.com/q/27327838
has comment: http://stackoverflow.com/comment/43125161
score: 7
tagged with: java
tagged with: http://stackoverflow.com/tag/json
tagged with: gson
has answer: http://stackoverflow.com/a/27327993
upvote count: 7
type: Question
accepted answer: http://stackoverflow.com/a/27327993
has comment: http://stackoverflow.com/comment/43133011
possible better answer: http://stackoverflow.com/a/27338331
has body: I have my original JSON String like this in which I have key and value as shown below - { "u":{ "string":"1235" }, "p":"2047935", "client_id":{ "string":"5" }, "origin":null, "item_condition":null, "country_id":{ "int":3 }, "timestamp":{ "long":1417823759555 }, "impression_id":{ "string":"2345HH*" }, "is_consumerid":true, "is_pid":false } As an example, one key is "u" and its value is - { "string":"1235" } Similarly another key is "country_id" and its value is - { "int":3 } Now what I need to do is, I need to represent key value pair as shown below. If any value is string data type (like value for key u), then represent it's value in double quotes, otherwise don't represent it's value in double quotes. Meaning value of country_id won't be in String double quotes since it is an int. "u": "1235" "p": "2047935" "client_id": "5" "origin":null "item_condition":null "country_id": 3 // I don't have double quotes here around 3 since country_id was int that's why "timestamp": 1417823759555 "impression_id": "2345HH*" "is_consumerid": true "is_pid": false And then I need to make another json string which should look like this - { "u": "1235", "p": "2047935", "client_id": "5", "origin":null, "item_condition":null, "country_id": 3, "timestamp": 1417823759555, "impression_id": "2345HH*", "is_consumerid": true, "is_pid": false } So I started my approach like this and came with below code - String response = "original_json_string"; Type type = new TypeToken&lt;Map&lt;String, Object&gt;&gt;() {}.getType(); JsonObject jsonObject = new JsonParser().parse(response).getAsJsonObject(); for (Map.Entry&lt;String, JsonElement&gt; object : jsonObject.entrySet()) { if (object.getValue() instanceof JsonObject) { String data = object.getValue().toString(); Map&lt;String, Object&gt; jsonIn = gson.fromJson(data, type); Map&lt;String, Object&gt; jsonOut = new HashMap&lt;String, Object&gt;(); Set&lt;String&gt; keys = jsonIn.keySet(); for (String key : keys) { Object value = jsonIn.get(key); if (val…
has answer: http://stackoverflow.com/a/27338331
answer count: 2
downvote count: 0
has title: How to preserve data types of a particular key in JSON Object using GSON?
tagged with: string
favorite count: 0
has comment: http://stackoverflow.com/comment/43115678
has comment: http://stackoverflow.com/comment/43126990
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43114850

http://stackoverflow.com/q/27415423
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43274903
type: Question
tagged with: tuckey-urlrewrite-filter
has title: why my urlrewrite does not work?
has body: I'm using Tuckey URL Rewrite Filter, ex: <rule> ^/company/([0-9]+).html /companypreview?id=$1 but it does not work~ when I enter the /company/123.html ,it return 404 but I enter the /companypreview?id=123 is return a real page
upvote count: 1
has comment: http://stackoverflow.com/comment/43274901
tagged with: url-rewriting
favorite count: 0
type: UnansweredQuestion
answer count: 0
downvote count: 0

http://stackoverflow.com/comment/43132574
comment on: http://stackoverflow.com/a/27337957
type: AnswerComment
score: 0
has text: I downloaded javaee-api-7.0.jar into my lib/ subdirectory. My command line starts with: java -classpath app.jar:lib/*.jar
type: Comment

http://stackoverflow.com/comment/43126201
score: 0
comment on: http://stackoverflow.com/q/27334545
type: Comment
type: QuestionComment
has text: Umm...i'm not seeing the difference. Aside from the private vs public, the only obvious changes are to variable/method names and output text. (BTW, outputting text here seems wrong.) What the method actually *does*, how it works, hasn't changed one bit.

http://stackoverflow.com/a/27329115
has body: I think this is giving you the NullPointerException ChatPanel.pw.println(ChatPanel.name + " has disconnected from the chat."); because ChatPanel.pw has never been initialized in your code, and therefore is null You should ensure that ChatPanel.pw has been initialized somewhere (maybe within the constructor) inside your ChatPanel class before calling the ChatPanel.pw.println()
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27326738
has comment: http://stackoverflow.com/comment/43117691
type: Answer
has comment: http://stackoverflow.com/comment/43117833
answers question: http://stackoverflow.com/q/27326738
has comment: http://stackoverflow.com/comment/43117627

http://stackoverflow.com/comment/43119343
type: Comment
has text: so basically for loop the inner selects? (I'll test tomorrow and update)
comment on: http://stackoverflow.com/a/27330170
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43165616
type: QuestionComment
has text: @nop77svk spaces ... between *item* and *number* :)
type: Comment
comment on: http://stackoverflow.com/q/27356353
score: 0

http://stackoverflow.com/q/27412690
type: Question
has comment: http://stackoverflow.com/comment/43269797
score: 0
answer count: 1
has body: When I set the event Mouse_Clicked it should go back to the main menu but does nothing when I click on the mouse. I want it to go to MENUSTATE which is the main menu but nothing happens. I need help since this is a school project and I don't know what is wrong. package GameState; import java.awt.Color; import java.awt.Font; import java.awt.Graphics2D; import java.awt.event.MouseEvent; import main.GamePanel; public class HelpState extends GameState { private Color titleColor; private Font titleFont; public HelpState(GameStateManager gameStateManager) { init(); } @Override public void init() { } @Override public void update() { // TODO Auto-generated method stub } @Override public void draw(Graphics2D g) { g.setColor(titleColor); g.setFont(titleFont); g.clearRect(1, 1, GamePanel.WIDTH, GamePanel.HEIGHT); g.drawString("Move Left: Left Arrow ", 0, 25); g.drawString("Move Right: Right Arrow ", 0, 45); g.drawString("Attack: A Button ", 0, 65); g.drawString("Become Other Wumps: You must have things happened to", 0, 85); g.drawString("you (Eg. Get smashed by a wall). After that you must press ", 0, 95); g.drawString("the corresponding No. Key.", 0, 105); } private void select() { gsm.setState(GameStateManager.MENUSTATE); } public void mousePressed(int m) { if (m == MouseEvent.MOUSE_CLICKED) { select(); } } @Override public void keyReleased(int k) { // TODO Auto-generated method stub } @Override public void keyPressed(int k) { // TODO Auto-generated method stub } }
has comment: http://stackoverflow.com/comment/43269931
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27412864
has comment: http://stackoverflow.com/comment/43269775
has title: Java GameState not changing

http://stackoverflow.com/comment/62832937
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/28995796
score: 0
has text: Aha, I see. Well, that makes sense.

http://stackoverflow.com/comment/43291359
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27424659
type: Comment
has text: You could also serialize the Strings and use Base64 on it.

splunk
tags question: http://stackoverflow.com/q/27314791
type: Tag
tags question: http://stackoverflow.com/q/27397714
tag name: splunk

http://stackoverflow.com/a/27374746
type: Answer
has body: I would need more of your source code to give you a precise answer. However, I believe I can help you with some observations. The program will always enter an infinite loop if the method parameter moved is outside the range 0 through 7. In the movement method, the final if condition can never evaluate to true, because the same condition was required to evaluate to false before the loop could exit. Based on these observations, I suggest you try this version of the movement method: public boolean movement(Move m, int moved) { int rowM, colM, row, col; Player p = m.getPlayer(); if (moved == 0 || moved == 1 || moved == 7) rowM = -1; else if (moved == 3 || moved == 4 || moved == 5) rowM = 1; else // moved == 2 || moved == 6 rowM = 0; if (moved == 5 || moved == 6 || moved == 7) colM = -1; else if (moved == 1 || moved == 2 || moved == 3) colM = 1; else // moved == 0 || moved == 4 colM = 0; row = rowM + m.getRow(); col = colM + m.getColumn(); return onBoard(row, col) &amp;&amp; getPiece(row, col).opposite(p.getPiece()); }
downvote count: 0
score: 1
upvote count: 1
answers question: http://stackoverflow.com/q/27373201

http://stackoverflow.com/a/27390582
downvote count: 0
answers question: http://stackoverflow.com/q/27385736
has comment: http://stackoverflow.com/comment/43284388
has comment: http://stackoverflow.com/comment/43253820
has comment: http://stackoverflow.com/comment/43255886
accepted answer of: http://stackoverflow.com/q/27385736
type: Answer
has comment: http://stackoverflow.com/comment/43248919
upvote count: 1
has comment: http://stackoverflow.com/comment/43284687
score: 1
has body: Imagine if you had a farm and were raising valuable ostriches. To prevent the ostriches wandering off and being eaten by lions, you erect a fence around the farm. But unfortunately you only have enough fencing wire to put up a fence around 3 of the 4 sides of the farm. Would the Ostriches (and therefore your investment) be safe? Of course not. It is the same principle with security. Any library Jar that is not digitally signed is a potential source of a security breach. Leading to the bottom line.. Every Jar in an app. must be digitally signed before the app. could be considered to be secure and trustworthy. ..if I sign libraries that are already signed will the new signature override the old one? Not necessarily. From jarsigner docs: Multiple Signatures for a JAR File we see.. Multiple Signatures for a JAR File A JAR file can be signed by multiple people by running the jarsigner command on the file multiple times and specifying the alias for a different person each time, as follows: jarsigner myBundle.jar susan jarsigner myBundle.jar kevin When a JAR file is signed multiple times, there are multiple .SF and .DSA files in the resulting JAR file, one pair for each signature. In the previous example, the output JAR file includes files with the following names: SUSAN.SF SUSAN.DSA KEVIN.SF KEVIN.DSA
type: AcceptedAnswer

http://stackoverflow.com/a/27429177
type: Answer
has body: I don't know this book, but this example is totally misleading! Basically new int[3+1] will initialize an int array of size 4, not 3. Given a method int[] generateArray(int size) I would absolutely expect that it will generate an array of size passed as the argument, not a one that is size + 1. The only way the method could make any sense is naming it: generateArrayThatHasLastIndex(int lastIndex). Any other way it is wrong.
answers question: http://stackoverflow.com/q/27429009
has comment: http://stackoverflow.com/comment/43300295
upvote count: 4
accepted answer of: http://stackoverflow.com/q/27429009
type: AcceptedAnswer
downvote count: 0
score: 4

http://stackoverflow.com/comment/43233992
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27393344
type: Comment
has text: This is working for me, what is ur problem?

http://stackoverflow.com/a/27336817
accepted answer of: http://stackoverflow.com/q/27327404
has body: I think that you (and I also:)) got a lttle bit confused because you are using Integer-objects as index and as list elements. That is no problem with the List.get method, because there is only one get method which is expecting an int and Java converts the Integer to int. The problem is in your usage of list.remove(). There are two methods, one expects an object and one an int. So if you pass an Integer object, the remove(Object) method is called. But you pass the index, not the r-matching object, so the remove method fails sometimes, because it is random if the element is in your list if remove was called before. And if the method not fails, you have removed the element with the value of your index(+1), not the one who matches r. for(Integer i = 0; i &lt; 10; i++) { Integer r = (int)(Math.random() * 10) + 1; for (Integer j = 0; j &lt;= list.size() - 1; j++) { if (list.get(j) == r) { remove = j + 1; list.remove(remove);//the main error is here you found 4 //on index 2 and removes 3 (because of +1) perm.add(r); } } } The next thing is, that random can deliver the same number more than once, so you should not loop only 10 times. Loop until the list is empty. I have corrected the code as below, the original lines are commented before the correction. //for (Integer i = 0; i &lt; 10; i++) { while (!list.isEmpty()) { Integer r = (int) (Math.random() * 10) + 1; for (Integer j = 0; j &lt;= list.size() - 1; j++) { //if (list.get(j) == r) { if (list.get(j).equals(r)) { //remove = j + 1; remove = list.get(j); list.remove(remove); perm.add(r); } } } And here I put the code somewhat more clearly, so that it is easier to read public static ArrayList&lt;Integer&gt; createPerm() { ArrayList&lt;Integer&gt; list = new ArrayList&lt;Integer&gt;(10); for (int i = 0; i &lt; 10; i++) { list.add(i+1); } ArrayList&lt;Integer&gt; perm = new ArrayList&lt;Integer&gt;(10); while (!list.isEmpty()) { int r = (int) (Math.random() * 10) + 1; for (int j = 0; j &lt; list.size(); j++) { if (list.get(j)…
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27327404
score: 0
has comment: http://stackoverflow.com/comment/43153574
type: Answer

http://stackoverflow.com/q/27361321
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1
has body: I have followed a tutorial on Youtube about how to post data to a Google spreadsheet. It works and I can send words to the spreadsheet. All great, but I need to be able to use select for a true or false question in the spreadsheet. The code I am using: public void postData() { String fullUrl = "https://docs.google.com/forms/d/1kgVjyzamlIVSkd-BiW5iA-AHkVLqcNf9IxObyNyygTg/formResponse"; HttpRequest mReq = new HttpRequest(); String col1 = "Hello"; String col2 = "World"; String col3 = "true"; String data = "entry_221637619=" + URLEncoder.encode(col1) + "&amp;" + "entry_838953460=" + URLEncoder.encode(col2) + "&amp;" + "entry_1848159036=" + URLEncoder.encode(col3); String response = mReq.sendPost(fullUrl, data); Log.i(myTag, response); } String col3 is the variable that is using the true or false question. If I remove col3 from this code it will work but since it is a required field it doesn't work. Does anyone know how to do this? Link to the form: http://goo.gl/forms/agGnl39cXT Link to the responses: https://docs.google.com/spreadsheets/d/10Mjbwmlu_C-2OSQmMyS-5_-8GnRQhXw0Dd6_KG5onQM/pubhtml
tagged with: java
has comment: http://stackoverflow.com/comment/43185967
type: Question
has comment: http://stackoverflow.com/comment/43179916
has comment: http://stackoverflow.com/comment/43180832
tagged with: google-apps-script
upvote count: 1
linked to: http://stackoverflow.com/q/10000020
has comment: http://stackoverflow.com/comment/43189500
has comment: http://stackoverflow.com/comment/43180530
has comment: http://stackoverflow.com/comment/43180310
favorite count: 0
has comment: http://stackoverflow.com/comment/43181312
has comment: http://stackoverflow.com/comment/43180136
tagged with: android
has title: Java android app, post data to google spreadsheet "true" or 'false" options

http://stackoverflow.com/comment/43246494
type: Comment
comment on: http://stackoverflow.com/q/27382397
has text: can't you simply re-focus as soon as the popup closes? Also if you show some code we can follow more closely what's (not) happening.
score: 0
type: QuestionComment

http://stackoverflow.com/a/27439585
score: 1
accepted answer of: http://stackoverflow.com/q/27439451
has comment: http://stackoverflow.com/comment/43319266
has comment: http://stackoverflow.com/comment/43319612
answers question: http://stackoverflow.com/q/27439451
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43318959
type: Answer
has body: It is a very bad idea to load 150000 records into memory. I believe you should have a paging and load only a small chunk into memory at a time, like 10 records. If you switch your strategy to use a paging, then your memory problems will be solved.
upvote count: 1
has comment: http://stackoverflow.com/comment/43319493

http://stackoverflow.com/q/27367453
tagged with: java
has answer: http://stackoverflow.com/a/27367663
has body: I'm trying to copy element from my array list then to pass it to my activity. Also in my if statement where I'm checking gfList is not equal 0 java complaining about Cannot cast from GroupedFeed to int. If anyone know what is the problem and can show me how to copy and past the element to my activity I would appreciate that. Thanks in advance! Here is my code: // I created my for loop but that did not work GroupedFeed findFeed(String locateSport){ if ((int) gfList != 0){ for(int i = 0; i != gfList.size();i++){ if(gfList[i].category.equalsIngnoreCase(locateSport)){ } } return gfResult; } } public boolean onChildClick(ExpandableListView parent, android.view.View v, int groupPosition, int childPosition, long id) { switch (groupPosition){ case 0: switch (childPosition){ case 0: // gfResult = findFeed("Men's Baseball"); Baseball(); // pass gfResult break; } return false; } private void Baseball() { Intent myIntent = new Intent(MainActivity.this, Baseball.class); startActivity(myIntent); } }); Main myMain = new Main(); try { // AssetManager aMan = getAssets(); this.gfList = myMain.loadRSS(); } catch (Exception e) { System.out.println("Hosed"); } } } Here is my array-list: this Main (id=831962574768) groupedFeeds ArrayList (id=831963150464) array Object[12] (id=831963153088) [0] GroupedFeed (id=831963152968) category "Women's Golf" (id=831962986192) feeds ArrayList (id=831963152992) [1] GroupedFeed (id=831963153592) category "Volleyball" (id=831962991720) feeds ArrayList (id=831963153616) [2] GroupedFeed (id=831963153744) category "Men's Soccer" (id=831962996544) feeds ArrayList (id=831963153768) [3] GroupedFeed (id=831963153896) category "Women's Soccer" (id=831963006320) feeds ArrayList (id=831963153920) [4] GroupedFeed (id=831963154864) category "Men's Golf" (id=831963016488) feeds ArrayList (id=831963154888) [5] GroupedFeed (id=831963155072) category "Men's Cross Country" (id=831963036816) feeds ArrayList (id=831963155096) [6] GroupedFeed (id=831963155224) category "Wo…
has title: How do I copy an element in java?
downvote count: 0
accepted answer: http://stackoverflow.com/a/27367704
tagged with: arraylist
has comment: http://stackoverflow.com/comment/43186982
tagged with: android
has answer: http://stackoverflow.com/a/27367643
possible better answer: http://stackoverflow.com/a/27367595
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/27367595
upvote count: 1
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27367704
score: 1

http://stackoverflow.com/comment/43341902
comment on: http://stackoverflow.com/q/27446695
score: 0
has text: Can we see your event class
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27352854
has comment: http://stackoverflow.com/comment/43159494
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43180184
answers question: http://stackoverflow.com/q/27352740
accepted answer of: http://stackoverflow.com/q/27352740
upvote count: 2
has comment: http://stackoverflow.com/comment/43159751
type: AcceptedAnswer
has body: Fortunately this is not possible because it will introduce lots of spam. But you can use this method to send an SMS with your program. private void sendSms(String phonenumber,String message, boolean isBinary) { SmsManager manager = SmsManager.getDefault(); PendingIntent piSend = PendingIntent.getBroadcast(this, 0, new Intent(SMS_SENT), 0); PendingIntent piDelivered = PendingIntent.getBroadcast(this, 0, new Intent(SMS_DELIVERED), 0); if(isBinary) { byte[] data = new byte[message.length()]; for(int index=0; index&lt;message.length() &amp;&amp; index &lt; MAX_SMS_MESSAGE_LENGTH; ++index) { data[index] = (byte)message.charAt(index); } manager.sendDataMessage(phonenumber, null, (short) SMS_PORT, data,piSend, piDelivered); } else { int length = message.length(); if(length &gt; MAX_SMS_MESSAGE_LENGTH) { ArrayList&lt;String&gt; messagelist = manager.divideMessage(message); manager.sendMultipartTextMessage(phonenumber, null, messagelist, null, null); } else { manager.sendTextMessage(phonenumber, null, message, piSend, piDelivered); } } }
type: Answer
has comment: http://stackoverflow.com/comment/43171598

http://stackoverflow.com/comment/43231761
type: Comment
comment on: http://stackoverflow.com/a/27392081
type: AnswerComment
has text: Give a man a fish and you feed him for a day; teach a man to fish and you feed him for a lifetime. Additionally notice he needs to convert numerical 2 to "two" and C to "clubs".
score: 0

http://stackoverflow.com/q/27377830
has comment: http://stackoverflow.com/comment/43205736
has body: In the case of a ListView if we want to make a particular item selected we use the setSelection method. How do we do this in case of RecyclerView?
favorite count: 0
has answer: http://stackoverflow.com/a/28617619
upvote count: 37
type: UnansweredQuestion
tagged with: android
has answer: http://stackoverflow.com/a/28581699
answer count: 4
tagged with: android-recyclerview
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/29191196
type: Question
score: 37
has answer: http://stackoverflow.com/a/28599656
has title: What is the equivalent listview.setSelection in case of Recycler View

http://stackoverflow.com/q/27375608
type: Question
tagged with: json-lib
has title: Unable to compile JSONObject in JSP
tagged with: java
score: 0
has body: please assist me anyway you can with the following code(using Intellij IDEA 14.0 demo , but I fire up Tomcat manually,using TOMCAT8.exe): &lt;%@ page language="java" %&gt; &lt;%@ page import="org.apache.commons.lang3.*" %&gt; &lt;%@ page import="org.apache.commons.beanutils.*" %&gt; &lt;%@ page import="org.apache.commons.collections4.*" %&gt; &lt;%@ page import="org.apache.commons.logging.*" %&gt; &lt;%@ page import="net.sf.json.JSONObject" %&gt; &lt;%@ page import="net.sf.json.JSONArray" %&gt; &lt;% JSONObject my_data = new JSONObject(); JSONObject row = new JSONObject(); JSONObject dataUsers = new JSONObject(); JSONArray rows = new JSONArray(); JSONArray cells = new JSONArray(); cells.add("x1"); cells.add("x2"); cells.add("x3"); cells.add("x4"); row.put("id","id_val1"); row.put("cells",cells); dataUsers.put("nume","total"); dataUsers.put("salariu","1000"); rows.add(row); my_data.put("rows",rows); my_data.put("dataUser",dataUsers); //out.print(my_data); out.print(my_data.toString(2)); %&gt; Allthough I included the dependency libs as specified http://json-lib.sourceforge.net/ in CATALINA_HOME/lib and in PROJECT_ROOT/lib I still get this: The error log from Tomcat 09-Dec-2014 11:17:32.493 SEVERE [http-apr-9999-exec-3] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [jsp] in context with path [/SAN] threw exception [An exception occurred processing JSP page /db.jsp at line 53 53: JSONObject my_data = new JSONObject(); 54: JSONObject row = new JSONObject(); 55: JSONObject dataUsers = new JSONObject(); 56: Stacktrace:] with root cause java.lang.ClassNotFoundException: org.apache.commons.lang.exception.NestableRuntimeException at java.net.URLClassLoader$1.run(URLClassLoader.java:372) 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 java.lang.Clas…
answer count: 1
tagged with: jsp
tagged with: tomcat8
has answer: http://stackoverflow.com/a/27376212
accepted answer: http://stackoverflow.com/a/27376212
type: AnsweredQuestion

http://stackoverflow.com/comment/43284881
type: Comment
comment on: http://stackoverflow.com/a/27421133
has text: That's only the easy part. He is looking for way to pass information around.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43231195
type: Comment
score: 1
has text: You need a `DisplayMode` object. The error message is pretty self-explanatory. `getWidth()` and `getHeight()` are instance methods, not static methods, and they need an instance of `DisplayMode` to work with. I don't know how to use LWJGL so I can't help you any further.
comment on: http://stackoverflow.com/q/27391745
type: QuestionComment

http://stackoverflow.com/comment/43242733
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27397971
score: 0
has text: [`BufferedImage#getSubImage`](https://docs.oracle.com/javase/7/docs/api/java/awt/image/BufferedImage.html#getSubimage(int,%20int,%20int,%20int)), you will need to know the number of columns before you can calculate the number of rows...

http://stackoverflow.com/q/27452035
has title: Force close when setting onclick
has answer: http://stackoverflow.com/a/27452079
has comment: http://stackoverflow.com/comment/43342657
tagged with: android
has comment: http://stackoverflow.com/comment/43342757
downvote count: 1
favorite count: 0
upvote count: 0
has answer: http://stackoverflow.com/a/27452077
type: UnansweredQuestion
tagged with: java
score: -1
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43342606
has comment: http://stackoverflow.com/comment/43342602
has body: I created a button and assigned it 1 by doing remove.setId(0 + count); Then I tried to put that button in my onCreate bundle to use it Button remove = (Button)findViewById(1); remove.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub } }); When I create the button remove in my oncreate it runs but as soon as I add my onclick listener I dont get any errors but when I run it it force closes Log 12-12 13:42:06.172: D/AndroidRuntime(19502): Shutting down VM 12-12 13:42:06.172: W/dalvikvm(19502): threadid=1: thread exiting with uncaught exception (group=0x416bbd40) 12-12 13:42:06.178: E/AndroidRuntime(19502): FATAL EXCEPTION: main 12-12 13:42:06.178: E/AndroidRuntime(19502): Process: com.th3ramr0d.armytrooptotask, PID: 19502 12-12 13:42:06.178: E/AndroidRuntime(19502): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.th3ramr0d.armytrooptotask/com.th3ramr0d.armytrooptotask.MainActivity}: java.lang.NullPointerException 12-12 13:42:06.178: E/AndroidRuntime(19502): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2209) 12-12 13:42:06.178: E/AndroidRuntime(19502): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2269) 12-12 13:42:06.178: E/AndroidRuntime(19502): at android.app.ActivityThread.access$800(ActivityThread.java:139) 12-12 13:42:06.178: E/AndroidRuntime(19502): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210) 12-12 13:42:06.178: E/AndroidRuntime(19502): at android.os.Handler.dispatchMessage(Handler.java:102) 12-12 13:42:06.178: E/AndroidRuntime(19502): at android.os.Looper.loop(Looper.java:136) 12-12 13:42:06.178: E/AndroidRuntime(19502): at android.app.ActivityThread.main(ActivityThread.java:5102) 12-12 13:42:06.178: E/AndroidRuntime(19502): at java.lang.reflect.Method.invokeNative(Native Method) 12-12 13:42:06.178: E/AndroidRuntime(19502): at java.lang.reflect.Method.invoke(Method.java:515) 12-12 13:42:06…

http://stackoverflow.com/tag/csv
type: Tag
tags question: http://stackoverflow.com/q/27323639
tag name: csv
tags question: http://stackoverflow.com/q/27403737
tags question: http://stackoverflow.com/q/27395703
tags question: http://stackoverflow.com/q/27457215
tags question: http://stackoverflow.com/q/27324187
tags question: http://stackoverflow.com/q/27380583
tags question: http://stackoverflow.com/q/27388214
tags question: http://stackoverflow.com/q/27394041
tags question: http://stackoverflow.com/q/27367566
tags question: http://stackoverflow.com/q/27362159
tags question: http://stackoverflow.com/q/27419532
tags question: http://stackoverflow.com/q/27435120
tags question: http://stackoverflow.com/q/27371143
tags question: http://stackoverflow.com/q/27421568
tags question: http://stackoverflow.com/q/27325854
tags question: http://stackoverflow.com/q/27468715

http://stackoverflow.com/comment/43143860
comment on: http://stackoverflow.com/q/27344160
has text: read section 51.7 http://www.gradle.org/docs/current/userguide/dependency_management.html
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27377946
duplicate of: http://stackoverflow.com/q/1403788
has comment: http://stackoverflow.com/comment/43207089
has title: tomcat on ubuntu jnetpcap native library *.so unable to load
tagged with: jnetpcap
has comment: http://stackoverflow.com/comment/43206427
tagged with: java
has comment: http://stackoverflow.com/comment/43205915
has comment: http://stackoverflow.com/comment/43206259
type: Question
linked to: http://stackoverflow.com/q/1403788
tagged with: ubuntu
tagged with: tomcat
score: 0
has comment: http://stackoverflow.com/comment/43205968
has body: I want to deploy my application on to tomcat which has a pcap parsing ability. The module was running fine on eclipse / terminal. On tomcat i see the error as below. I have tried the following steps to resolve this issue: Add jnetpcap.jar and *.so (2 files for 1.4r1425 version) into $PATH Add jnetpcap.jar in tomcat lib folder In JAVA i tried using System.loadLibrary("path/to/so/files"); None of them worked. Also how does tomcat load native libraries is something i have no knowledge about. Kindly suggest a solution to make this work on tomcat.
answer count: 0
type: UnansweredQuestion

constructor
tags question: http://stackoverflow.com/q/27325113
tags question: http://stackoverflow.com/q/27375410
tags question: http://stackoverflow.com/q/27349987
tags question: http://stackoverflow.com/q/27338753
tags question: http://stackoverflow.com/q/27386193
tags question: http://stackoverflow.com/q/27434340
tags question: http://stackoverflow.com/q/27474326
tags question: http://stackoverflow.com/q/27467353
tags question: http://stackoverflow.com/q/27362654
tag name: constructor
tags question: http://stackoverflow.com/q/27460679
tags question: http://stackoverflow.com/q/27466147
tags question: http://stackoverflow.com/q/27377372
tags question: http://stackoverflow.com/q/27356149
tags question: http://stackoverflow.com/q/27408417
type: Tag
tags question: http://stackoverflow.com/q/27466141
tags question: http://stackoverflow.com/q/27464667
tags question: http://stackoverflow.com/q/27464030
tags question: http://stackoverflow.com/q/27375231
tags question: http://stackoverflow.com/q/27358585
tags question: http://stackoverflow.com/q/27350604

http://stackoverflow.com/comment/43106476
type: QuestionComment
has text: Im clearly an idiot but believe it or not im working hard on this...
comment on: http://stackoverflow.com/q/27323404
score: 0
type: Comment

http://stackoverflow.com/comment/43134771
type: Comment
has text: Maybe a little explanation would be nice for OP.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27339006

http://stackoverflow.com/comment/43299928
has text: At least when it comes to C and C++, Herb Schildt is absolutely notorious. "...having heard horror stories about Herbert Schildt's *C: The Complete Reference*, I decided to check it out. I flipped the book open; I found glaring errors. I paged through it. I found more glaring errors." http://www.seebs.net/c/c_tcn4e.html
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27429009
score: 0

http://stackoverflow.com/comment/43380215
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27444564
has text: @Biffen yeah, I do....

http://stackoverflow.com/comment/91617443
has text: `host.name` is [deprecated](https://kafka.apache.org/documentation.html#brokerconfigs) - as are `advertised.host.name` and `advertised.port`
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27398456
type: Comment

http://stackoverflow.com/a/27324029
type: Answer
score: 2
answers question: http://stackoverflow.com/q/27323903
upvote count: 2
downvote count: 0
has body: The density is the ratio of the number of edges in the graph to the number of edges in a complete graph with the same vertex set. Both of these graphs are reasonably sparse, though the first is sparser. Often the density of a graph is used to decide what data structure to use to represent a graph An adjacency matrix makes sense for dense graphs where enumerating outbound edges is not a common operation. Edge lists make sense for sparse graphs or where enumerating outbound edges is done frequently. It's a trade-off though. Adjacency graphs take up more memory as the vertex count scales, but getting a list of the edges between two vertices is fast. Scanning all outbound edges is slow. Edge lists take less memory as the vertex count increases, looking for edges between two vertices is slower, but enumerating outgoing edges is fast.

http://stackoverflow.com/comment/43327319
type: QuestionComment
score: 0
type: Comment
has text: I dont think so. here http://stackoverflow.com/questions/3226813/how-can-i-decrypt-a-string-using-aes-algorithm-in-c
comment on: http://stackoverflow.com/q/27443904

http://stackoverflow.com/q/27345188
has answer: http://stackoverflow.com/a/27364903
accepted answer: http://stackoverflow.com/a/27364903
has comment: http://stackoverflow.com/comment/43147575
score: 0
tagged with: android
answer count: 1
has title: actionbar with background from fragments
has body: Iam want to get the following to work: I have an actionbar which contains 3 tabs. I can swipe them perfectly left and right. All 3 tabs have the same background image. Now my problem is, that the actionbar itself has a black background. I wish that the background image from the 3 fragments (which are all the same) is over the complete screen. So the actionbar should be transparent and have the background from the fragment. Is this possible? really thank you!
has comment: http://stackoverflow.com/comment/43149072
tagged with: android-actionbar
type: AnsweredQuestion
tagged with: java
tagged with: background
type: Question

http://stackoverflow.com/q/27340996
has answer: http://stackoverflow.com/a/27341417
tagged with: java
upvote count: 2
has body: I want to know how can I generate multiple output (html) from one xml using java and xsl. For example, having this xml: <ARTICLE> The First 1st Major Section The Second 2nd Major Section For each child element "SECT" from "ARTICLE" I would like to have one ".html" as an output, example of the output: sect1.html The First 1st Major Section sect2.html The First 2nd Major Section I've been working in java to transform the .xml document with the next code: File stylesheet = new File(argv[0]); File datafile = new File(argv[1]); DocumentBuilder builder = factory.newDocumentBuilder(); document = builder.parse(datafile); // Use a Transformer for output TransformerFactory tFactory = TransformerFactory.newInstance(); StreamSource stylesource = new StreamSource(stylesheet); Transformer transformer = tFactory.newTransformer(stylesource); DOMSource source = new DOMSource(document); OutputStream result=new FileOutputStream("sections.html"); transformer.transform(source, new StreamResult(result)); The problem is that I have only one output, Could you help me to write the .xslt document please? and tell me how to get more than 1 output?
linked to: http://stackoverflow.com/q/1358941
answer count: 1
favorite count: 0
has title: multiple html as output from 1 xsl with java
tagged with: http://stackoverflow.com/tag/xml
score: 2
downvote count: 0
type: UnansweredQuestion
tagged with: xslt
type: Question

http://stackoverflow.com/q/27443748
has answer: http://stackoverflow.com/a/27482401
downvote count: 0
possible better answer: http://stackoverflow.com/a/27444128
has answer: http://stackoverflow.com/a/27444128
favorite count: 0
has title: How to sort column by HQL if column have both string and integer values
has comment: http://stackoverflow.com/comment/43328436
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27482401
upvote count: 3
tagged with: java
tagged with: hibernate
tagged with: hql
type: Question
score: 3
has comment: http://stackoverflow.com/comment/43327191
tagged with: sorting
answer count: 2
has body: I have a column "event_number" in "event" table. "event_number" column is actually varchar column in mysql. I want to sort data according to "event_number" using HQL query. (Hibernate). For example data is event_number 1 2 M-2 4 5 K-C 6 7 8 9 10 11 TY-C The output should be: event_number 1 2 4 5 6 7 8 9 10 11 K-C M-2 TY-C or The output should be: event_number K-C M-2 TY-C 1 2 4 5 6 7 8 9 10 11 I have used HQL query: select event.eventNumber from event order by event.eventNumber asc; I got result: event_number 1 10 11 2 4 5 6 7 8 9 K-C M-2 TY-C

http://stackoverflow.com/comment/43183883
type: Comment
comment on: http://stackoverflow.com/q/27365632
score: 0
has text: yea I know. The RealDeal class isn't completely accurate. Its just a quick example I did just to show people how I want it to run when it is constructed properly.
type: QuestionComment

http://stackoverflow.com/comment/43125090
comment on: http://stackoverflow.com/a/27326992
has text: I re-create the closure on every call now, it's not that much overhead and i fully understand the code ;)
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/q/27462966
score: 2
has body: Question Have you ever made changes to your application and everything runs just fine but when you go to run your unit tests all hell breaks lose? That is my specific problem. Would it be fair to say those are not good tests since they fail when my application is working fine? And by 'working' I mean it passes all acceptance tests and each feature works as intended. Background Most of the time after I've made changes to my application I can run through all the features with no problem, then when I run my unit tests I'll have failures. So there are instances in which I'm spending lots of time updating unit tests that failed for a perfectly working application. My gut tells me that if your tests fail, when the application passes, then they are useless tests and all they are doing is alerting the developer to implementation changes they have just made. Is this wrong? Can good tests fail when nothing else in the application in question has failed? Example Scenario You have unit tests that verify a certain filename is returned such as fileName.txt. Everywhere in your code that file is referred to using a constant IMPORTANT_FILENAME so changing the file name doesn't affect your application. You decide to change the name of the file from "fileName.txt" to "NewFileName.txt". Your application works fine as it should, but your unit test on verify(fileName,'fileName.txt') fails. This is a crude example but I hope you get the point. The point here is that when I find myself updating unit tests on a working application it seems to me its a red flag that is a bad test. I can't think of any test that fails in a passing application that is a good one. But before I use this as a rule of thumb and start deleting I wanted to get some feedback. Do you agree; unit tests shouldn't fail in a passing application? Side-note: I don't think it matters but I use Java, Junit, and Mockito.
tagged with: java
has comment: http://stackoverflow.com/comment/43412265
has answer: http://stackoverflow.com/a/27463040
type: Question
has answer: http://stackoverflow.com/a/27464761
tagged with: testing
tagged with: mockito
has title: Should unit tests only fail when your application is broken?
downvote count: 0
has answer: http://stackoverflow.com/a/27463167
has comment: http://stackoverflow.com/comment/43362274
has comment: http://stackoverflow.com/comment/43362197
has comment: http://stackoverflow.com/comment/43363665
tagged with: junit
has answer: http://stackoverflow.com/a/27490396
favorite count: 0
upvote count: 2
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43362246
has comment: http://stackoverflow.com/comment/43362869
has answer: http://stackoverflow.com/a/27463130
tagged with: unit-testing

http://stackoverflow.com/comment/43364348
comment on: http://stackoverflow.com/a/27464087
type: Comment
score: 0
type: AnswerComment
has text: Numbers will always be based on users input,and there will only be 1 number only.

http://stackoverflow.com/comment/43277807
type: QuestionComment
has text: Hi Scary, Program block in this line. Connection con = DriverManager.getConnection("jdbc:hive://PDLFSHADOOP:10001/test","hive","hive");
comment on: http://stackoverflow.com/q/27417091
score: 0
type: Comment

delegation
tags question: http://stackoverflow.com/q/27342669
tags question: http://stackoverflow.com/q/27469655
tags question: http://stackoverflow.com/q/27343837
tag name: delegation
type: Tag

http://stackoverflow.com/comment/43292596
type: Comment
has text: Yes, certainly. You can specify a list of resource ids for your sounds inside MediaPlayerUtil class and choose one randomly on every call.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27424864

http://stackoverflow.com/q/27348606
possible better answer: http://stackoverflow.com/a/27349124
has body: I have a Java bot running based on the PircBotX framework. An IRC bot simply replies on commands. So now I have a list of static strings e.g.; !weather, !lastseen and the likes in my Main.java file. For each command I add I create a new static string and I compare each incoming message if it starts with any of the defined commands. Pseudocode Receive message `m` if m matches !x -&gt; do handleX() if m matches !y -&gt; do handleY() This is basicly a very large if test. What I would like to do is create some sort of skeleton class that perhaps implements an interface and defines on which command it should act and a body that defines the code it should execute. Something I'm thinking of is shown below: public class XkcdHandler implements CommandHandlerInterface { public String getCommand() { return "!xkcd"; } public void HandleCommand(String[] args, Channel ircChannel) { // Get XKCD.. ircChannel.send("The XKCD for today is .."); } } With such a class I could simply add a new class and be done with it. Now I have to add the command, add the if test in the list, and add the method to the Main.java class. It is just not a nice example of software architecture. Is there a way that I could create something that automatically loads these classes (or instances of those classes), and then just call something like invokeMatchingCommand()? This code could then iterate a list of loaded commands and invoke HandleCommand on the matching instance. Update With the answer of BalckEye in mind I figured I could load all classes that are found in a package (i.e., Modules), instantiate them and store them in a list. This way I could handle each message as shown in his answer (i.e., iterate the list and execute the class method for each matching command). However, it seems, according to this thread, that it's not really viable to do. At this point I'm having a look at classloaders, perhaps that would be a viable solution.
has answer: http://stackoverflow.com/a/27349124
score: 0
has comment: http://stackoverflow.com/comment/43178976
has title: Create modules Java
linked to: http://stackoverflow.com/q/9898175
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27349285
type: Question
answer count: 2
accepted answer: http://stackoverflow.com/a/27349285

http://stackoverflow.com/comment/43219897
has text: create a `retrieveAndReset` method that gets the value, and if `true` sets it to `false`? Methods should be preferred to direct variable access anyway, you would not require the `update()` method. You may not want to reset the spacebar value when you release it; a short key press should be registered as well.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27385672
score: 0

http://stackoverflow.com/a/27335991
score: 0
answers question: http://stackoverflow.com/q/27334005
type: Answer
has body: There are several issues with your code. The t threads assume that only t multiplications are required to produce your result matrix. This is not to be the case when m != k or t != m or t != k. The threads are worker threads that will only process your requests. I would consider making each MatrixMultiplier have access to the mxn, nxk, mxk matrices and a rolcolumn entries container. class MatricMultiplier { private double a[][], b[][], results[][]; private Queue&lt;..&gt; entries; .... } The run method will then use the entries container to calculate the sum for a given &lt;row,column&gt; entry of the resulting mxk matrix. The run method could become: run() { for (Entry entry = entries.poll(); entry != null; entry = entries.poll()) { int row = entry.row; int col = entry.col; double sum = 0.0; for (int i = 0; i &lt; a[row].length; i++) { sum += a[row][i] * b[i][col]; } results[row][col] = sum; } } There are three things to note here that is different than what you have. you are not using a synchronization block each entry is calculating the answer for a unique row/column of the result matrix the Multiple class is not required any longer You can then create t threads that process each entry in the entries container and will exit when the entries container is empty. Note that the entries container should be one of the concurrent Queue containers available in the java.util.concurrent package. The remaining task is how to create the rowcolumn entries container. Here is some code that you could use: Queue&lt;..&gt; entries = new Concurrent...&lt;..&gt;(); int rowSize = a.length; int colSize = b[0].length; for (int row = 0; row &lt; rowSize; row++) { for (int col = 0; col &lt; colSize; col++) { entries.add(new RowColumnEntry(row, col)); } } Noting that the a and b are the m×n and n×k matrices. Hope this helps.

http://stackoverflow.com/comment/43353550
has text: Are you running it with command line arguments?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27458232

http://stackoverflow.com/a/27374513
type: Answer
answers question: http://stackoverflow.com/q/27373426
score: 0
has body: As the BufferedReader already has an internal buffer of 4096 characters, implementation-dependent, and as the socket already has a considerably larger receive buffer, it really doesn't make much difference what value you choose. The returns on buffering diminish geometrically with size.

lombok
type: Tag
tags question: http://stackoverflow.com/q/27375828
tag name: lombok
tags question: http://stackoverflow.com/q/27368729

http://stackoverflow.com/comment/43307527
has text: deosn't answer it but might be a lead in the right direction. for me it appears an empty key for him is defined as an String matching one blank or "". So maybe a String with two bnalks qulifies as empty as well and will not be fdund by his code.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27433178
type: AnswerComment

http://stackoverflow.com/a/27345633
score: 2
has comment: http://stackoverflow.com/comment/43147410
downvote count: 0
has body: Java is a strongly typed language and thus requires a variable to be defined before it can be used. You have to define guess before you can use it. The loop will work as long as guess is initially defined to be anything that is not number. You could define guess like so to make sure it's different. You would never want to do this. I just want to show that pretty much any initial value could be used to initialize guess. int guess = number - 1; You could also use a do..while loop to not initially assign it. This would be the preferred way of doing it since you're not making any assumptions. int guess; do { System.out.print("\nEnter your guess: "); guess = input.nextInt(); if (guess == number) System.out.println("you are correct, the number is " + number); else if (guess &gt; number) System.out.println("your guess is too high"); else System.out.println("your guess is too low"); }while(guess != number); This the loop runs once and assigns guess from the user input directly instead of having to assign it before yourself.
upvote count: 2
has comment: http://stackoverflow.com/comment/43146769
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43146820
type: Answer
has comment: http://stackoverflow.com/comment/43146748
accepted answer of: http://stackoverflow.com/q/27345550
has comment: http://stackoverflow.com/comment/43146732
has comment: http://stackoverflow.com/comment/43146685
answers question: http://stackoverflow.com/q/27345550

http://stackoverflow.com/q/27420646
has answer: http://stackoverflow.com/a/27420701
has title: Getting error setting variable in array?
has comment: http://stackoverflow.com/comment/43284021
favorite count: 0
type: UnansweredQuestion
has body: The compiler is coming up with error "symbol not recognized" and am not sure how I am expected to store data in an array. The language is Java and this is just my first program in java so I am testing some things out. class averageFunction{ public static void main(String args[]){ int numInput = 0; int nummberIn[]; Boolean loopControl = false; while(loopControl = true){ System.out.print("Please Enter Number, " + numInput + "have been entered..."); nummberIn(1) = 1; }; }; };
upvote count: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43283910
downvote count: 3
type: Question
score: -2
tagged with: arrays
has answer: http://stackoverflow.com/a/27420786
tagged with: variables
has answer: http://stackoverflow.com/a/27420736
tagged with: class
answer count: 3

http://stackoverflow.com/q/27424052
score: 3
tagged with: spring-boot
has title: How to configure the logging framework in Spring-Boot?
has body: How can I tell Spring-Boot which logging framework to use? (I want to use log4j2). In 1.1.9.RELEASE I just had a log4j2.xml in my classpath and the logging worked. Now I upgraded to spring-boot-1.2.0.RELEASE, and my loggers do not work anymore! Maybe I have to configure the logging framework to be used explicit? I'm using org.apache.logging.log4j.LogManager.getRootLogger() for logging, maybe this is wrong?
upvote count: 3
answer count: 2
tagged with: log4j
favorite count: 0
has answer: http://stackoverflow.com/a/27424195
type: UnansweredQuestion
tagged with: spring
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/27830720
type: Question

http://stackoverflow.com/comment/43152175
type: AnswerComment
has text: Java doesn't have compilers with different optimization settings. They leave optimization up to the JVM.
type: Comment
comment on: http://stackoverflow.com/a/27348687
score: 0

http://stackoverflow.com/q/27474326
downvote count: 1
has answer: http://stackoverflow.com/a/27474362
has title: Undefined constructor (java)
type: AnsweredQuestion
has body: so I have a java class called User that contains a constructor like this: public class User extends Visitor { public User(String UName, String Ufname){ setName(UName); setFname(Ufname); } } And then the he problems occur in my other class called Admin: public class Admin extends User { //error "Implicit super constructor User() is undefined for default constructor. Must define an explicit constructor" //public Admin() { } //tried to add empty constructor but error stays there //} public void manage_items() { throw new UnsupportedOperationException(); } public void manage_users() { throw new UnsupportedOperationException(); } } I am getting the error Implicit super constructor User() is undefined for default constructor. Must define an explicit constructor at the place marked in the code. I don't know how to fix that, and I'm really new to java.
possible better answer: http://stackoverflow.com/a/27474384
tagged with: java
has answer: http://stackoverflow.com/a/27474384
accepted answer: http://stackoverflow.com/a/27474338
tagged with: methods
type: Question
tagged with: inheritance
favorite count: 0
has answer: http://stackoverflow.com/a/27474769
has answer: http://stackoverflow.com/a/27474338
answer count: 4
score: 2
tagged with: constructor
upvote count: 3

http://stackoverflow.com/a/58315676
score: 3
answers question: http://stackoverflow.com/q/27343268
has body: Right click on your package name(src/main/java/com.L33Tcode.example). After that select New->Package and enter folder name(Fragments) watever you want. Here you can see that your package is created. package in it's self is your folder. So, you can see it from right click on your created folder(Fragments)-> show in history and show your folder init.
downvote count: 0
type: Answer
upvote count: 3

http://stackoverflow.com/a/27410491
accepted answer of: http://stackoverflow.com/q/27407979
score: 0
answers question: http://stackoverflow.com/q/27407979
type: AcceptedAnswer
type: Answer
has body: One thing before I give you the answer This: public class test { public static void main(String[] args) { double [] myList = new double[100]; Scanner input = new Scanner(System.in); System.out.println("Enter floating point numbers"); for ( int i = 0; i&lt; 100; i++) myList[i] = input.nextDouble(); public static void stopInput(double [] array){ } public static void calculate(){ } } } Should look like this: public static void main(String[] args) { double [] myList = new double[100]; Scanner input = new Scanner(System.in); System.out.println("Enter floating point numbers"); for ( int i = 0; i&lt; 100; i++) myList[i] = input.nextDouble(); } public static void calculate(){ } public static void stopInput(double [] array){ } You can not declare a method within another method. Now, have test implement KeyboardListener public class test implements KeyboardListener KeyboardListener is an event handler class that listens for 3 things. KeyPressed Pressing a key invokes this method KeyReleased Releasing a key, or the motion of the key coming up after being pressed, invokes this method KeyTyped Pressing and releasing invokes this method When using an event listener they have methods that you have to include with them, those 3 having to go with KeyboardListener. Within KeyPressed, you can say public void keyPressed(KeyEvent e){ if(e.getKeyChar() == 'q'){ //Whatever goes here } } This will let you do whatever you tell it to do when a user types q. For the calculate method, have it in another for loop (since with Arrays, any int not entered, is 0) for(int i = 0; i&lt;myList.length; i++){ sum += myList[i]; } And so on for the other types of math. For the count and average, just make another array (of int count size) and run it through a for loop again and for every number that isnt 0, add one to count and throw it in the other array. Then run it through one last for loop, just like the sum, except divide it by //array name//.length to get the average.

http://stackoverflow.com/comment/43316934
type: QuestionComment
has text: @VivekSingh Previously I run properly this code. Didn't use any kind of these httpclient or core packages. Only used Selenium jar file. Is that may be a problem?
score: 0
comment on: http://stackoverflow.com/q/27437743
type: Comment

http://stackoverflow.com/a/27421217
score: 2
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27419919
upvote count: 2
has body: It is likely that your application is holding open Connections rather than acquiring them as necessary and close()ing them (checking them back into the pool) promptly. To verify this, try setting the following two parameters: unreturnedConnectionTimeout debugUnreturnedConnectionStackTraces For more explanation, see also here. Set unreturnedConnectionTimeout to a value large enough that ordinary db operations should have an easy time completing. (Unless you are working with large datasets or complex queries, 60 seconds is probably more than enough, but it does depend on your application.) Set debugUnreturnedConnectionStackTraces to true. Then look in your logs to see whether unreturned Connections are expired and stack traces logged after the timeout you have set elapses. Examine the stack trace: it will point you to the code that checked out the Connection that was not promptly returned. If your application checks out Connections and holds them open, c3p0 cannot test them, expire them, or guarantee their "freshness". Applications should take care to check out Connections on a "just-in-time" basis, and return them promptly. Also: your maxStatements setting is not likely to be appropriate for a pool that can expand to 53. I'd set maxStatements to zero (no Statement caching) while you work out the kinks of your application. Then, if you want to try to enhance performance with Statement caching, you'll need to use a larger value for maxStatements, or else consider using the easier to understand maxStatementsPerConnection. More discussion here. Finally: To set these c3p0 parameters via hibernate, you can use properties like hibernate.c3p0. unreturnedConnectionTimeout. See here.

http://stackoverflow.com/a/27358198
score: 0
answers question: http://stackoverflow.com/q/27358176
type: Answer
has body: Change this part "% 6d%10 d\n" to "%6d%10d\n" . You have unacceptable spaces there. Also, change this part " %s%1 0s\n" to just "%s%s\n". Not sure what you intended to do there.

http://stackoverflow.com/q/27443381
answer count: 1
has comment: http://stackoverflow.com/comment/43361233
accepted answer: http://stackoverflow.com/a/27918593
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
tagged with: xmlpullparser
has title: XmlPullParser: get/reconstruct raw XML
has comment: http://stackoverflow.com/comment/43395521
has answer: http://stackoverflow.com/a/27918593
has body: I am tied to use the XmlPullParser (since we use the Smack XMPP library). But it is very inconvenient to parse XML with it and put the read values into beans (at least if an XSD is given). In contrast, JAXB would be so much easier to work with. Also for serialization it is an "old-fashioned and error prone approach" to concatenate the strings manually. (see the motivation of http://babbler-xmpp.blogspot.co.at/2014_01_01_archive.html which also summarizes the cons). But to use JAXB for deserialization, I have to get the raw XML-String. Of course, one way would be to reconstruct the whole XML-String using the XmlPullParser's parsing-methods (like getName(), getText(), getAttributes(), ...). But I would like to avoid this. So is it possible to get the whole raw XML-String of a specific tag (e.g. where the XmlPullParser is currently pointing to)? Or does anyone know some utility which reconstructs the XML of an XmlPullParser instance?
type: Question
tagged with: java
tagged with: jaxb
score: 0

http://stackoverflow.com/q/27435093
possible better answer: http://stackoverflow.com/a/27435283
type: AnsweredQuestion
tagged with: java
tagged with: methods
type: Question
has body: So I have three required codes I have already figured out. They are the codes for a quadratic formula, codes for an ISBN checker, and a code for Newtons Method. I'm supposed to make a menu with options 1, 2, and three each containing these codes respectively. I guess this means I need different methods for this right? I was never really taught - I was told we had to always put in public class void main (String []args){ for everything, and I was just told there were variations to this? For Quadratics formula, the information is : Return - void and parameters of three doubles, Newtons method: Return - double and parameters of 1 double, and ISBN checker: Return: Boolean and Parameters of 1 string. I don't really understand the parameters thing either. Help would be appreciated. I know this aesthetically looks horrible, but because my codes for now are relatively short I just edit the style when I' done. I know a lot of things are wrong in this too and I've spent time trying to figure them out. import Java.util.Scanner; public class HelperMethod{ public static void main(String[] args) { Scanner userInputScanner = new Scanner (System.in); System.out.println ("You have three options. press one for the quadratic Formula, 2 for the newtons Method, and 3 for an ISBN checker."); int input = userInputScanner.nextInt(); if (input = 1){ }else if (input = 2) { private class NewtonsMethod { public static void NewtonsMethod(String[] args) { Scanner userInputScanner = new Scanner (System.in); double guess, fX, fPrimeX, newGuess; System.out.println ("enter in a value give"); guess = userInputScanner.nextDouble(); System.out.println ("Your guess is " + guess); while (true) { fX = (6 * Math.pow (guess,4)) - (13 * Math.pow (guess,3)) - (18 * Math.pow (guess,2)) + (7 * guess) + 6; fPrimeX = (24 * Math.pow (guess,3)) - (39 * Math.pow (guess,2)) - 36 * guess + 7; newGuess = guess - (fX / fPrimeX); System.out.println ("A possible root is " + newGuess); if (Math.abs(newGuess - guess) &lt; 0.…
accepted answer: http://stackoverflow.com/a/27435316
has answer: http://stackoverflow.com/a/27435283
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27435316
has title: How to invoke multiple method signatures within a main method?

http://stackoverflow.com/a/27320291
downvote count: 0
answers question: http://stackoverflow.com/q/27320101
type: Answer
has body: Based on general OOP principles, a method is actually a 'behavior' which your class offers to public views of its instance. An instance is a real life version of the 'abstract existence' of the class. Now the important thing to understand here is that instance methods are behaviors that the class demonstrates. The behaviors of the class are tied to its 'state' ie. the variables or properties. For different values of state the same method of the class can show different behaviors i.e: operations performed. Thus as a general rule: when a method offers a behavior that is dependent on the state of the instance and the behavior is unique to the class it should be non static and encapsulated in the class. Such a behavior should be exposed to the world only through a well defined contract, that normally is a public method or an interface of the class. However when a method offers generic behavior not tied to any class or instance state nor influenced by the change in state it should be static i.e: independent of any class. Some examples are converting a given date to string, or loggin a message, or converting exceptions etc. See what fits your case.
upvote count: 2
score: 2

http://stackoverflow.com/comment/43201875
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27376071
has text: `if (b.isLoaned() = false)` ???
score: 0

http://stackoverflow.com/a/27452061
type: Answer
has comment: http://stackoverflow.com/comment/43342693
answers question: http://stackoverflow.com/q/27451933
downvote count: 1
has comment: http://stackoverflow.com/comment/43342742
has comment: http://stackoverflow.com/comment/43345713
accepted answer of: http://stackoverflow.com/q/27451933
type: AcceptedAnswer
has body: I suspect that when you say "the arrays are empty," you mean that they have been created but not filled, so they are still full of nulls. If the arrays are filled with nulls, then you're creating an ArrayList containing that many nulls.
has comment: http://stackoverflow.com/comment/43343531
score: 0
upvote count: 1

http://stackoverflow.com/a/27370909
has comment: http://stackoverflow.com/comment/43193695
answers question: http://stackoverflow.com/q/27370845
has comment: http://stackoverflow.com/comment/43193544
has comment: http://stackoverflow.com/comment/43193527
has comment: http://stackoverflow.com/comment/43193562
has comment: http://stackoverflow.com/comment/43193651
has comment: http://stackoverflow.com/comment/43193664
has comment: http://stackoverflow.com/comment/43193577
type: Answer
accepted answer of: http://stackoverflow.com/q/27370845
has body: From my testing, it appears that the BufferedImage adapts to what image you have. import javax.imageio.ImageIO; import java.awt.image.BufferedImage; import java.net.URL; public class BufferedImageTest { public static void main(String[] args) { try { BufferedImage transparent = ImageIO.read(new URL("http://upload.wikimedia.org/wikipedia/commons/4/4a/Logo_2013_Google.png")); System.out.println(transparent.getType()); BufferedImage solid = ImageIO.read(new URL("http://blacklabelsociety.com/home/wp-content/uploads/2014/01/spacer.jpg")); System.out.println(solid.getType()); } catch (Exception e) { e.printStackTrace(); } } } Output 6 5 6 = BufferedImage.TYPE_4BYTE_ABGR 5 = BufferedImage.TYPE_3BYTE_BGR The first image had transparency, whereas the second one did not.
upvote count: 3
has comment: http://stackoverflow.com/comment/43193675
downvote count: 0
has comment: http://stackoverflow.com/comment/43193594
score: 3
type: AcceptedAnswer

http://stackoverflow.com/comment/43122667
has text: The direct generation of your object via JSP would generate the HTML and JS already containing the serialized object. Upon page load the browser would automatically load the object from the JS. This route has nothing to do with AJAX. I added the AJAX option in because the question was broad and wanted to outline the option. AJAX is for making async calls to the server -- It can be done synchronously as well. It is a good practice to abstract functionality away and to have a specific servlet instance (with proper parameter passing) to return JSON strings, especially in REST architecture.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27328410
type: AnswerComment

http://stackoverflow.com/comment/43242989
comment on: http://stackoverflow.com/q/27391027
type: Comment
has text: http://stackoverflow.com/a/27125547/1779833
type: QuestionComment
score: 1

http://stackoverflow.com/comment/43269965
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27412640
has text: [This post](http://stackoverflow.com/a/15840413/3761440) seems to suggest that it is a problem with your run configuration. Go to Run -> Run Configurations

http://stackoverflow.com/q/27472712
has comment: http://stackoverflow.com/comment/43380154
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43380451
has comment: http://stackoverflow.com/comment/43380706
tagged with: java
has body: Is there any java.util.Map implementation that do not stores Values of equals ValueObjects but store only one of them? (references of this Objects are different, but they are equals) here is a little test code : Map&lt;Integer, Integer&gt; map = new HashMap&lt;Integer, Integer&gt;(); for (int i = 0; i &lt;= 1000000; i++) { map.put(i, new Integer(42)); } and visual VM shows : 2 million of instances of Integer these objects are equals but Map stores all of them Just for history logging I coded chiastic-security's solution and test it to compare with HashMap: public class CompactMap&lt;K, V&gt; implements Map&lt;K, V&gt; { private Map&lt;K, V&gt; map; private Map&lt;V, V&gt; canonicalMap; public CompactMap() { map = new HashMap&lt;K, V&gt;(); canonicalMap = new HashMap&lt;V, V&gt;(); } @Override public void clear() { map.clear(); canonicalMap.clear(); } @Override public boolean containsKey(Object key) { return map.containsKey(key); } @Override public boolean containsValue(Object value) { return map.containsValue(value); } @Override public Set&lt;java.util.Map.Entry&lt;K, V&gt;&gt; entrySet() { return map.entrySet(); } @Override public V get(Object key) { return map.get(key); } @Override public boolean isEmpty() { return map.isEmpty(); } @Override public Set&lt;K&gt; keySet() { return map.keySet(); } @Override public V put(K key, V value) { V canonValue = canonicalMap.get(value); V previous = null; if (canonValue != null) { previous = map.put(key, canonValue); } else { previous = map.put(key, value); canonicalMap.put(value, value); } return previous; } @Override public void putAll(Map&lt;? extends K, ? extends V&gt; m) { if (m == null) throw new NullPointerException("Can't exceute putAll for null-map argument"); for (Map.Entry&lt;? extends K, ? extends V&gt; entry : m.entrySet()) { map.put(entry.getKey(), entry.getValue()); } } @Override public V remove(Object key) { V removalValue = map.get(key); map.remove(key); if (!map.containsValue(removalValue)) { canonicalMap.rem…
has comment: http://stackoverflow.com/comment/43380287
possible better answer: http://stackoverflow.com/a/27473208
has comment: http://stackoverflow.com/comment/43380244
upvote count: 2
has comment: http://stackoverflow.com/comment/43380050
answer count: 2
accepted answer: http://stackoverflow.com/a/27473141
downvote count: 0
has comment: http://stackoverflow.com/comment/43380160
favorite count: 0
has answer: http://stackoverflow.com/a/27473141
has title: compact java.util.Map implementation
tagged with: dictionary
has answer: http://stackoverflow.com/a/27473208
score: 2
has comment: http://stackoverflow.com/comment/43380233
type: Question

http://stackoverflow.com/q/27438609
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43317172
type: Question
has comment: http://stackoverflow.com/comment/43318789
has body: I have an ArrayList with a lot of points (so x,y). I sorted the points on XY. Is there a datatype/algorithm to get all y points a certain x fast? (or the other way around, all x on a certain y). At the moment I have something like this, which works ok but I have the feeling it's to complex for what I need. int lastXPos; int lastIndex; int[] workArray = new int[4096]; int workArrayIndex; // returns all the y values where x matches public int[] grab(int xPos) { workArrayIndex = 0; int startIndex = 0; // this can increase speed a lot if (lastXPos+1 == xPos) { startIndex = lastIndex+1; } PVector v; for (int i = startIndex; i &lt; vecs.size(); i++) { v = vecs.get(i); if (v.x &gt; xPos) { lastIndex = i-1; break; } if (v.x == xPos) { workArray[workArrayIndex++] = (int) v.y; } } lastXPos = xPos; int[] result = new int[workArrayIndex]; for (int i = 0; i &lt; workArrayIndex; i++) { result[i] = workArray[i]; } return result; } Edit: One more thing, it has to process a new list 60 times a second, so creating the data object also has to be fast. Then as a bonus question, we have rows and columns, is there a way to describe both of those? (direction for example).
score: 0
has comment: http://stackoverflow.com/comment/43318927
has comment: http://stackoverflow.com/comment/43317175
has comment: http://stackoverflow.com/comment/43317370
has title: Is there a data structure to grab values by x or y?
has comment: http://stackoverflow.com/comment/43334307
answer count: 0

http://stackoverflow.com/comment/43107709
type: Comment
comment on: http://stackoverflow.com/a/27323914
has text: @TomT, we don't have enough information to make a suggestion because we don't know how components should be resized as the size of the frame is changed. In any GUI some components will remain at a fixed size and other will change size based on the space available. That is why you need to first learn the basics of each layout manager so you can decide how to nested panels with different layout manager to allocate space properly.
score: 0
type: AnswerComment

http://stackoverflow.com/q/27321179
has comment: http://stackoverflow.com/comment/43101631
has comment: http://stackoverflow.com/comment/43101786
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27321988
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/27321369
has comment: http://stackoverflow.com/comment/43101671
linked to: http://stackoverflow.com/q/13777108
has answer: http://stackoverflow.com/a/27321369
tagged with: arrays
tagged with: javascript
has comment: http://stackoverflow.com/comment/43101747
has title: JavaScript style array filling in Java
tagged with: arraylist
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/27321988
has body: In JavaScript, the following: var a = []; a[20] = "hello"; console.log(JSON.stringify(a)); would yield: [null,null,null,null,null,null,null,null,null,null, null,null,null,null,null,null,null,null,null,null,"hello"] Is there a list type in Java that will auto expand when setting values beyond it's current bounds? A map isn't practical because I also need to know the array dimension.
has comment: http://stackoverflow.com/comment/43101976
has comment: http://stackoverflow.com/comment/43101805
has answer: http://stackoverflow.com/a/27321289
has comment: http://stackoverflow.com/comment/43101972

http://stackoverflow.com/a/27462630
has comment: http://stackoverflow.com/comment/43361982
has comment: http://stackoverflow.com/comment/43361917
upvote count: 1
has comment: http://stackoverflow.com/comment/43361878
answers question: http://stackoverflow.com/q/27462441
type: Answer
has body: Simply add the root class in hierarcy. And get Office class from Root class. Root Class:- import javax.xml.bind.annotation.*; import java.util.Vector; @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class Root { @XmlElement(name = "Office") private Office office; } Office class import javax.xml.bind.annotation.*; import java.util.Vector; @XmlAccessorType(XmlAccessType.FIELD) public class Office { @XmlElementWrapper(name = "Employees") @XmlElement(name = "Employee") private Vector&lt;Employee&gt; employees; } Change in parse method :- JAXBContext context = JAXBContext.newInstance(Root.class); Unmarshaller unmarshaller = context.createUnmarshaller(); Root root = unmarshaller.unmarshal(reader, Root.class).getValue(); Office office = root.getOffice();
downvote count: 0
score: 1

http://stackoverflow.com/q/27423706
favorite count: 0
tagged with: super
has body: package morepackage; public class Subclass extends Superclass { public static void main ( String args[] ) { String name = super.text;//error in this line String name1 = Superclass.text;//no error in this line }} The code of the superclass is: public class Superclass { static String text = "flowers"; } Can anyone please tell me why the line String name = super.text is showing error While the line String name1 = Superclass.text; is not showing error ?
upvote count: 1
has answer: http://stackoverflow.com/a/27423819
has answer: http://stackoverflow.com/a/27423779
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: eclipse
type: Question
tagged with: syntax-error
linked to: http://stackoverflow.com/q/610458
accepted answer: http://stackoverflow.com/a/27423819
downvote count: 0
answer count: 3
has title: Can't access static field via `super` from within subclass?
possible better answer: http://stackoverflow.com/a/27423744
has answer: http://stackoverflow.com/a/27423744

http://stackoverflow.com/comment/43284684
has text: Nema na čemu :) Take a look at [this similar thread](http://stackoverflow.com/questions/27250271/version-of-the-parent-object-does-not-change-when-its-child-objects-state-chang). Your options are limited, weather you can use "lastUpdated" or not depends on your requirements. To keep it isolated, maybe you could add another column which you would update when some logic is satisfied (some specific child changed, etc.), but that has a hacky sense to it.
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27420659

http://stackoverflow.com/comment/43096422
type: Comment
type: QuestionComment
has text: Can't you parse that string *directly* or can't you parse that string *at all*? Because if you can parse it, that's what you should do. And then you can use XPath: `//Description`. Very simple.
score: 1
comment on: http://stackoverflow.com/q/27318471

http://stackoverflow.com/comment/43238595
type: QuestionComment
has text: uniquechart[] == interesting, but please whats real reason for, btw question in this form isn't answerable here
comment on: http://stackoverflow.com/q/27396074
score: 0
type: Comment

http://stackoverflow.com/comment/43345559
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27453674
type: Comment
has text: Wow, how the hell did I miss that. THANK YOU SOOOO MUCH

http://stackoverflow.com/comment/43229128
type: QuestionComment
comment on: http://stackoverflow.com/q/27384270
has text: @JonKiparsky You can open the "edit history" and see the old versions of a question/answer if you click on the `edited x mins ago` link that can be found beneath the post.
score: 0
type: Comment

http://stackoverflow.com/a/27452953
score: 1
accepted answer of: http://stackoverflow.com/q/27452200
answers question: http://stackoverflow.com/q/27452200
has body: Instead of using Try and move it outside of the path tag. http://ant.apache.org/manual/Tasks/war.html
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/a/27470715
has body: It's better to use contains and indexOf for such search: if (trackNum.contains(trackNumber)) { int i = trackNum.indexOf(trackNumber); System.out.println(trackNum.get(i) + ": " + name.get(i) + " " + duration.get(i)); //printing out the matches } else { System.out.println("Not Tracks Found for " + trackNumber); }
downvote count: 0
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27470665

http://stackoverflow.com/q/27418095
type: Question
has body: I've just learnt about the transaction manager in JTA, but I've never used it when I need to perform a transaction. Actually, it can be done as follows: Context context = new InitialContext(); UserTransaction userTransaction = (UserTransaction) context.lookup("java:comp/UserTransaction"); userTransaction.begin(); //Data operation itself userTransaction.commit(); So, how does the TransactionManager become involved?
tagged with: transactions
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43279510
has comment: http://stackoverflow.com/comment/43280352
answer count: 0
type: UnansweredQuestion
has title: The purpose of a transaction manager in JTA
has comment: http://stackoverflow.com/comment/43280059

http://stackoverflow.com/comment/43342503
has text: You don't need a `refresh` after `setInput`. Most likely your content provider is not working correctly - show us that.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27451478

http://stackoverflow.com/comment/43144297
comment on: http://stackoverflow.com/a/27344455
score: 0
type: Comment
has text: yes... earlier it was a mistake. but it doesn't work now either. Don't we get a same array as String[] exp={"23","+","32"} when split the string expression with whitespaces
type: AnswerComment

http://stackoverflow.com/comment/43341801
type: QuestionComment
has text: First of all, HotSpot 8 has the Metaspace which is non-heap. All the class metadata/code/compiled code is there. The usage won't go down once you have used some classes for the first time (this seems to be the case you are describing). Second, how can you be sure that the JVM is really *using* all that memory? Allocating blocks in the virtual memory space is very different from actually using it. It may have no measurable impact on your system.
comment on: http://stackoverflow.com/q/27438429
score: 0
type: Comment

http://stackoverflow.com/a/27435756
answers question: http://stackoverflow.com/q/27413818
type: Answer
has body: The line where you assign to var at runtime is absolutely irrelevant. The only thing that matters for compiling a call is the static (compile-time) type of var. Since T is unbounded (other than by Object), it is not known to support any methods, other than those provided by Object. Both pieces of code should fail to compile.
score: 0
upvote count: 1
downvote count: 1

http://stackoverflow.com/q/27318621
downvote count: 2
has body: I have a task, but I don't know how to start. If someone knows, please send me links to some posts. I have a minimal Java class, where I need to update the "fill" method so that it works according to the description below: Pretend you are working in MS Paint, or a similar graphics application. Your job is to implement the bucket-fill tool. More specifically, given a two-dimensional grid, an (X,Y) position that the user clicked on, and a color, devise an algorithm that can be used to fill appropriate part of the grid. The bucket-fill algorithm should 'paint' all pixels that are connected to the pixel that the user clicked on, all the way to the borders where the color changes. So for example, if the user clicks on a white pixel, and specifies the color green, the bucket-fill tool will turn all of the touching white pixels into green pixels. It will not, however, affect white pixels that are in a completely separate part of the image. A minimal Java class: class BucketFill { private char[][] pixels; public BucketFill(char[][] pixels) { this.pixels = pixels; } public void fill(int x, int y, char color) { // TODO: make this method work } public void inspect() { for (int y = 0; y < pixels.length; y++) { for (int x = 0; x < pixels[y].length; x++) { System.out.print(pixels[y][x]); } System.out.print("\n"); } } public static void main(String argv[]) { char pixels[][] = { { 'O', 'X', 'X', 'X', 'X' }, { 'X', 'O', 'O', 'O', 'X' }, { 'X', 'O', '#', 'O', 'X' }, { 'X', 'O', 'O', 'O', 'X' }, { 'X', 'X', 'X', 'X', 'X' }, { 'X', 'X', 'X', '#', '#' }, { 'X', 'X', 'X', 'X', 'X' } }; BucketFill bucketFill = new BucketFill(pixels); bucketFill.fill(0, 0, '*'); bucketFill.fill(3, 0, 'O'); bucketFill.fill(2, 1, '@'); bucketFill.inspect(); } }
accepted answer: http://stackoverflow.com/a/27318977
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/64853193
has answer: http://stackoverflow.com/a/64853193
tagged with: java
has title: How to start the bucket-fill algorithm
type: Question
upvote count: 4
answer count: 2
has comment: http://stackoverflow.com/comment/43097024
has comment: http://stackoverflow.com/comment/43097018
favorite count: 0
has comment: http://stackoverflow.com/comment/43096808
has answer: http://stackoverflow.com/a/27318977
has comment: http://stackoverflow.com/comment/43096930
has comment: http://stackoverflow.com/comment/43097542

http://stackoverflow.com/q/27460829
accepted answer: http://stackoverflow.com/a/27460890
has body: String str1 = "abc:5"; String str2 = "abc:" + str1.length(); String str3 = "abc:" + 5; System.out.println(str1==str2); System.out.println(str1==str3); Output of the program is : false true But I don't understand why?
downvote count: 4
answer count: 3
linked to: http://stackoverflow.com/q/513832
favorite count: 0
duplicate of: http://stackoverflow.com/q/513832
has answer: http://stackoverflow.com/a/27460890
score: -3
has answer: http://stackoverflow.com/a/27460917
type: AnsweredQuestion
has title: Can anyone please explain why output of the following is such?
tagged with: java
possible better answer: http://stackoverflow.com/a/27460917
upvote count: 1
has answer: http://stackoverflow.com/a/27462270
type: Question

http://stackoverflow.com/a/27462726
has comment: http://stackoverflow.com/comment/43369715
has comment: http://stackoverflow.com/comment/43361879
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/43369696
has comment: http://stackoverflow.com/comment/43369679
has comment: http://stackoverflow.com/comment/43361844
has comment: http://stackoverflow.com/comment/43369556
has body: You can create a local variable inside the function and addAll to it when calling recursively: public static List&lt;File&gt; listFiles(File dir) { List&lt;File&gt; result = new ArrayList&lt;&gt;(); if (!dir.isDirectory() || !dir.exists()) return result; // Alternatively: return Collections.emptyList(); for (File file : dir.listFiles()) { result.add(file); result.addAll(listFiles(file)); } return result; }
upvote count: 3
answers question: http://stackoverflow.com/q/27462689

http://stackoverflow.com/comment/43372753
comment on: http://stackoverflow.com/q/27468745
type: Comment
has text: please give use the Board class, please.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43162817
comment on: http://stackoverflow.com/q/27354255
type: Comment
type: QuestionComment
has text: did you find the ans useful?
score: 0

http://stackoverflow.com/q/27464656
possible better answer: http://stackoverflow.com/a/27464938
has answer: http://stackoverflow.com/a/27590508
accepted answer: http://stackoverflow.com/a/27590508
has body: This code: temp.set(pizzaArray.get(i), upIdx); refers to this method (in my ArrayList class): public void set(T objectToSet, int index) { this.data[index] = objectToSet; } It generates an error "The method set(int, Pizza) in the type ArrayList is not applicable for the arguments (Pizza, int). This is a home-grown ArrayList class, not Java's built-in one. temp is an ArrayList. I've checked everything I can think of and restarted Eclipse; why does Java insist that my set method wants the arguments in reverse order?
has comment: http://stackoverflow.com/comment/43369518
has answer: http://stackoverflow.com/a/27464938
has comment: http://stackoverflow.com/comment/43365704
has comment: http://stackoverflow.com/comment/43365752
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43365528
has title: Java/Eclipse swaps parameter order in method call, giving an error
has comment: http://stackoverflow.com/comment/43365957
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43365597
has comment: http://stackoverflow.com/comment/43365908
score: 0

http://stackoverflow.com/comment/43262730
type: QuestionComment
comment on: http://stackoverflow.com/q/27408945
has text: @BoristheSpider Well, a small test shows me, that `nextInt` doesn't care about `\n` and will read numbers beyond that character.
score: 0
type: Comment

http://stackoverflow.com/a/46801610
type: Answer
upvote count: 1
score: 1
has body: I used following code to get rid of the issue. Using a default constructor gave me problems in cloning entities with composite keys while using BeanUtils.copyProperties(). Hence i used @PrePersist. This is called just before a row is created in database for the first time @MappedSuperclass @Getter @Setter public abstract class AbstractMasterUUIDEntity extends AbstractMasterEntity&lt;String&gt; { @Id private String id; @PrePersist public void generateId() { if(this.id == null ) { this.id = UUID.randomUUID().toString(); } } }
downvote count: 0
answers question: http://stackoverflow.com/q/27348803

http://stackoverflow.com/comment/43277175
type: AnswerComment
has text: Thanks, small question. why remove SpringBeanAutowiringInterceptor? Its suppose to inject the spring bean to the EJB right? Bit confused.
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27416757

http://stackoverflow.com/q/27469597
upvote count: 0
has title: Access is denied (fle not found Exception)
has body: I'm tring to save a file in to a path that I obtain with JfileChooser, but when I save in this path it throws : java.io.FileNotFoundException: C:\Users\Documents (Access is denied) This is my code: JSONObject jsonObject = new JSONObject(); jsonObject.put(testoNumeroIntervalli,new Integer(singletonAutomobilista.getNumeroIntervalli())); try{ FileWriter file = new FileWriter(percorso); file.write(jsonObject.toJSONString()); file.flush(); file.close(); }catch(Exception e){ e.printStackTrace(); } Anyone can help me?
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27469659
has comment: http://stackoverflow.com/comment/43374206
downvote count: 2
score: -2
type: AnsweredQuestion
tagged with: java
tagged with: file
accepted answer: http://stackoverflow.com/a/27469659
type: Question
tagged with: filenotfoundexception

http://stackoverflow.com/q/27396881
upvote count: 1
type: AnsweredQuestion
tagged with: apache-pig
score: 1
tagged with: java
tagged with: mapreduce
type: Question
tagged with: hadoop
has title: Pig custom loadFunc always use 1 mapper and 1 inputSplit
has answer: http://stackoverflow.com/a/27432492
accepted answer: http://stackoverflow.com/a/27432492
downvote count: 0
answer count: 1
has body: I created a custom loadFunc with a custom InputFormat and RecordReader. Whenever the InputFormat return more than one input split the PigSplit always contains only one input split and use only one mapper. The implementation is too big to be posted here, but are there any obvious reasons why this might happen ? Edit: I'm using pig 0.13 and by adding some logging I found that the InputFormat created by the Loadfunc returns a list that contains two input splits and then the PigInputFormat uses this list for creating PigSplits. I still can't find out where did Pig omit one of these input splits and only used the first one. This is the code from PigInputFormat.java ( src ) line 273 InputFormat inpFormat = loadFunc.getInputFormat(); List&lt;InputSplit&gt; oneInputSplits = inpFormat.getSplits( HadoopShims.createJobContext(inputSpecificJob.getConfiguration(), jobcontext.getJobID())); List&lt;InputSplit&gt; oneInputPigSplits = getPigSplits(oneInputSplits, i, inpTargets.get(i), HadoopShims.getDefaultBlockSize(fs, isFsPath? path: fs.getWorkingDirectory()), combinable, confClone); splits.addAll(oneInputPigSplits); I made sure that loadFunc returns 2 input splits, but somehow only one PigSplit is created. Any clues of how can this be figured out. Edit 2: So I downloaded the source code for pig 0.13 and compiled it and ran my script and surprisingly it worked fine and used the two splits when I did that, unfortunately I can't do that on the server node. What I noticed is that the stack trace to create the inputsplits is different between the ready compiled version in cloudera and the downloaded version I compiled. The cloudera version creates the InputSplits using org.apache.pig.backend.hadoop.executionengine.mapReduceLayer.PigInputFormat while the downloaded version uses org.apache.pig.impl.io.ReadToEndLoader I'm really getting confused about this one.
favorite count: 0

http://stackoverflow.com/comment/43157739
score: 0
comment on: http://stackoverflow.com/q/27351819
type: Comment
type: QuestionComment
has text: try giving ` XXX `also

http://stackoverflow.com/a/27365714
has comment: http://stackoverflow.com/comment/43308657
answers question: http://stackoverflow.com/q/27342056
score: 0
type: Answer
has body: I would suggest that you declare your variables outside the function declaration since it seems that onRadioButtonClicked uses variables declared in add method. In general, due to scope issues, onRadioButtonClicked cannot access c1, and c2 declared inside add. A better way is to declare variables as member variables of the MainActivity class (usually I would set them private and use getter/setter methods to access them): public class MainActivity extends ActionBarActivity { TextView result; EditText edit1; double c; double c1; //your code } Then you have to be aware that if variables result, c, and c1 are not defined before you click on your radio buttons (which triggers the onRadioButtonClicked method), you will run into error because you are performing operations on undefined variables such as result.setText. Hence, you must consider the order in which the functions are fired. I would suggest that you trigger add function after the user chooses the radio button. For example: public void add(){ //code check for which radioButton is selected, or no radioButton is selected your code //code to calculate according to whichever radioButton is selected your code //display your code } This way, selecting a radio button without c, c1, or result defined won't cause the app to shut down.

http://stackoverflow.com/comment/43315366
score: 0
type: AnswerComment
has text: i want to make database from my program only
type: Comment
comment on: http://stackoverflow.com/a/27437462

http://stackoverflow.com/a/27457078
has body: Even though this looks odd to me, but I think this is what you are asking. public int calcCircleCircumf(int radius) { return (int)(2 * Math.PI * radius); } public double calcCircleCircumf(double diameter) //method overloading { return (2 * Math.PI * (diameter/2)); } I think this is what you want.
has comment: http://stackoverflow.com/comment/43351380
has comment: http://stackoverflow.com/comment/43351362
answers question: http://stackoverflow.com/q/27456935
score: 0
type: Answer

http://stackoverflow.com/comment/43381960
comment on: http://stackoverflow.com/q/27473692
has text: can you post the nullpointer error message?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27380455
has comment: http://stackoverflow.com/comment/43210441
accepted answer of: http://stackoverflow.com/q/27380219
answers question: http://stackoverflow.com/q/27380219
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43210607
has comment: http://stackoverflow.com/comment/43210567
type: Answer
has comment: http://stackoverflow.com/comment/43210109
has body: The method xWins is looking for two boolean parameters. You do not show us how you call that method, but by the error it is obvious that you are only trying to pass it one boolean value. Since a method by that name doesn't exist that accepts only one parameter, it can't continue--The method you created that is looking for two booleans as parameters won't work if you only try to pass it one.
has comment: http://stackoverflow.com/comment/43210223
score: 0

http://stackoverflow.com/a/27416500
has body: This is happening because the nextInt does not read the last newline character of the input, and that remaining newline is getting consumed in the next call to nextLine. The same behavior can be noticed if we use nextLine after any of the nextXXX except for the nextLine itself In order to solve this problem you can: Either use a blank nextLine call after nextInt to consume the newline int input = sc.nextInt(); sc.nextLine(); // Use this to consume the newline character String input1 = sc.nextLine(); or you can use the workaround as mentioned by @kirbyquerby
type: Answer
answers question: http://stackoverflow.com/q/27416106
score: 0

http://stackoverflow.com/comment/43258163
score: 0
type: AnswerComment
has text: This code can also cause a concurrent modification exception since you are accessing the Map will using the Iterator.
comment on: http://stackoverflow.com/a/27406812
type: Comment

http://stackoverflow.com/comment/43359961
comment on: http://stackoverflow.com/a/27460845
type: AnswerComment
has text: @Almas Shaikh, I've updated the code I ran by updating my question.
score: 0
type: Comment

http://stackoverflow.com/q/27401941
type: Question
tagged with: java
has title: Java: Can we cast a set into an arraylist ?
has body: I have a hashmap called gg. I want to take out its keys using keySet() method and pass them as parameter of another method. method_A( gg.keySet()); public void method_A(ArrayList&lt;Integer&gt; jj){ .... } But I got this error: error: incompatible types: Set&lt;Integer&gt; cannot be converted to ArrayList&lt;Integer&gt;. Then I saw this: method_A (new ArrayList&lt;Integer&gt;(gg.keySet())); What is it doing actually ? It looks like type casting to me. I am puzzled. Could someone explain to me what is going on ?
tagged with: type-conversion
score: 0
tagged with: casting
answer count: 1
tagged with: arraylist
has answer: http://stackoverflow.com/a/27401983
type: AnsweredQuestion
tagged with: set
accepted answer: http://stackoverflow.com/a/27401983

http://stackoverflow.com/comment/43217142
comment on: http://stackoverflow.com/a/27384192
score: 1
type: Comment
has text: Good call. I added the relevant part of the previous comments, including links.
type: AnswerComment

jpa
tags question: http://stackoverflow.com/q/27452138
tags question: http://stackoverflow.com/q/27419919
tags question: http://stackoverflow.com/q/27380377
tags question: http://stackoverflow.com/q/27466902
tags question: http://stackoverflow.com/q/27411156
tags question: http://stackoverflow.com/q/27444058
tags question: http://stackoverflow.com/q/27473941
tags question: http://stackoverflow.com/q/27452220
tags question: http://stackoverflow.com/q/27374470
tags question: http://stackoverflow.com/q/27427334
tags question: http://stackoverflow.com/q/27357474
tags question: http://stackoverflow.com/q/27459304
tags question: http://stackoverflow.com/q/27329482
tags question: http://stackoverflow.com/q/27422898
tags question: http://stackoverflow.com/q/27358121
tags question: http://stackoverflow.com/q/27332997
tags question: http://stackoverflow.com/q/27358809
tags question: http://stackoverflow.com/q/27462185
tags question: http://stackoverflow.com/q/27314409
tags question: http://stackoverflow.com/q/27441374
tags question: http://stackoverflow.com/q/27442946
tags question: http://stackoverflow.com/q/27470930
tags question: http://stackoverflow.com/q/27396002
tags question: http://stackoverflow.com/q/27315337
tags question: http://stackoverflow.com/q/27315865
tags question: http://stackoverflow.com/q/27465454
tags question: http://stackoverflow.com/q/27360966
tags question: http://stackoverflow.com/q/27335487
tags question: http://stackoverflow.com/q/27397647
tags question: http://stackoverflow.com/q/27444934
tags question: http://stackoverflow.com/q/27344165
tags question: http://stackoverflow.com/q/27332518
tags question: http://stackoverflow.com/q/27400396
tags question: http://stackoverflow.com/q/27346582
tags question: http://stackoverflow.com/q/27407650
tags question: http://stackoverflow.com/q/27458428
type: Tag
tags question: http://stackoverflow.com/q/27376189
tags question: http://stackoverflow.com/q/27393834
tags question: http://stackoverflow.com/q/27354948
tags question: http://stackoverflow.com/q/27345133
tags question: http://stackoverflow.com/q/27421548
tags question: http://stackoverflow.com/q/27343227
tags question: http://stackoverflow.com/q/27439178
tags question: http://stackoverflow.com/q/27403387
tags question: http://stackoverflow.com/q/27379810
tags question: http://stackoverflow.com/q/27354321
tags question: http://stackoverflow.com/q/27425961
tags question: http://stackoverflow.com/q/27398129
tags question: http://stackoverflow.com/q/27382088
tags question: http://stackoverflow.com/q/27458407
tags question: http://stackoverflow.com/q/27359917
tags question: http://stackoverflow.com/q/27415066
tags question: http://stackoverflow.com/q/27374339
tags question: http://stackoverflow.com/q/27403513
tags question: http://stackoverflow.com/q/27316635
tags question: http://stackoverflow.com/q/27421706
tags question: http://stackoverflow.com/q/27451278
tags question: http://stackoverflow.com/q/27446009
tags question: http://stackoverflow.com/q/27377965
tags question: http://stackoverflow.com/q/27472985
tags question: http://stackoverflow.com/q/27331743
tags question: http://stackoverflow.com/q/27412288
tags question: http://stackoverflow.com/q/27371983
tags question: http://stackoverflow.com/q/27427188
tags question: http://stackoverflow.com/q/27461568
tags question: http://stackoverflow.com/q/27442866
tags question: http://stackoverflow.com/q/27329843
tags question: http://stackoverflow.com/q/27384322
tags question: http://stackoverflow.com/q/27335339
tags question: http://stackoverflow.com/q/27342424
tag name: jpa
tags question: http://stackoverflow.com/q/27387307
tags question: http://stackoverflow.com/q/27345454
tags question: http://stackoverflow.com/q/27453319
tags question: http://stackoverflow.com/q/27432603
tags question: http://stackoverflow.com/q/27402910
tags question: http://stackoverflow.com/q/27316792
tags question: http://stackoverflow.com/q/27432575
tags question: http://stackoverflow.com/q/27465281

http://stackoverflow.com/comment/43337013
score: 0
has text: "_" is a separator for the whole number and fractional part: 2_1/2 = 2.5
comment on: http://stackoverflow.com/q/27435931
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43118760
comment on: http://stackoverflow.com/q/27330015
type: Comment
type: QuestionComment
score: 0
has text: Can you post exception trace. It might happen that it is throwing error somewhere else. You have multiple arrays working there.

http://stackoverflow.com/a/27382130
answers question: http://stackoverflow.com/q/27379892
has body: That's how I usually add a keyEvent Handler to listen to key events. FlowPane pane = new FlowPane(); pane.setOnKeyPressed(new EventHandler&lt;KeyEvent&gt;() { @Override public void handle(KeyEvent key) { if (key.getCode() != KeyCode.ENTER) { if (key.getCode().isDigitKey() || key.getCode().isLetterKey()) { String newChar = key.getText(); input = input.concat(newChar); } } else { this.addScanToList(input); input = ""; } } }); }
type: Answer
has comment: http://stackoverflow.com/comment/43224587
score: 0

http://stackoverflow.com/a/27346906
accepted answer of: http://stackoverflow.com/q/27346852
has comment: http://stackoverflow.com/comment/43148782
answers question: http://stackoverflow.com/q/27346852
score: 1
upvote count: 1
type: AcceptedAnswer
has body: Since you are getting a random number each time the button is clicked, you just need to not increment the counter before accessing your array: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final TextView line = (TextView) findViewById(R.id.line); Button bl = (Button) findViewById(R.id.bl); final String[] jokes = { "joke 1", "joke 2" , "joke 3" , "joke 4" }; bl.setOnClickListener(new View.OnClickListener() { int rando = (int) (Math.random() * 4); @Override public void onClick(View v) { line.setText(jokes[rando]); } }); } Another alternative would be to get one random number once, store it in a field, and then increment it each time the button is clicked: int rando; // store in a field in your Activity @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final TextView line = (TextView) findViewById(R.id.line); Button bl = (Button) findViewById(R.id.bl); final String[] jokes = { "joke 1", "joke 2" , "joke 3" , "joke 4" }; final int jokeCount = jokes.length; rando = (int) (Math.random() * 4); // initialize only in onCreate bl.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (++rando &gt;= jokeCount) { // increment in onClick rando = 0; // reset counter when needed } line.setText(jokes[rando]); } }); }
type: Answer
has comment: http://stackoverflow.com/comment/43148738
has comment: http://stackoverflow.com/comment/43149042
downvote count: 0

http://stackoverflow.com/comment/43245886
comment on: http://stackoverflow.com/q/27385363
type: Comment
type: QuestionComment
has text: I use a war file, which is compiled on the server which should use the jar files from the lib folder. On my pc I also just added the jar to the lib folder in tomcat and then the servlet works fine. This method also worked on my previous server (with the same servlet/war). One other point is that the TLD error is given with every servlet on the server it does not matter if the servlet is using the jar or not. So I think it has to do with some configurations in tomcat which I've done wrong.
score: 0

http://stackoverflow.com/q/27341665
answer count: 1
tagged with: jaspic
downvote count: 0
has title: Is it possible to determine group membership of a user on demand instead of when logging in in ServerAuthModule (JASPIC)
has body: I'm trying to write my own ServerAuthModule, to use a custom login system. If I understood everything right, what happens is that the container calls the validateRequest method for every incoming request, and that my SAM will check for credentials, and tell the container the username and groups of the user (if the credentials are right) via the CallbackHandler. public class MySAM implements ServerAuthModule { @Override public AuthStatus validateRequest(MessageInfo messageInfo, Subject clientSubject, Subject serviceSubject) throws AuthException { // check user credentials ... // set username and groups CallerPrincipalCallback cpCallback = new CallerPrincipalCallback(clientSubject, username); GroupPrincipalCallback gpCallback = new GroupPrincipalCallback(clientSubject, groups); callbackHandler.handle(new Callback[]{cpCallback, gpCallback} return AuthStatus.SUCCESS; } ... } My problem now is, that when a user logs in, I don't know to which groups the user belongs. I can only check whether the user is in a given group. Is it somehow possible to give the container a method with which it can check whether a user is in a given group, instead of giving it an array with groups in the validateRequest method? boolean isInGroup(String username, String group) { // ask backend system }
has comment: http://stackoverflow.com/comment/64523569
favorite count: 0
accepted answer: http://stackoverflow.com/a/27485629
tagged with: jakarta-ee
type: AnsweredQuestion
upvote count: 5
tagged with: java
has answer: http://stackoverflow.com/a/27485629
type: Question
score: 5

http://stackoverflow.com/comment/43342464
score: 0
type: Comment
has text: Welcome to the joys of Java's broken type-variance.
comment on: http://stackoverflow.com/a/27452006
type: AnswerComment

http://stackoverflow.com/q/27412070
linked to: http://stackoverflow.com/q/1073919
has comment: http://stackoverflow.com/comment/43268423
score: -1
has comment: http://stackoverflow.com/comment/43268538
tagged with: java
has comment: http://stackoverflow.com/comment/43269083
has title: ArrayIndexOutOfBoundsException when accessing List<int[]>
answer count: 1
downvote count: 1
has body: Why am I getting Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException ERRO while executing the following code? int[] things={11,22,33,44}; List&lt;int[]&gt;Listdata = Arrays.asList(things); int[] n=Listdata.get(1); System.out.println(n[1]); It works fine if i put get(0)
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43268571
upvote count: 0
has comment: http://stackoverflow.com/comment/43268504
favorite count: 0
type: Question
has answer: http://stackoverflow.com/a/27412198

http://stackoverflow.com/comment/43281880
comment on: http://stackoverflow.com/q/27419390
has text: Here is your answer: http://stackoverflow.com/questions/3680221/how-can-i-get-the-monitor-size-in-java
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43309406
type: AnswerComment
score: 0
type: Comment
has text: @JohnBollinger oh, I see.. Somehow I misunderstood this and thought the TS was on the wrong way thinking of generics. One more edit to come.
comment on: http://stackoverflow.com/a/27433937

http://stackoverflow.com/comment/43322877
has text: Did you store that file or are you working on a third party format?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27441694
score: 0

http://stackoverflow.com/comment/43110779
has text: Thank you and +1 for looking into this. How does the code change if I want to print it out sorted in ascending order of the counts?
comment on: http://stackoverflow.com/a/27325669
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27454982
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27454969
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27454969
type: Answer
has comment: http://stackoverflow.com/comment/43347933
score: 3
downvote count: 0
has body: You've only added an ActionListener to one button: btnAdd.addActionListener(this); And so, only one button, the btnAdd, will work, since the buttons won't work by magic and all require that an ActionListener be added to them for them to have any function whatsoever. i.e., btnFill.addActionListener(....something here....); Myself, I prefer to use anonymous ActionListeners if possible, something like btnFill.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // do some fill stuff here } }); This suggests that you're trying to use JButtons without first reading the tutorials, something I advise against. Please have a look at them as they're very helpful: How to use Buttons.

http://stackoverflow.com/a/27447861
answers question: http://stackoverflow.com/q/27447706
score: 0
has body: There are a few ways to do this. Random rnd = new Random(); ArrayList&lt;Integer&gt; all = new ArrayList&lt;Integer&gt;(); ArrayList&lt;Integer&gt; even = new ArrayList&lt;Integer&gt;(); //Add 100 integers of all numbers for(int x=0; x&lt;100; x++) all.add(rnd.nextInt(26)) //26 gives random 0-25 //Add 100 integers of even numbers int x=0; while(x&lt;100){ int rand = rnd.nextInt(); if(rand % 2 == 0){ even.add(rand); x++ } } Generating odd numbers are same as the way you generate even numbers. Just change the condition to if (rand % 2 != 0)
type: Answer

http://stackoverflow.com/q/27362204
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27366003
tagged with: java
has comment: http://stackoverflow.com/comment/43177651
has comment: http://stackoverflow.com/comment/43177188
has comment: http://stackoverflow.com/comment/43177360
type: Question
has comment: http://stackoverflow.com/comment/43181760
has comment: http://stackoverflow.com/comment/43178077
has comment: http://stackoverflow.com/comment/43176794
has body: I have a set of arrays (which are "pixels" - RGB representation) for e.g. (0,0,0)(0,0,0)(0,0,0)(0,0,0) (1,1,1)(1,1,1)(1,1,1)(1,1,1) (2,2,2)(2,2,2)(2,2,2)(2,2,2) I want to shift left/right the columns and up/down the rows. for example: ShiftCol + 2 will yield the output: (0,0,0)(0,0,0)(0,0,0)(0,0,0) (0,0,0)(0,0,0)(1,1,1)(1,1,1) (0,0,0)(0,0,0)(2,2,2)(2,2,2) ShiftRow - 1 will yield the output:(after ShiftCol +2) (0,0,0)(0,0,0)(0,0,0)(0,0,0) (0,0,0)(0,0,0)(0,0,0)(0,0,0) (0,0,0)(0,0,0)(1,1,1)(1,1,1) (what happend in the above output is: First row move to second row, second row to third row, and first row became black (just zero's), the third row is just replaced with the second row. ShiftCol- 1 will yield the output: (0,0,0)(0,0,0)(0,0,0)(0,0,0) (0,0,0)(0,0,0)(0,0,0)(0,0,0) (0,0,0)(1,1,1)(1,1,1)(0,0,0) I just need your help to show me how can I "move" every column to the right, that will be enough. What I managed to do is when ShiftCol +2 is called, the first column is moved 2 columns to the right (and is appeared on the third column) and the first two columns are turned to (0,0,0) which is black color. the problem is I don't know how to move EVERY column to the right according the the number it is called to move right, for example - if i call ShiftCol(2) and the pixel image array is 3x4 as you can see in the outputs what should happen is that: first column will be moved twice to the right - to the third column, and first column will become black (0,0,0), second column will be moved to twice to the right too and will become the fourth column. third and fourth columns will just be replaced by first and second columns. It'll be enough if you just guide me somehow how to manage that, anyhow you can focus on the method "ShiftCol" only in RGBImage class and you'll see what I've accomplished so far within code. Thanks on advance! *PLEASE, keep the answer simple with code. I learned just for loops, while loops, if statements, arrays.. I don't want to use in this project any oth…
score: 0
has comment: http://stackoverflow.com/comment/43176937
has title: Shifting a pixel image left and right
answer count: 2
possible better answer: http://stackoverflow.com/a/27366003
has comment: http://stackoverflow.com/comment/43180098
has comment: http://stackoverflow.com/comment/43177498
has comment: http://stackoverflow.com/comment/43177512
has answer: http://stackoverflow.com/a/27367530
accepted answer: http://stackoverflow.com/a/27367530

http://stackoverflow.com/q/27469802
has answer: http://stackoverflow.com/a/27470293
answer count: 1
has comment: http://stackoverflow.com/comment/43374740
downvote count: 0
has title: How to access a java resource in a platform independent manner?
tagged with: file-access
favorite count: 0
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27470293
has comment: http://stackoverflow.com/comment/43374697
upvote count: 2
tagged with: file
type: Question
has body: I have placed a bitmap in /src/media/ and I am trying to access it in a manner that will work on all operating systems with: ImageIO.read(this.getClass().getResource("/media/title.bmp")); However I receive an exception when trying to execute my code: Exception in thread "main" java.lang.IllegalArgumentException: input == null! at javax.imageio.ImageIO.read(Unknown Source) Which implies that this.getClass().getResource("/media/title.bmp") returns null. Can you help me find my mistake?
tagged with: java
has comment: http://stackoverflow.com/comment/43374647
tagged with: eclipse

http://stackoverflow.com/q/27340458
answer count: 3
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27340483
score: 2
has answer: http://stackoverflow.com/a/27340565
has answer: http://stackoverflow.com/a/27340518
upvote count: 2
type: UnansweredQuestion
tagged with: java
type: Question
has body: Why does this code in Java output the value -210, when it's an infinite Loop? Does this loop end when the integer reaches its max value? public static void main(String[] args) { int a=100; int b=110; int c=0; while(a&gt;=100 &amp;&amp; b&lt;=110) { a=a+1; b=b-1; c=a-b; } System.out.println(c); }
has title: Why does this infinite Loop converge?
tagged with: math

http://stackoverflow.com/q/27449230
has comment: http://stackoverflow.com/comment/43337298
has comment: http://stackoverflow.com/comment/43337430
has answer: http://stackoverflow.com/a/27449269
has comment: http://stackoverflow.com/comment/43337269
score: 2
answer count: 1
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43337387
accepted answer: http://stackoverflow.com/a/27449269
type: AnsweredQuestion
has title: Parsing JSON in javascript coming from Java Jackson JSON
upvote count: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/43337183
has body: I followed this example to generate a json string to be later parsed in javascript package example; import org.codehaus.jackson.map.ObjectMapper; import java.util.HashMap; import java.util.Map; public class Example { public static void main(String[] args) { Map&lt;String,String&gt; map = new HashMap&lt;&gt;(); ObjectMapper mapper = new ObjectMapper(); map.put("key1","value1"); map.put("key2","value2"); String json = mapper.writeValueAsString(map); System.out.println(json); } } in Javascript: $http.get('/rest/json-example'). success(function(data) { //$scope.count = data.length; console.log(data.key1); //console.log(JSON.parse(data)); }).error(function(error) { console.log(error); }); I don't know how to parse the string, this is how it gets printed using console.log(data) // Object {key1: "value2", key2: "value1"} If I use JSON.parse(data); // I get an error "unexpected SyntaxError: Unexpected token o at Object.parse (native)..." if I try to access it like: console.log(data[0]); // I get undefined
tagged with: javascript
tagged with: jackson

http://stackoverflow.com/q/27422494
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27422599
score: 1
tagged with: java
has body: What exactly does the (int) before the (Math.random()) do to it? I know it has to do with getting an integer out of the Math.random() but I can't really understand how it does that. I can't understand how this (int) works. I mean, for example, how do I use it in other ways?
type: Question
has title: In java, what is the difference between (int)(Math.random()) and Math.random()?
has comment: http://stackoverflow.com/comment/43287236
downvote count: 3
possible better answer: http://stackoverflow.com/a/27422599
has answer: http://stackoverflow.com/a/27439075
favorite count: 0
has answer: http://stackoverflow.com/a/27422755
has comment: http://stackoverflow.com/comment/43287167
upvote count: 4
has answer: http://stackoverflow.com/a/27422622
accepted answer: http://stackoverflow.com/a/27422622

http://stackoverflow.com/q/27467515
has comment: http://stackoverflow.com/comment/43370930
tagged with: methods
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43370911
has answer: http://stackoverflow.com/a/27467759
tagged with: java
has body: When I write myData method, its gives an error that It cannot be resolved to a variable. Here is the code. private class DownloadData extends AsyncTask&lt;String, Void, String&gt; { String myXmlData; protected String doInBackground(String...urls) { try { **myData** = downloadXML(urls[0]); } catch(IOException e) { return "Unable to download XML file."; } return""; } protected void onPostExecute(String result) { Log.d("OnPostExecute", myXmlData); textView.setText(myXmlData);
has answer: http://stackoverflow.com/a/27467991
score: -1
answer count: 2
upvote count: 0
has title: myData method cannot be resolved to a variable error
has comment: http://stackoverflow.com/comment/43370766
favorite count: 0
has comment: http://stackoverflow.com/comment/43370633
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43370865

http://stackoverflow.com/q/27369232
tagged with: grails
score: 0
answer count: 1
has body: I am attempting to add a RegexRequestMatcher which will look for urls that have a particular url parameter and redirect requests to a custom AuthenticationEntryPoint. I am having difficulty, however, matching url parameters as they seem to be getting removed from the incoming HttpServletRequest. After some significant searching it sounded like spring security intentionally filtered these out of the incoming requests for security reasons. It appeared that there was a property stripQueryStringFromUrls which overrode this behavior which could be set via a BeanPostProcessor on the DefaultFilterInvocationSecurityMetadataSource class, however as of 3.1 this property no longer exists (in 3.0.0 it appeared to have moved to FilterChainProxy before disappearing entirely with the next release). Does spring security still strip out query strings by default or was the disappearance of the configuration property a result of that behavior being removed? If it still does, how do you enabled url parameters as of spring security 3.1? I am using Spring Security 3.1.3 through the grails spring security plugin (1.2.7).
has title: Allowing query strings in RegexRequestMatcher
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27389043
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27389043
tagged with: spring-security

http://stackoverflow.com/comment/43282110
has text: The unexpected token is not the ** ** tag. It's the BOM marker, the first three bytes output by PHP. Save your .php source files as ASCII to solve the problem.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27404844

http://stackoverflow.com/comment/43331765
has text: You can make it event driven using file system watcher. WatchKeys are thread-safe and can be used with the java.nio.concurrent package. https://docs.oracle.com/javase/tutorial/essential/io/notification.html
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27431908
type: AnswerComment

http://stackoverflow.com/comment/43221713
comment on: http://stackoverflow.com/a/27386644
type: AnswerComment
has text: so all the data will reside in my java heap memory during whole process :-( . by the way i am working with db2
type: Comment
score: 0

http://stackoverflow.com/comment/43164495
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27354900
has text: @TacB0sS : so what is the solution to it?
score: 0

http://stackoverflow.com/q/27429181
linked to: http://stackoverflow.com/q/27386578
has answer: http://stackoverflow.com/a/27429413
score: 0
answer count: 3
has answer: http://stackoverflow.com/a/66360744
has title: Generating random words of a certain length in java?
favorite count: 0
has comment: http://stackoverflow.com/comment/43300195
has comment: http://stackoverflow.com/comment/43322075
has answer: http://stackoverflow.com/a/27429423
has comment: http://stackoverflow.com/comment/43300088
type: UnansweredQuestion
tagged with: java
upvote count: 1
downvote count: 1
type: Question
has body: I would like to ask another question about how to write a method that generates random words of a certain length and when calling a method user selects the length of words that will be generated and returned from the method. JOptionPane needs to be used for input. The method work needs to be shown through Main.
has comment: http://stackoverflow.com/comment/43299760
linked to: http://stackoverflow.com/q/4951997
has comment: http://stackoverflow.com/comment/43299893

http://stackoverflow.com/comment/43314723
type: AnswerComment
has text: Just use `saveAllDrawablesToSdcard(FolderFrame.this, new File(Environment.getExternalStorageDir(), "/Image/sample/"));`
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27436796

http://stackoverflow.com/comment/43088948
comment on: http://stackoverflow.com/a/27314170
score: 0
type: Comment
type: AnswerComment
has text: For this thing thing i am using jdk 1.7...@fge

http://stackoverflow.com/q/27440359
has body: I'm trying to search a file in ALL the SD Card with ".apk" extension. I've written this method. public void scan(File file) { mFile = file.listFiles(); if(mFile != null) { for(int i=0;i&lt;mFile.length;i++) { if(mFile[i] != null) { if(mFile[i].isDirectory()) { scan(mFile[i]); } else { if(mFile[i].getName().endsWith(".apk")) { lista.add(mFile[i].getName()); } } } } } } And I passed as parameter scan(Environment.getExternalStorageDirectory()); The problem is that also if I've some apk files into SD Card the array list size is 0 and no one apk files is detected by this method. Why? My goal is to scan ALL the sd card to search .apk files.
possible better answer: http://stackoverflow.com/a/27440889
has comment: http://stackoverflow.com/comment/43320738
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43320624
has comment: http://stackoverflow.com/comment/43321174
has answer: http://stackoverflow.com/a/27440889
has comment: http://stackoverflow.com/comment/43320532
has comment: http://stackoverflow.com/comment/43320787
tagged with: java
has comment: http://stackoverflow.com/comment/43320873
has answer: http://stackoverflow.com/a/27440895
type: Question
has comment: http://stackoverflow.com/comment/43320489
has answer: http://stackoverflow.com/a/27440800
score: 0
has answer: http://stackoverflow.com/a/27440938
tagged with: android
accepted answer: http://stackoverflow.com/a/27440895
has comment: http://stackoverflow.com/comment/43321160
answer count: 4
has comment: http://stackoverflow.com/comment/43320514
has title: Search file in ALL SD Card

http://stackoverflow.com/comment/43265511
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27405988
has text: @Kenster, Oh, the very last time it failed it must have been a connection refused, which I copied and pasted. I've restarted and I'm back to the timeout. I've updated the title and pasted in the full error in the description.

http://stackoverflow.com/comment/43240329
score: 1
comment on: http://stackoverflow.com/a/27394489
has text: [Modifying the Look and Feel](http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/index.html)
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27374448
has body: An DStream is a collection of RDDs over time. Each RDD is composed of partitions of data distributed across the cluster of Spark workers. In this illustration, each colored line represents a stream of data. When it's bounded in an rdd, it's a partition of the RDD. The RDD is composed by the data collected at each time interval, represented here by the blue box. DStream.saveAsTextFile will create a file for the RDD created at interval (bluc box) each part-file corresponds to the piece of the colored line bounded by such RDD (colored line within blue blox). In a distributed file system, like hdfs, the fs will abstract out the partitioning, presenting you with a single logical file, or 1 file per RDD. When you use the local file system, those part-files will the explicit as you are seeing. (*) Credits for the image: Spark presentation at Devoxx 2014 by Andy Petrella and Gerard Maas (me)
accepted answer of: http://stackoverflow.com/q/27367814
answers question: http://stackoverflow.com/q/27367814
has comment: http://stackoverflow.com/comment/43261154
score: 1
has comment: http://stackoverflow.com/comment/43256572
has comment: http://stackoverflow.com/comment/43222419
has comment: http://stackoverflow.com/comment/43279019
upvote count: 1
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43258265
type: Answer

http://stackoverflow.com/q/27348843
tagged with: twitter4j
has answer: http://stackoverflow.com/a/27348870
tagged with: search
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43152359
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27348870
has comment: http://stackoverflow.com/comment/43152355
has body: public static void main(String[] args) { args[0] = "derp"; args[1] = "herp"; args[2] = "lerp"; if (args.length &lt; 1) { System.out.println("what?"); System.exit(-1); }Twitter twitter = new TwitterFactory().getInstance(); try { Query query = new Query(args[0]); QueryResult result; do { result = twitter.search(query); List&lt;Status&gt; tweets = result.getTweets(); for (Status tweet : tweets) { System.out.println("@" + tweet.getUser().getScreenName() + " - " + tweet.getText()); } } while ((query = result.nextQuery()) != null); System.exit(0); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to search tweets: " + te.getMessage()); System.exit(-1); } i am getting this error i dont know why.. Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at twitter4j.examples.search.SearchTweets.main(SearchTweets.java:34)
type: Question
has title: Java error : java.lang.ArrayIndexOutOfBoundsException: 0

http://stackoverflow.com/comment/43180261
type: Comment
type: QuestionComment
has text: guys, I still did not get why I would use a seed and why I would not. If i did not use, what is the default seed used ?
comment on: http://stackoverflow.com/q/27364143
score: 0

http://stackoverflow.com/comment/43354748
has text: AkashKing you want to display `HashMap` key `per row or per colummns`, meaning `per tr or per td`
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27458914
type: QuestionComment

http://stackoverflow.com/a/27395760
answers question: http://stackoverflow.com/q/27395666
has body: Code blocks in enums allows you to override methods defined in the enum type. For instance enum Foo { PEAR, BANANA() { @Override public void doFoo() { System.out.println("Banana foo"); } }, APPLE, GRAPE; public void doFoo() { System.out.println("Default foo"); } } Here Foo.BANANA.doFoo() would produce "Banana foo", while calling doFoo() on any other Foo would produce "Default foo".
type: Answer
accepted answer of: http://stackoverflow.com/q/27395666
score: 10
upvote count: 10
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43232438
comment on: http://stackoverflow.com/q/27392432
score: 0
type: Comment
type: QuestionComment
has text: What is wrong with your code now?

http://stackoverflow.com/comment/43215762
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27381333
has text: Thanks for all the detail and explicitly pointing out you want to know why it isn't working. People tend to ignore that kind of question and just slap a completely new pattern into the asker's face (heck, even I do that sometimes).
type: Comment

http://stackoverflow.com/comment/43226855
comment on: http://stackoverflow.com/q/27381825
score: 1
has text: You'll need a `CellEditor` for [example](http://stackoverflow.com/a/11179669/230513).
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43105534
has text: Oh yes, 1 more question. what is "+=" and what is that "distance = *" in the end of each statement. could you explain
comment on: http://stackoverflow.com/a/27322007
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43246171
has text: from android develop say getRunningTasks(int maxNum) was deprecated in API level 21. As of LOLLIPOP, this method is no longer available to third party applications: the introduction of document-centric recents means it can leak person information to the caller. For backwards compatibility, it will still retu rn a small subset of its data: at least the caller's own tasks, and possibly some other tasks such as home that are known to not be sensitive.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27395171

http://stackoverflow.com/a/27437906
downvote count: 0
has body: try something like this with your form: see what I'm getting at? just spit the form up into dialogs, add data to jsonObject when moving from dialogs. At the end you could display this, and then allow user to submit. Submit $("form#data").submit(function(){ var formData = new FormData($(this)[0]); colsole.log(formdata); $.ajax({ url: window.location.pathname, type: 'POST', data: formData, async: false, success: function (data) { alert(data) }, cache: false, contentType: false, processData: false }); return false; });
has comment: http://stackoverflow.com/comment/43352988
has comment: http://stackoverflow.com/comment/43352082
type: Answer
has comment: http://stackoverflow.com/comment/43371435
score: 2
upvote count: 2
answers question: http://stackoverflow.com/q/27437768
has comment: http://stackoverflow.com/comment/43371282
has comment: http://stackoverflow.com/comment/43316053
has comment: http://stackoverflow.com/comment/43351202
has comment: http://stackoverflow.com/comment/43351953
has comment: http://stackoverflow.com/comment/43354767
has comment: http://stackoverflow.com/comment/43351181

http://stackoverflow.com/q/27352205
has comment: http://stackoverflow.com/comment/43158314
has comment: http://stackoverflow.com/comment/43158442
has title: How to find the difference between two hours in java
score: 0
has comment: http://stackoverflow.com/comment/43158335
tagged with: java
answer count: 0
has body: Im trying to find the difference between two given hours. Such as if it were 1 pm and 10 pm the difference would b 9. I can already do this if it were in the same afternoon or both times in the morning. But What I cant figure out how do do is find the difference between two numbers in the seperate AM and PM. I fooled around and came up with this. if(AmPm1.equalsIgnoreCase("PM")){ time1+=12; } if(AmPm2.equalsIgnoreCase("PM")){ time2+=12; } I works for numbers like 9 AM and 1 pm by adding 12 to the 9 to make it on a 24hr clock and then just subtract them. But what I cant do its with something like 10pm and 2 am. The difference is 4 but if I try my method the difference is much higher. All replies will help.
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/5113557
has comment: http://stackoverflow.com/comment/43158287
type: Question
tagged with: time
has comment: http://stackoverflow.com/comment/43158774

http://stackoverflow.com/q/27452900
tagged with: arraylist
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/27452955
possible better answer: http://stackoverflow.com/a/27452986
has answer: http://stackoverflow.com/a/27452986
has title: Using indexOf on ArrayList of type Long returns -1, despite the object existing within the list
type: Question
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27452955
tagged with: java
has body: I'm trying to retrieve the index of a certain Long value that is stored in an ArrayList. But here's what's happening: dex is assigned a value of -1 - which I understand means that the object doesn't exist within that arraylist. But as a matter of fact, it does. Here's how I know: So the value dex should be assigned is 0. Where am I messing up? Edit : nums is also an arraylist of type Long.
has answer: http://stackoverflow.com/a/27453224
answer count: 3

http://stackoverflow.com/comment/43348226
has text: In this case it looks like you get a *compiler error* as opposed to things in the GUI not showing like you expect. Just add `int i;` on a separate line before the first for-loop. In Java you need to declare a variable and its type before you can use it.
type: QuestionComment
comment on: http://stackoverflow.com/q/27455126
type: Comment
score: 0

http://stackoverflow.com/comment/43207043
type: AnswerComment
comment on: http://stackoverflow.com/a/27378419
type: Comment
has text: true, my complete idea was to make a change, and lean on javaw.exe without the full path, edited in an answer
score: 0

http://stackoverflow.com/q/27352872
score: 1
tagged with: java
tagged with: selenium
has answer: http://stackoverflow.com/a/27393463
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/45569058
downvote count: 0
has answer: http://stackoverflow.com/a/45569058
accepted answer: http://stackoverflow.com/a/27393463
has body: I have recently added this code into my testng.xml &lt;listeners&gt; &lt;listener class-name="org.uncommons.reportng.HTMLReporter"/&gt; &lt;listener class-name="org.uncommons.reportng.JUnitXMLReporter"/&gt; &lt;/listeners&gt; I am using the following jar files velocity-dep-1.4.jar reportng-1.1.4.jar guice-3.0.jar it is giving me the following error org.testng.TestNGException: java.lang.NullPointerException at org.testng.TestNG.initializeSuitesAndJarFile(TestNG.java:341) at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:88) at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204) at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175) Caused by: java.lang.NullPointerException at org.testng.xml.TestNGContentHandler.xmlListeners(TestNGContentHandler.java:356) at org.testng.xml.TestNGContentHandler.endElement(TestNGContentHandler.java:704) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source) at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.endNamespaceScope(Unknown Source) I added the above listener in hope to make customized reports I have added jar files of reportng in the eclipse classpath? so how can i fix the error? do I add the the jar files somewhere else?
has title: org.testng.TestNGException:NullPointerException while making a customized reports by reportng
favorite count: 0
tagged with: maven
upvote count: 1
tagged with: testng
type: AnsweredQuestion
tagged with: reportng

http://stackoverflow.com/a/27472145
has body: I think you need to try: String s = this.map.get(paramString).toString(); instead of String s = ((String)this.map.get(paramString))
score: 0
type: AcceptedAnswer
type: Answer
answers question: http://stackoverflow.com/q/27472118
accepted answer of: http://stackoverflow.com/q/27472118

http://stackoverflow.com/q/27318242
has answer: http://stackoverflow.com/a/27319803
has answer: http://stackoverflow.com/a/29039570
downvote count: 0
has title: marshaling java objects instantiated from classes which implement interfaces with JAXB
favorite count: 0
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/43098725
tagged with: interface
has comment: http://stackoverflow.com/comment/43098304
accepted answer: http://stackoverflow.com/a/27319803
has body: How can we marshal objects into XML files using JAXB when we use interfaces for our classes? I have the following simple classes: public interface IBook { public abstract String getName(); public abstract void setName(String name); } @XmlRootElement public class Book implements IBook { private String name; @Override @XmlElement(name ="BookTitle") public String getName() { return name; } @Override public void setName(String name) { this.name = name; } } @XmlRootElement public class BookStore { @XmlElement(name ="BookStoreName") public String name; @XmlElementWrapper(name ="bookList") @XmlAnyElement public HashSet&lt;IBook&gt; books= new HashSet&lt;IBook&gt;(); } and when I try to marshal an object from BookStore into an XML file, I get the following error: [com.sun.istack.internal.SAXException2: Weder class de.uni_paderborn.books.Book noch eine der zugehörigen Superklassen ist diesem Kontext bekannt. javax.xml.bind.JAXBException: Weder class de.uni_paderborn.books.Book noch eine der zugehörigen Superklassen ist diesem Kontext bekannt.] Sorry for the German error message, but my OS is German. This means that neither the class Book nor one of its superclasses is known in this context! Why do I get such an error?
answer count: 4
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
has answer: http://stackoverflow.com/a/27318529
tagged with: jaxb
tagged with: eclipse
type: Question
has comment: http://stackoverflow.com/comment/43098802
has answer: http://stackoverflow.com/a/39328558
possible better answer: http://stackoverflow.com/a/27318529

http://stackoverflow.com/comment/43246482
has text: I use Eclipse Kepler.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27399271
type: Comment

http://stackoverflow.com/q/27411885
tagged with: netbeans
has body: I am creating a new EJB project with beans that are used in another simple project. I am using NetBeans 7.4 with Glassfish 4.0. Here are my Interface and implementation for the EJB project : DbBeanInt.java package com.ejb; import javax.ejb.Remote; @Remote public interface DbBeanInt { public void test(String asd); } DbBean.java package com.ejb; import javax.ejb.*; @Stateless(name = "DbBean", mappedName="B") @Remote public class DbBean implements DbBeanInt{ @Override public void test(String asd) { System.out.println(asd); } } And here is the code where I am calling it. I included in this project's library the EJB project. package bookstoreclient; import com.ejb.DbBeanInt; import javax.ejb.EJB; public class BookStoreClient { @EJB private static DbBeanInt db; public static void main(String[] args) { db.test("Test"); } } However when I run this application I get : Exception in thread "main" java.lang.NullPointerException at bookstoreclient.BookStoreClient.main(BookStoreClient.java:12) Is there something else that should be included?
tagged with: java
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/28355366
tagged with: glassfish
score: 0
has comment: http://stackoverflow.com/comment/43268324
answer count: 1
type: UnansweredQuestion
tagged with: ejb-3.2
has title: How to create a Remote EJB Bean using Glassfish 4?

http://stackoverflow.com/a/27355825
has comment: http://stackoverflow.com/comment/43164400
answers question: http://stackoverflow.com/q/27355790
type: AcceptedAnswer
has body: Try something like this: { /* * Scope is restricted to the block with '{}' braces */ String tmp; if ((tmp = functionWithALotOfProcessingTime()) != null) { // tmp is valid in this scope // do something with tmp } } tmp = "out of scope"; // Compiler Error - Out of scope (Undefined)
has comment: http://stackoverflow.com/comment/43164518
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43164446
accepted answer of: http://stackoverflow.com/q/27355790
has comment: http://stackoverflow.com/comment/43184176
upvote count: 2

http://stackoverflow.com/q/27382722
answer count: 5
tagged with: addition
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27383027
has body: I have the following code: public class Router { private Iterable&lt;Route&gt; routes; public Router(Iterable&lt;Route&gt; routes) { this.routes = routes; } public void addRoute(Route route) { routes.add(route);\\problem is here } } I highlighted the line which is not working. Here I try to add a new object to the routes. In main file routes are: public class RouterMain { public static void main(String[] arg) throws IllegalArgumentException { List&lt;Route&gt; routes = new ArrayList&lt;Route&gt;(); Router router = new Router(routes); } } The task is to add an object in iterable object in Router class. As I understood Iterable can iterate, not add something. So what should I do, convert routes in Router class to a List, add an element and go back?
tagged with: java
possible better answer: http://stackoverflow.com/a/27382808
has answer: http://stackoverflow.com/a/27382935
has answer: http://stackoverflow.com/a/27382865
type: Question
has comment: http://stackoverflow.com/comment/43214167
has title: add element to iterable in java
score: 5
upvote count: 5
downvote count: 0
tagged with: iterable
has answer: http://stackoverflow.com/a/27382835
has answer: http://stackoverflow.com/a/27382808
favorite count: 0
accepted answer: http://stackoverflow.com/a/27383027

http://stackoverflow.com/q/27459199
tagged with: object
has comment: http://stackoverflow.com/comment/43355572
has comment: http://stackoverflow.com/comment/43355188
tagged with: arrays
has comment: http://stackoverflow.com/comment/43355234
downvote count: 0
score: 1
favorite count: 0
type: UnansweredQuestion
has body: Basically, I've got to make a text editing software that will have multiple users that can work with the documents created in the application. The application runs and whoever is controlling the application will introduce the amount of users that he wants to create (as many as the he feels like), and the amount of documents to create as well. From there, a menu will appear to edit the text and blah blah blah... (I have the menu part done an working). There will be 6 classes (including Main). Editor, SharedDocs, UserDocs, Document and TempDoc. How they work is, the Main instance creates an object of the Editor, the Editor creates two objects, SharedDocs and UserDocs. And each one of those will create as many objects as necessary from the two remaining (SharedDocs will create Document AND UserDocs will create TempDoc). Each Document instance has a name and a number of users that can use it... I would post a picture but I don't have enough reputation... My question is how can I link the classes (using arrays or so) in a way that I don't use array in the Main and/or Editor classes?
has comment: http://stackoverflow.com/comment/43362975
has title: Linking multiple classes with each other (Objects)
answer count: 0
tagged with: java
upvote count: 1
type: Question

http://stackoverflow.com/q/27438481
has comment: http://stackoverflow.com/comment/43318178
has comment: http://stackoverflow.com/comment/43318397
has comment: http://stackoverflow.com/comment/43318676
type: Question
upvote count: 1
answer count: 1
has body: I'm working on using the Google Analytics Management API for Filter Update. I have been trying to use this method to update my filter, but apparently it does not work. Below is a snippet of my update code: private static void updateFilter(Analytics analytics, String accountID) { FilterExpression details = new FilterExpression(); details.setField("GEO_DOMAIN"); details.setMatchType("EQUAL"); details.setExpressionValue(".example.com"); details.setCaseSensitive(false); // Construct the body of the request. Filter body = new Filter(); body.setName("My Domain Filter"); body.setType("EXCLUDE"); body.setExcludeDetails(details); try { analytics.management().filters().update("&lt;valid GA ID&gt;", "&lt;valid filter ID&gt;", body).execute(); } catch (GoogleJsonResponseException e) { System.err.println("There was a service error: " + e.getDetails().getCode() + " : " + e.getDetails().getMessage()); } catch (IOException ioEx) { ioEx.printStackTrace(); } The error code I'm getting is 400 : Field id is required. To my knowledge, everything that is required of a filter has been initialized in the method. I do not know what "Field id is required" is supposed to mean. Thanks for any help rendered.
favorite count: 0
downvote count: 0
has title: Google Analytics Java API Filter Update error
has comment: http://stackoverflow.com/comment/43318345
has answer: http://stackoverflow.com/a/27438954
accepted answer: http://stackoverflow.com/a/27438954
tagged with: google-analytics-api
has comment: http://stackoverflow.com/comment/43318232
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/a/27447675
downvote count: 0
has comment: http://stackoverflow.com/comment/43337566
has comment: http://stackoverflow.com/comment/43335134
answers question: http://stackoverflow.com/q/27447479
type: Answer
upvote count: 1
has comment: http://stackoverflow.com/comment/43334375
score: 1
has body: Instead of just adding the JLabels to a panel, you need to store them in class level members. When you click a button, you need to change the text in the existing labels. Near this: public static int STR = 0, aPower = 0, sPower = 0, INT = 0, STA = 0, DEF = 0; Add private JLabel strLabel; Then panel.add(new JLabel("Strength " + STR)); becomes strLabel = new JLabel("Strength " + STR); panel.add(strLabel); Now you can change the text of strLabel from somewhere else.

http://stackoverflow.com/q/27406960
has comment: http://stackoverflow.com/comment/43259454
has comment: http://stackoverflow.com/comment/43258648
has body: I'm having trouble with ehcache trying to cache a table which is bigger than the storage I set to it. Although the application do not fail (because it end up performing the query in the database and returning the data) my log is getting full of ClassCastException. I don't want to change the settings because it will happen again, I'd like to catch the ClassCastException but it did not work. (I tried filtering the exception with a seam component and at a specific point where the exception is thown) Versions are: Seam 2.2.2, Hibernate 3.3.3 and ehCache 1.5 ERROR [user:] [DiskStore.java/get] – com.milestone.model.PersonItemCache: Could not read disk store element for key com.milestone.model.PersonItem#438480. Error was net.sf.ehcache.Element cannot be cast to net.sf.ehcache.Element java.lang.ClassCastException: net.sf.ehcache.Element cannot be cast to net.sf.ehcache.Element at net.sf.ehcache.store.DiskStore.loadElementFromDiskElement(DiskStore.java:302) at net.sf.ehcache.store.DiskStore.get(DiskStore.java:257) at net.sf.ehcache.Cache.searchInDiskStore(Cache.java:1202) at net.sf.ehcache.Cache.get(Cache.java:803) at org.hibernate.cache.EhCache.get(EhCache.java:80) at org.hibernate.cache.ReadWriteCache.put(ReadWriteCache.java:178) at org.hibernate.cache.impl.bridge.EntityAccessStrategyAdapter.putFromLoad(EntityAccessStrategyAdapter.java:68) at org.hibernate.engine.TwoPhaseLoad.initializeEntity(TwoPhaseLoad.java:179) at org.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:877) at org.hibernate.loader.Loader.doQuery(Loader.java:752) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:259) at org.hibernate.loader.Loader.loadCollection(Loader.java:2019) at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:59) at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:587) at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onIniti…
answer count: 1
favorite count: 0
tagged with: ehcache
has answer: http://stackoverflow.com/a/27407092
tagged with: exception
tagged with: classcastexception
accepted answer: http://stackoverflow.com/a/27407092
type: AnsweredQuestion
tagged with: seam
tagged with: java
has title: Trying to catch ehcache Element ClassCastException
downvote count: 1
type: Question
upvote count: 0
score: -1

http://stackoverflow.com/comment/43124820
comment on: http://stackoverflow.com/a/27332632
has text: I finally found out why my code wasn't working. Problem was that I was using == on equation in both methods. I should have used equals() which i implemented in Vertex2D class. Stupid me :D
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/27330661
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27330828
type: Question
has body: Can anyone answer me,please, where is parallel gc usually is used? I am reading article: http://blog.takipi.com/garbage-collectors-serial-vs-parallel-vs-cms-vs-the-g1-and-whats-new-in-java-8/ And there is "The parallel collector is best suited for apps that can tolerate application pauses and are trying to optimize for lower CPU overhead caused by the collector". But which exact examples can be in this case? Thanks.
upvote count: 1
answer count: 1
favorite count: 0
has title: Where is parallel gc is used?
accepted answer: http://stackoverflow.com/a/27330828
type: AnsweredQuestion

http://stackoverflow.com/a/27421730
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/27399774
type: Answer
upvote count: 4
has comment: http://stackoverflow.com/comment/43394864
has body: There is no direct API to do multi-get. A way of doing this would be call lmap API directly from server multiple time through UDF. Example 'mymap.lua' local lmap = require('ldt/lib_lmap'); function getmany(rec, binname, keys) local resultmap = map() local keycount = #keys for i = 1,keycount,1 do local rc = lmap.exists(rec, binname, keys[i]) if (rc == 1) then resultmap[keys[i]] = lmap.get(rec, binname, keys[i]); else resultmap[keys[i]] = nil; end end return resultmap; end Register this lua file aql&gt; register module 'mymap.lua' OK, 1 module added. aql&gt; execute lmap.put('bin', 'c', 'd') on test.demo where PK='1' +-----+ | put | +-----+ | 0 | +-----+ 1 row in set (0.000 secs) aql&gt; execute lmap.put('bin', 'b', 'c') on test.demo where PK='1' +-----+ | put | +-----+ | 0 | +-----+ 1 row in set (0.001 secs) aql&gt; execute mymap.getmany('bin', 'JSON["b","a"]') on test.demo where PK='1' +--------------------------+ | getmany | +--------------------------+ | {"a":NIL, "b":{"b":"c"}} | +--------------------------+ 1 row in set (0.000 secs) aql&gt; execute mymap.getmany('bin', 'JSON["b","c"]') on test.demo where PK='1' +--------------------------------+ | getmany | +--------------------------------+ | {"b":{"b":"c"}, "c":{"c":"d"}} | +--------------------------------+ 1 row in set (0.000 secs) Java Code to invoke this would be try { resultmap = myClient.execute(myPolicy, myKey, 'mymap', 'getmany', Value.get(myLDTBinName), Value.getAsList(myRequiredKeysFromLDTBin) } catch (Exception e) { log.warn("One of the key does not exist in LDT bin"); } Value will be set if key exists and it would return NIL if it does not.

http://stackoverflow.com/comment/43148387
has text: what does scanner.next do?
comment on: http://stackoverflow.com/q/27344693
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27407063
type: Question
has answer: http://stackoverflow.com/a/27407268
tagged with: arrays
has title: Digit Extractor
has body: Problem: The method has one parameters an integer. Break the integer into a sequence of individual digits in reverse order. The result will be an array containing the individual numbers in reverse order. Tester: digitExtractor(16384) → {4, 8, 3, 6, 1} digitExtractor(123) → {3, 2, 1} digitExtractor(23) → {3, 2} digitExtractor(-123) → {-1, 2, 3} (I have a problem with this one) public int[] digitExtractor(int number) { int[] arr; ArrayList&lt;Integer&gt; digits = new ArrayList&lt;Integer&gt;(); if(number == 0) { digits.add(number); } if(number &lt; 0) { number *= -1; } while (number != 0) { digits.add(number % 10); number /= 10; } arr = new int[digits.size()]; for(int i = 0; i &lt; digits.size(); i++) { arr[i] = digits.get(i); } return arr; } My code works, except for the negative number. I don't know how to fix it. Any tips?
tagged with: arraylist
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/43258878
has comment: http://stackoverflow.com/comment/43261096
type: UnansweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27408003

http://stackoverflow.com/comment/43172131
score: 0
type: Comment
has text: Possibly encoding the url parameters so they become unreadable is a better option?
type: QuestionComment
comment on: http://stackoverflow.com/q/27359173

http://stackoverflow.com/comment/43248600
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27401888
has text: what doesn't work ? explain... what are the unexpected results you are getting? what are you giving as parameters?
score: 0

http://stackoverflow.com/a/27452969
upvote count: 1
has comment: http://stackoverflow.com/comment/43344393
downvote count: 0
has body: How about "A|B".replace('|', '-'); -- there's no reason to use a RegEx here.
type: Answer
answers question: http://stackoverflow.com/q/27452920
score: 1

http://stackoverflow.com/q/27325803
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27325879
has title: how to call length, width, height, area, volume of a box from box class using boxTest
score: 0
has answer: http://stackoverflow.com/a/65365191
has answer: http://stackoverflow.com/a/27325852
has body: I am writing a code to measure the surface area of a box and volume of the box. Finally, I got it to works. Now the challenges are I have to make 4 object and and store it into array and then use enhanced for loop to go through each box in the array. I mean when you loop through the array, it will get to first box, and ask you to enter the length, width, and height. Then it will show you the first box's length, width, height, surface area, and volume. I try to find an example for it but I cant find anything. I am still trying to make it work. Thank you for your help. here is my Box code. public class Box { private double length = 1.0; private double width = 1.0; private double height = 1.0; //constructor public Box (double l, double w, double h) { setLength(l); setWidth(w); setHeight(h); } //set length method public void setLength(double l) { if(l &gt; 0) { length = l; } else { length = 1.0; } } //set width method public void setWidth(double w) { if(w &gt; 0) { width = w; } else { width = 1.0; } } //set height method public void setHeight(double h) { if(h &gt; 0) { height = h; } else { height = 1.0; } } //calculate area method public double calculateArea(double length, double width) { return (length*width); } //calculate volume method public double calculateVolume(double length, double width, double height) { return (length*width*height); } //get length method public String getLength() { return String.format("%f", length); } //get width method public String getWidth() { return String.format("%f",width); } //get height public String getHeight() { return String.format("%f",height); } public String toString() { return String.format("Length is %s.\nWidth is %s.\nHeight is %s.\n", getLength(), getWidth(), getHeight()); } } and here is my main code import java.util.Scanner; public class BoxTest { public static void main(String[] args) { //Box boxOne, boxTwo, boxThree, boxFour; double l; double w; double h; Scanner input = new Scanner(System.in); int[] boxes = new int[4]; …
type: UnansweredQuestion
answer count: 4
linked to: http://stackoverflow.com/q/13252318
has answer: http://stackoverflow.com/a/27325827

product
tags question: http://stackoverflow.com/q/27354476
type: Tag
tag name: product

http://stackoverflow.com/q/27434553
type: Question
answer count: 2
tagged with: arrays
tagged with: histogram
has answer: http://stackoverflow.com/a/27434700
score: 0
has answer: http://stackoverflow.com/a/27434656
has title: Creating a histogram array
tagged with: frequency
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43310019
has body: So I need to create a histogram that shows the results of the sum of the rolls of 4 dice. The program takes the total of the dice each time it rolls. I need to create a histogram of the frequency of each number in the dice roll loop. here is my code: import java.util.Scanner; import java.util.Random; import java.util.Scanner; import java.lang.Math; public class DieSimulator { public static void main(String[] args) { Die d1 = new Die(6); Die d2 = new Die(6); Die d3 = new Die(6); Die d4 = new Die(6); int roll = 100; int [] rolls = new int[roll]; int four = 0; int five = 0; int six = 0; int seven = 0; int eight = 0; int nine = 0; int ten = 0; int eleven = 0; int twelve = 0; int thirteen = 0; int fourteen = 0; int fifteen = 0; int sixteen = 0; int seventeen = 0; int eighteen = 0; int nineteen = 0; int twenty = 0; int twentyone = 0; int twentytwo = 0; int twentythree = 0; int twentyfour = 0; for (int i=0; i &lt; rolls.length; i++) { int n1 = d1.cast(); //System.out.print(n1 + ""); int n2 = d2.cast(); //System.out.print(n2 + ""); int n3 = d3.cast(); //System.out.print(n3 + ""); int n4 = d4.cast(); int sum = n1 + n2 + n3 + n4; if (sum == 4) four++; if (sum == 5) five++; if (sum == 6) six++; if (sum == 7) seven++; if (sum == 8) eight++; if (sum == 9) nine++; if (sum == 10) ten++; if (sum == 11) eleven++; if (sum == 12) twelve++; if (sum == 13) thirteen++; if (sum == 14) fourteen++; if (sum == 15) fifteen++; if (sum == 16) sixteen++; if (sum == 17) seventeen++; if (sum == 18) eighteen++; if (sum == 19) nineteen++; if (sum == 20) twenty++; if (sum == 21) twentyone++; if (sum == 22) twentytwo++; if (sum == 23) twentythree++; if (sum == 24) twentyfour++; System.out.println("Total Dice roll: " + sum); System.out.println(twenty); } int[] histogram = new int[20]; System.out.print(histogram); } } What code do I use to create the histogram?
has comment: http://stackoverflow.com/comment/43309977
tagged with: java

http://stackoverflow.com/comment/43220490
type: Comment
type: QuestionComment
has text: _when it works when i type that very line into a browser?_ Yes i did. hm ok ill try with the user agent
comment on: http://stackoverflow.com/q/27386121
score: 0

http://stackoverflow.com/comment/43307743
type: QuestionComment
comment on: http://stackoverflow.com/q/27424728
has text: Try to avoid that the server is running in multiple instances, each with a new port. Shutdown all unnecessary. At deploy the information that a new instance is created show you the next new port. The first server starts with port 8080 then incremented by 1. The port 8084 shows that running 5 instances. Where now to pick the debug values? Netbeans : go to server tab and shutdown all servers , end and restart debugging again.
score: 0
type: Comment

http://stackoverflow.com/q/27470278
type: UnansweredQuestion
type: Question
tagged with: spring-mvc
has answer: http://stackoverflow.com/a/33086226
has body: Now I have following controller method: @RequestMapping(value = "/member/createCompany/uploadImage", method = RequestMethod.POST) @ResponseBody public ResponseEntity&lt;String&gt; handleFileUpload(@RequestParam("file") MultipartFile file, Principal principal) { .... I wan to validate file name of MultipartFile file that file exyension was .jpg I want to have approximately following header : public ResponseEntity&lt;String&gt; handleFileUpload(@RequestParam("file") @Validated(DotJpg.class) MultipartFile file, Principal principal) { Is it possible to achieve?
tagged with: java
score: 0
tagged with: validation
has title: spring mvc multipartfile extension validation using hibernate validator
answer count: 1
tagged with: hibernate-validator

http://stackoverflow.com/comment/43319936
type: Comment
comment on: http://stackoverflow.com/a/27440107
score: 0
type: AnswerComment
has text: Is that the same thing if I put into the condition as (x!=0)?

http://stackoverflow.com/q/27457052
has comment: http://stackoverflow.com/comment/43351358
has comment: http://stackoverflow.com/comment/43351419
answer count: 2
has answer: http://stackoverflow.com/a/57242224
has comment: http://stackoverflow.com/comment/43351407
downvote count: 0
tagged with: applet
favorite count: 0
has body: My file is 1.txt and I want to open it using java such that on pressing a button, that file should open up!! Is there any command through actionlistener to open the file and patch it with the button?? This is my simple applet program in java.. import java.awt.*; import java.applet.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedWriter; import java.io.FileWriter; import java.io.PrintWriter; import java.util.Scanner; import java.util.logging.Level; import java.util.logging.Logger; public class CalculatorApplet extends Applet implements ActionListener { Button save, view; Label fname, lname, email, city, phno; TextField t, u, v, w, x; Label ans; Scanner sc = new Scanner(System.in); @Override public void init() { setLayout(null); // create label to display enter no fname = new Label("Enter First Name : "); fname.setBounds(10, 50, 100, 20); lname = new Label("Enter Last Name : "); lname.setBounds(10, 70, 100, 20); email = new Label("Enter Email : "); email.setBounds(10, 90, 80, 20); city = new Label("Enter City : "); city.setBounds(10, 110, 80, 20); phno = new Label("Enter Phno : "); phno.setBounds(10, 130, 80, 20); // create textbox for entering number t = new TextField(); t.setBounds(120, 50, 200, 20); u = new TextField(); u.setBounds(120, 70, 100, 20); v = new TextField(); v.setBounds(120, 90, 200, 20); w = new TextField(); w.setBounds(120, 110, 80, 20); x = new TextField(); x.setBounds(120, 130, 80, 20); // create button for finding sqr save = new Button("Save"); save.setBounds(120, 150, 70, 30); // add the action listner on this button save.addActionListener(this); // create button view = new Button("View"); view.setBounds(190, 150, 70, 30); // add the action listner on this button view.addActionListener(this); // add all the components to the frame add(fname); add(lname); add(email); add(city); add(phno); add(t); add(u); add(v); add(w); add(x); add(save); add(view); } @Override public void actionPerformed(ActionEve…
has title: I want to open a file just with one click of button in java in a new window
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43371682
upvote count: 2
has answer: http://stackoverflow.com/a/27457103
possible better answer: http://stackoverflow.com/a/57242224
accepted answer: http://stackoverflow.com/a/27457103
type: Question
has comment: http://stackoverflow.com/comment/43351336
tagged with: java
has comment: http://stackoverflow.com/comment/43351299
has comment: http://stackoverflow.com/comment/43384052

http://stackoverflow.com/a/27380243
upvote count: 1
has comment: http://stackoverflow.com/comment/43210320
downvote count: 0
has comment: http://stackoverflow.com/comment/43210044
has comment: http://stackoverflow.com/comment/43210460
answers question: http://stackoverflow.com/q/27380093
has comment: http://stackoverflow.com/comment/43210114
type: Answer
has comment: http://stackoverflow.com/comment/43209921
has comment: http://stackoverflow.com/comment/43210141
has comment: http://stackoverflow.com/comment/43209749
score: 1
has body: Try this expression: //Code/Tags[contains(., 'Java')]/../Snippet
has comment: http://stackoverflow.com/comment/43210325

http://stackoverflow.com/q/27468963
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43373154
tagged with: simpledateformat
tagged with: java
score: -1
downvote count: 2
upvote count: 1
answer count: 1
has answer: http://stackoverflow.com/a/27468984
accepted answer: http://stackoverflow.com/a/27468984
has comment: http://stackoverflow.com/comment/43373394
tagged with: android
favorite count: 0
tagged with: android-calendar
has body: I have the following code: String s = "08-12-2014 05:00:00" SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.ENGLISH); SimpleDateFormat outputFormat = new SimpleDateFormat("EEEE, HH:mm a"); Date oneWayTripDate = null; try { oneWayTripDate = inputFormat.parse(s); } catch (ParseException e) { e.printStackTrace(); } String datetime = outputFormat.format(oneWayTripDate); but for some weird reason it always returns the wrong day of the week. what am i doing wrong?
has title: Android SimpleDateFormat always returns wrong week day
has comment: http://stackoverflow.com/comment/43373176
tagged with: timestamp
type: Question

http://stackoverflow.com/comment/43151687
has text: Oh, I misunderstood. I think Tavian's commments sound reasonable for your requirements, try it out. If that doesn't work, assuming you had some other scope aware injectable state variable, you could make your provider switch based on that by injecting it as a provider parameter, but that sounds pretty ugly.
type: Comment
comment on: http://stackoverflow.com/a/27340043
score: 0
type: AnswerComment

http://stackoverflow.com/comment/56547005
has text: With public ports you pretty much have to use reverse proxies or manage the random port assignment yourself somehow. Rancher.io provides reverse proxy through its load balancers. There are potentially other reverse proxy solutions as well.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27408999
type: Comment

http://stackoverflow.com/comment/43175272
has text: Are two different projects?
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27361112

http://stackoverflow.com/q/27471141
upvote count: 4
type: AnsweredQuestion
has title: GCM: How to send heartbeat to GCM server
has body: I want to send a heartbeat from my application to the GCM server, so the connection will stay alive. How can I do that, and how can I know the URL of my GCM server?? Thanks in advance!!
tagged with: heartbeat
has answer: http://stackoverflow.com/a/27471347
accepted answer: http://stackoverflow.com/a/27471347
type: Question
tagged with: java
score: 4
downvote count: 0
answer count: 1
favorite count: 0
tagged with: android
tagged with: google-cloud-messaging

http://stackoverflow.com/q/27446315
score: 1
tagged with: java
has body: I'm struggling with this architectural problem on my Parse.com document. I have the following "schema", called Debit : "createdAt": "2014-12-12T02:31:06.026Z", "creator": { "__type": "Pointer", "className": "_User", "objectId": "objectId" }, "date": { "__type": "Date", "iso": "2014-12-12T02:31:14.437Z" }, "debitStatus": 0, "description": "Gdfvgg", "from": { "__type": "Pointer", "className": "_User", "objectId": "Sd9B1XyZVL" }, "has_accepted": false, "objectId": "objectId", "to": { "__type": "Pointer", "className": "_User", "objectId": "objectId" }, "updatedAt": "2014-12-12T06:00:46.528Z", "value": "6.48" The from and to "columns" are pointers to _User table. The problem is, in my Android app I'd like to display both from and to debits according to the Logged User, but on my adapter only show the "not logged user" user. I tried doing an or query on Parse to get all the debits queries but I can't include the User pointer because on or queries Parse doesn't support. Like this: ParseQuery&lt;ParseObject&gt; query1 = new ParseQuery&lt;ParseObject&gt;("UserBalance"); query1.whereEqualTo("user_from", ParseUser.getCurrentUser()); ParseQuery&lt;ParseObject&gt; query2 = new ParseQuery&lt;ParseObject&gt;("UserBalance"); query2.whereEqualTo("user_to", ParseUser.getCurrentUser()); ParseQuery&lt;ParseObject&gt; query = ParseQuery.or(Arrays.asList(query1, query2)); But the problem is when showing the "not me" adapter: Adapter: ParseUser user = null; ParseUser user1 = (ParseUser) object.get("user_to"); if (user1 == ParseUser.getCurrentUser()) user = (ParseUser) object.get("user_from"); else user = user1; Of course I need to fetch the user, which in the adapter is not a good idea. So, is there a better approach on the Database side to improve this ? Thanks
type: Question
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27595733
favorite count: 0
tagged with: android
tagged with: nosql-aggregation
tagged with: parse-platform
accepted answer: http://stackoverflow.com/a/27595733
has title: Architectural from-to relation NoSql
upvote count: 1
has comment: http://stackoverflow.com/comment/43615144
tagged with: nosql
type: AnsweredQuestion

meta-inf
tag name: meta-inf
tags question: http://stackoverflow.com/q/27473400
type: Tag

http://stackoverflow.com/a/27343690
score: 0
has body: The == operator compares the object references, not the value of the Strings. To compare the values of Strings, use the String.equals method: if (passcodes[i].equals(passcode)) {...}
type: Answer
answers question: http://stackoverflow.com/q/27343246

http://stackoverflow.com/q/27364260
type: Question
has answer: http://stackoverflow.com/a/27364804
has comment: http://stackoverflow.com/comment/43180792
has answer: http://stackoverflow.com/a/27364560
tagged with: arrays
tagged with: class
score: 0
has title: Trouble creating an instance of a class in java
answer count: 3
has comment: http://stackoverflow.com/comment/43180409
has comment: http://stackoverflow.com/comment/43180420
has body: I am struggling with making this code work. Here is my code. First class: public class PersonalAccount extends Account{ private String cardNumber; private String cardType; public ArrayList&lt;PersonalAccount&gt; personalAccounts; public int personal; private PersonalAccount(String first, String last, String accountNumber, String cardNumber, String cardType){ super(first, last, accountNumber); this.cardNumber = ""; this.cardType = ""; } public void addPersonalAccount(PersonalAccount aPersonalAccount){ personalAccounts.add(aPersonalAccount); } public void getNumberOfPersonalAccounts(){ personal = personalAccounts.size(); } public void listAccounts(){ for (PersonalAccount personalaccount : personalAccounts){ System.out.println("Personal Accounts"); System.out.println(personalaccount); } } public void findAccount(){ int index = 0; boolean found = false; while(index &lt; personalAccounts.size() &amp;&amp; !found){ PersonalAccount personalaccount = personalAccounts.get(index); if (personalaccount.getaccountNumber().equals(accountNumber)){ found = true; }else{ index++; } } } } When attempting to create an instance of this class in another class, it instead creates an instance of the PersonalAccount object. Is there a way around this issue? I am very new to Java and BlueJ it should be noted. EDIT: sorry I should clarify. I'm trying to call the methods from this class in another class. But when declaring PersonalAccount class1 = new PersonalAccount(); I get the error: constructor PersonalAccount in class PersonalAccount cannot be applied to given types. I am trying to call the method on a button click (where numAcc is the button): numAcc.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { int personal; personal = class1.getNumberOfPersonalAccounts(); } });
has comment: http://stackoverflow.com/comment/43180465
has comment: http://stackoverflow.com/comment/43180400
has comment: http://stackoverflow.com/comment/43180402
has answer: http://stackoverflow.com/a/27364528
has comment: http://stackoverflow.com/comment/43180858
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43181527
tagged with: instance
tagged with: java

http://stackoverflow.com/comment/43315909
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27437609
has text: After further investigation if I remove this tag - <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> then the page looks normal again, what is wrong with that tag?
score: 0

http://stackoverflow.com/comment/43129063
type: QuestionComment
has text: Some might wonder why there is a `new String()` in your `println`
score: 0
comment on: http://stackoverflow.com/q/27336073
type: Comment

http://stackoverflow.com/q/27352497
favorite count: 0
has title: How to pass HashMap value to list
has answer: http://stackoverflow.com/a/27352600
type: UnansweredQuestion
tagged with: dictionary
tagged with: list
has answer: http://stackoverflow.com/a/27354104
score: 1
tagged with: java
upvote count: 1
type: Question
answer count: 2
tagged with: hashmap
downvote count: 0
has comment: http://stackoverflow.com/comment/43159263
has comment: http://stackoverflow.com/comment/43158763
has body: How to pass hashmap value to List Entry is of type String key and value? Page Class: public List&lt;Entry&gt; entry; public void setEntry(final List&lt;Entry&gt; entry) { this.entry = entry; this.setInfo(entry); } public void setInfo(final List&lt;Entry&gt; entryList) { this.prop = new HashMap&lt;String, String&gt;(); for (Entry objEntry : this.entry) { this.prop.put(objEntry.getKey(), objEntry.getValue()); } } I have created a map: Map&lt;String, String&gt; info = new HashMap&lt;String, String&gt;(); info.put("abc", "123") I tried this: List l = new ArrayList(info.values()); page.setInfo(list); // I am getting class cast exception
has comment: http://stackoverflow.com/comment/43161363

http://stackoverflow.com/comment/43379864
type: AnswerComment
has text: Well, that's something. But it should go all the way till the end of the 'screen'.
type: Comment
comment on: http://stackoverflow.com/a/27472654
score: 0

http://stackoverflow.com/q/27440029
possible better answer: http://stackoverflow.com/a/27440126
has answer: http://stackoverflow.com/a/27440126
accepted answer: http://stackoverflow.com/a/27440108
answer count: 3
score: 0
tagged with: java
tagged with: comments
tagged with: eclipse
linked to: http://stackoverflow.com/q/1024886
has answer: http://stackoverflow.com/a/27440099
duplicate of: http://stackoverflow.com/q/1024886
has body: I like how Eclipse IDE indents my source code but I would like to keep my comments intact. How do I make Eclipse not touch comments in Java source code? I am using Eclipse Luna.
has answer: http://stackoverflow.com/a/27440108
has title: How do I make Eclipse to not indent comments?
type: Question
type: AnsweredQuestion

http://stackoverflow.com/a/27419387
score: 0
answers question: http://stackoverflow.com/q/27419308
has comment: http://stackoverflow.com/comment/43281826
has body: Batch files with the extension .bat have nothing to do with Java. They are Windows-specific shell scripts, introduced with MS-DOS in 1981.
has comment: http://stackoverflow.com/comment/43281914
type: Answer

http://stackoverflow.com/comment/44098362
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27409887
has text: I have a similar problem, it also dies on TaskBar.createHandle. Were you able to find a solution or what the problem may be? It just started happening, before the system was working correctly.

http://stackoverflow.com/q/27348032
tagged with: java
linked to: http://stackoverflow.com/q/27258043
type: Question
score: 0
tagged with: layout
answer count: 1
tagged with: android
has title: Android relative layout with different screens
has body: and thanks in advance. I am currently developing a game based on words, and for that purpose I have designed a custom keyboard as a relative layout. At the moment, I am designing different resources for different screen sizes. So I have made different size resources for hdpi, mdpi and ldpi. The keyboard works excellent for hdpi screens, but it is displayed incorrectly for mdpi and ldpi screens(more so for ldpi screens). Here are the images which best describe this problem: hdpi screen:(240 dpi, 480x800) http://pokit.org/get/?63036a53e89f5ea526a115177fc404e8.jpg ldpi screen:(120 dpi, 240x320) http://pokit.org/get/?612ec561ff10fdf49cf598d170a0e672.jpg As you can see, some of the images are larger and some are smaller even though they are all the same image(except for the "enter" key). I cannot undestand why this happens. Here is the code of the keyboard(it is designed as a custom control). http://pastebin.com/QJndxdex LDPI image is 20x29 px, hdpi image is 47x69. EDIT: http://pastebin.com/a6dGdyay I am posting pastebin since the code is long. Apparently, the first 5 letters are englarged for some reason, all others are displayed correctly.
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27348117

http://stackoverflow.com/a/27395821
has body: String.replace(CharSequence, CharSequence) as suggested in Alexei Levenkov's answer is the way to go if you want to replace a string with another string literally. For the sake of completeness, if you want to do literal string replacement with replaceAll, you need to quote both the pattern string and the replacement string, so that they are treated literally (i.e. without any special meaning). inputString.replaceAll(Pattern.quote(pattern), Matcher.quoteReplacement(replacement)); Pattern.quote(String) creates a pattern which matches the specified string literally. Matcher.quoteReplacement(String) creates a literal replacement string for the specified string.
type: Answer
answers question: http://stackoverflow.com/q/27394475
score: 0

http://stackoverflow.com/comment/43353750
type: QuestionComment
has text: Please put more effort into formatting your code, as well. Currently the indentation is inconsistent and there's a mountain of vertical whitespace. Additionally, please tell us *where* the error occurs, along with details of the other things you've tried and what went wrong.
score: 1
comment on: http://stackoverflow.com/q/27458361
type: Comment

opencv
type: Tag
tags question: http://stackoverflow.com/q/27338864
tags question: http://stackoverflow.com/q/27380954
tags question: http://stackoverflow.com/q/27393401
tags question: http://stackoverflow.com/q/27459555
tags question: http://stackoverflow.com/q/27346355
tags question: http://stackoverflow.com/q/27346312
tags question: http://stackoverflow.com/q/27460201
tags question: http://stackoverflow.com/q/27347018
tags question: http://stackoverflow.com/q/27375514
tag name: opencv
tags question: http://stackoverflow.com/q/27371151
tags question: http://stackoverflow.com/q/27432256
tags question: http://stackoverflow.com/q/27369577
tags question: http://stackoverflow.com/q/27344741
tags question: http://stackoverflow.com/q/27343030
tags question: http://stackoverflow.com/q/27346517
tags question: http://stackoverflow.com/q/27433261
tags question: http://stackoverflow.com/q/27457248

http://stackoverflow.com/comment/43256027
score: 0
comment on: http://stackoverflow.com/a/27405464
type: Comment
has text: Sure. The point is that there cannot be any "legitimate reason" to avoid an `if statement` (or to override `.put` for that matter). This question only makes any sense at all as a kind of riddle. Like "how do you swap two ints without using a temporary variable?" @dimo414: the thing is that in your answer, the constructor for the `RestrictedString` would need an (equivalent of an) `if` statement anyway. And your first suggestion involves overriding `put` *and* an `if` statement, which are *both* prohibited :)
type: AnswerComment

http://stackoverflow.com/comment/43268062
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27411156
score: 0
has text: @NamedQuery(name = "Users.findXXX", query = "SELECT u FROM User u, IN(u.friends) f where f.verified=1"); Or you can use regular join: "SELECT u FROM User u Join u.friends f where f.verified=1"

http://stackoverflow.com/comment/43268571
score: 0
type: Comment
type: QuestionComment
has text: Then how to access specific data from a list at a time.What are the other methods.
comment on: http://stackoverflow.com/q/27412070

http://stackoverflow.com/comment/43321584
type: QuestionComment
comment on: http://stackoverflow.com/q/27440701
score: 0
has text: Why does it have to register itself as soon as it is constructed? If you say that the producer is actually an independent object, and the singleton only registers to it, why not have a `register()` method?
type: Comment

http://stackoverflow.com/a/27465269
score: 1
has body: Override the stop() method in your Application class public class MyApp extends Application @Override public void start(Stage primaryStage) { // your usual code here } @Override public void stop() { // your shutdown code here } }
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/27464382
downvote count: 0

http://stackoverflow.com/q/27453062
answer count: 1
tagged with: wait
has answer: http://stackoverflow.com/a/27453185
favorite count: 0
has title: Java executors: How to notify a single waiting thread within the executer?
has comment: http://stackoverflow.com/comment/43344556
score: 2
has comment: http://stackoverflow.com/comment/43344694
type: AnsweredQuestion
downvote count: 0
tagged with: multithreading
type: Question
has body: So here is what I'm trying to accomplish: I have a FixedThreadPool with 5 Threads in it. Those threads just sit there and wait to be notified. When notified, the thread within the pool starts to do stuff. Now, whenever some triggering event occurs, one and only one waiting thread within the pool must be notified. Is it possible to accomplish this at all? Here is what I tried, but i get an IllegalMonitorStateException: public class Server { private class WorkerThread implements Runnable{ private Object lock = null; WorkerThread(Object lock){ this.lock = lock; } public void run() { try{ do{ synchronized(lock){ wait(); } // doSomeThing }while(true); } catch (InterruptedException e) { System.out.println(e.getMessage()); } } } private ExecutorService executor = null; private Object lock = new Object(); Server() { executor = Executors.newFixedThreadPool(5); for(int i=0; i&lt;5; i++){ executor.execute(new WorkerThread(lock)); } } public void calledWhenTriggerEventOccurs(){ synchronized(lock) {executor.notify();} } }
tagged with: java
tagged with: executor
tagged with: notify
accepted answer: http://stackoverflow.com/a/27453185
upvote count: 2

twirl
type: Tag
tags question: http://stackoverflow.com/q/27456435
tag name: twirl

http://stackoverflow.com/comment/43405452
has text: public class MyClass extends JFrame { public static void main (String [] args) { //train the neural network and fill chartEpoch & chartBFacts //When trained do the chart i.e. Chart(chartEpoch, chartBFacts); } } //method to create chart //method to create Dataset
comment on: http://stackoverflow.com/a/27483223
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27631155
has comment: http://stackoverflow.com/comment/44433518
upvote count: 1
answers question: http://stackoverflow.com/q/27372242
has comment: http://stackoverflow.com/comment/44443194
type: Answer
downvote count: 0
score: 1
has body: Norconex HTTP Collector is an open source enterprise web crawler that supports crawling of frame and iframe tags out of-the-box. You can also add your own set of tags to be used to extract URLs (e.g., frame.longdesc, video.src, form.action, etc.). You need no programming skills to use this crawler, but since you seem to know your Java, you can also plug your own URL-extraction logic if you prefer. Once you get more familiar with this crawler, I suggest you look up the HtmlLinkExtractor class on the online javadoc for more URL-extracting options.

http://stackoverflow.com/a/27391906
type: Answer
has comment: http://stackoverflow.com/comment/43233161
has comment: http://stackoverflow.com/comment/43231650
downvote count: 1
answers question: http://stackoverflow.com/q/27391634
score: -1
has comment: http://stackoverflow.com/comment/43231946
accepted answer of: http://stackoverflow.com/q/27391634
has comment: http://stackoverflow.com/comment/43233054
upvote count: 0
has comment: http://stackoverflow.com/comment/43232964
has body: Here's a rudimentary implementation of the requirements, for what it's worth. Note that you can get your index into the first level of queueArray by using integer division on your item parameter like so: int whichQueue = item / 100; import java.util.Arrays; public class PriorityQueue { private int[][] queueArray; public PriorityQueue() // constructor { queueArray = new int[3][5]; } public void printQueue() { System.out.println(Arrays.toString(queueArray)); } public boolean isFull(int[] array) { return findEmptySlot(array) &lt; 0; } public boolean enqueue(int item) { if (item &lt; 1 || item &gt; 299) { throw new IllegalArgumentException("item must be between 1 and 299"); } for (int i = item / 100; i &lt; this.queueArray.length; i++) { if (enqueue(item, this.queueArray[i])) { return true; } } return false; } private boolean enqueue(int item, int[] queue) { int emptySlot = findEmptySlot(queue); if (emptySlot &gt;= 0) { queue[emptySlot] = item; return true; } return false; } private int findEmptySlot(int[] queue) { for (int i = 0; i &lt; queue.length; i++) { if (queue[i] == 0) { return i; } } return -1; } }
type: AcceptedAnswer

http://stackoverflow.com/comment/43294932
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27426309
type: Comment
has text: @Radiodef Since BigInteger does have setBit and shiftLeft - how can you say it isn't "intended for this purpose"? If you want a *numeric* value at the end of the bit twiddling, BigInteger is much better than a BitSet or an EnumSet.

http://stackoverflow.com/comment/43258878
type: QuestionComment
has text: You have multipled negative numbers with -1 and this os rightly done. But you have to multiply with -1 again to retain your negative sign.
comment on: http://stackoverflow.com/q/27407063
score: 0
type: Comment

http://stackoverflow.com/q/27389585
type: Question
tagged with: biased-locking
accepted answer: http://stackoverflow.com/a/27979991
has body: I am trying to make sense of the output of Java object layout on a 64-bit HotSpot VM (v8). I do not understand how the first three bit of the mark word are used which according to the commentary in the linked class file should indicated weather a biased lock or non-biased lock is set on the instance. When I analyze an instance of Object using JOL by ClassLayout layout = ClassLayout.parseClass(Object.class); Object object = new Object(); System.out.println(layout.toPrintable(object)); I get the following output: java.lang.Object object internals: OFFSET SIZE TYPE DESCRIPTION VALUE 0 4 (object header) 01 00 00 00 (0000 0001 0000 0000 0000 0000 0000 0000) 4 4 (object header) 00 00 00 00 (0000 0000 0000 0000 0000 0000 0000 0000) 8 4 (object header) e5 01 00 f8 (1110 0101 0000 0001 0000 0000 1111 1000) 12 4 (loss due to the next object alignment) Instance size: 16 bytes (estimated, add this JAR via -javaagent: to get accurate result) Space losses: 0 bytes internal + 4 bytes external = 4 bytes total From HotSpot's description of the mark word (the first 8 byte), I understand that I should interpret the above bit ranges of the output as follows: 00:01 - Flag for lock (00 in example.) 02:02 - Flag for biased lock (0 in example.) 03:06 - Age as number of young garbage collection iterations. (0000 in example.) 07:07 - Unused. (Seems to be always 1.) 08:39 - Identity hash code. (Only after its computation, before filled with zero.) 40:63 - Unused. (Seems to be filled with zeros.) Confirming this layout for the hash code range At least for the hash code, this can be easily confirmed by computing the identity hash code and comparing the values: ClassLayout layout = ClassLayout.parseClass(Object.class); Object object = new Object(); // Check that the hash code is not set. System.out.println(layout.toPrintable(object)); System.out.println("hash code: 0x" + Integer.toHexString(object.hashCode())); // Confirm that the value is set: System.out.println(layout.toPrintable(object)); // …
tagged with: jvm-hotspot
tagged with: object-layout
answer count: 1
downvote count: 0
tagged with: jol
favorite count: 0
has title: How to interpret an instance's mark word?
has answer: http://stackoverflow.com/a/27979991
has comment: http://stackoverflow.com/comment/87394584
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java

http://stackoverflow.com/comment/43219427
comment on: http://stackoverflow.com/q/27384910
has text: it was a warning. I tried to ignore it but then it doesnt finish the process and stops the further components too. It shows it is copying the rows into the database, but eventually after a very long, it says the schema in the input link does not match. So I tried to import schema from the dbconnection and it mentioned that type is Bigdecimal and so this workaround of changing the variable to BigDecimal.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27346753
answers question: http://stackoverflow.com/q/27346418
downvote count: 0
type: AcceptedAnswer
has body: First: don't use private classes. Although it is possible to do so, you should always create a separate file for each class (everything else is nonsense because you wouldn't be able to reuse the private class anywhere else) Secondly: class names should start with a capital letter (while variables start with a small letter). like this: public class Cipher{ .... } Then you can create an instance of that class like this: Cipher cipher = new Cipher(); // here Cipher is the class and cipher is the name of your variable Now, as I understand it they are asking you to transform the phone number digit wise with this calculation: C= (P+key) %10 So in your method you could do something like this: public void yes(int[] phone, int x, int y, int z) { int code = x+y+z; // I don't know how you constructed your code but lets say it is a code of 3 digits x,y,z that give the number xyz (e.g. 1,2,3 -&gt; 123) for (int count = 0; count &lt; phone.length; count++) { // you need to iterate through the complete phone number. Which means that your loop starts at 0 and stops when reaching the end (length) of your phone array phone[count] = (your calculation here) // you replace each digit from the phone array by the result of that calculation } } If for example your phone array looks like this: int[] phone = {4,5,6,4,6,8}; you can access each element from the array by the index of the digit: phone[0] // 4 phone[1] // 5 phone[4] // there you have the 5th element of the array which is 6 ! important: the index starts always at 0 and ends at array.length -1 (in this case 6-1 = 5) so. int digit= phone[0]; will return the first element of the array and put it in the new varable digit. In order to write something into the array you would do something like this: phone[0] = 3; It says that you replace the first element of the array with the number 3. And this is what you need to do (I showed you in the example). You need to write the result of the C= (P+key) %10 calculation into the array. So once mo…
type: Answer
accepted answer of: http://stackoverflow.com/q/27346418
score: 1
upvote count: 1

http://stackoverflow.com/q/27441744
tagged with: selenium
type: Question
tagged with: java
tagged with: eclipse
tagged with: webdriver
has body: I have a scenario where I want to click on a bar from a graph('Responses'), which then displays a relational bar graph('Response "Offer Of Payment(Yes)"'). When I click on a bar from the relational bar graph it displays a list of contracts. This is highlighted in the screenshot below The issue I have is that the 'Responses' graph doesn't have a bar on the 'Offer Of Payment (Yes)' section. This is a valid test scenario, but what then happens is that the relational bar graph, on the right displays no data. Furthermore, when my selenium code then looks for a contract from the list, but can't find it,the test fails with a 'NoSuchElementException'. I understand why it does this but my question is....is there a way of me tweaking the code to cater for this kind of scenario so that if it can't find a relational graph (right hand side graph), and furthermore, a contract list in the table below, the code is able to skip past this? I've attached details of my code below: 1) This method is attempting to open/close a contract from the list in the table. Can this be modified in some way so that if no contract is displayed (which is a valid scenario), the code can skip past the NoSuchElementException? public static void openCloseContractForReportWithBarChart(InternetExplorerDriver driver) throws InterruptedException { String winHandleBefore = driver.getWindowHandle(); waitCommands.fluentWaitOnContractSelect(driver); for(String winHandle : driver.getWindowHandles()) { if(!winHandle.equals(winHandleBefore)){ try{ Thread.sleep(4000); }catch(InterruptedException e){ } driver.switchTo().window(winHandle); break; } } driver.close(); driver.switchTo().window(winHandleBefore); } 2) You'll notice in the above method, I've referenced a 'FluentWaitOnContractSelect' method. Details of this are below: public static void fluentWaitOnContractSelect(InternetExplorerDriver driver) { WebElement selectContractAfterWait = (new WebDriverWait(driver, 15)) .until(ExpectedConditions.elementToBeClickable…
accepted answer: http://stackoverflow.com/a/27441911
score: 0
has comment: http://stackoverflow.com/comment/43323901
answer count: 1
has answer: http://stackoverflow.com/a/27441911
has title: How to skip NoSuchElementException in Selenium
type: AnsweredQuestion

http://stackoverflow.com/a/27463238
score: 2
accepted answer of: http://stackoverflow.com/q/27463002
answers question: http://stackoverflow.com/q/27463002
has body: i'm trying to make an image fill the screen. The image is 20x20 pixels Then you need to tile the image. Check out Background Panel which allows you to add an image to a panel and support tiling. The basic code would be: BackgroundPanel panel = new BackgroundPanel(image, BackgroundPanel.TILED); frame.add( panel );
type: AcceptedAnswer
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/comment/43271895
type: Comment
has text: I just own Synology NAS server with DSM OS on it and would like to get the same in java/scala using vaadin. That's all.
type: QuestionComment
comment on: http://stackoverflow.com/q/27386012
score: 0

artifactory
tags question: http://stackoverflow.com/q/27361507
tag name: artifactory
tags question: http://stackoverflow.com/q/27471190
type: Tag
tags question: http://stackoverflow.com/q/27415722

http://stackoverflow.com/a/27441189
score: 1
type: Answer
has body: It's a while since I have spent any time with JMonkeyEngine, but the calculation you are trying to perform here is a collision - knowing that name can help you to know what to search for. You need to ensure your floor is collidable and then you should be able to use a collision from your camera ray to find the point at which it intersects with the floor using the getContactPointmethod of the collision.
upvote count: 1
downvote count: 0
answers question: http://stackoverflow.com/q/27440653

http://stackoverflow.com/comment/43278211
type: Comment
has text: See especially this answer: http://stackoverflow.com/a/18495658/1428606
comment on: http://stackoverflow.com/q/27414600
score: 1
type: QuestionComment

http://stackoverflow.com/q/27388281
score: -1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43224416
has comment: http://stackoverflow.com/comment/43224807
upvote count: 2
tagged with: java
downvote count: 3
has title: Average class not compliling
type: Question
has answer: http://stackoverflow.com/a/27388536
tagged with: arrays
has comment: http://stackoverflow.com/comment/43224604
has comment: http://stackoverflow.com/comment/43224905
accepted answer: http://stackoverflow.com/a/27388536
has comment: http://stackoverflow.com/comment/43224676
has comment: http://stackoverflow.com/comment/43225115
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43224476
has body: I tried looking up my error problems and I cannot figure out where I went wrong with my code. Objective: This class will allow a user to enter 5 scores into an array. It will then rearrange the data in descending order and calculate the mean for the data set. Attributes: • data[]—the array which will contain the scores • mean—the arithmetic average of the scores Methods: • Average—the constructor. It will allocate memory for the array. Use a for loop to repeatedly display a prompt for the user which should indicate that user should enter score number 1, score number 2, etc. Note: The computer starts counting with 0, but people start counting with 1, and your prompt should account for this. For example, when the user enters score number 1, it will be stored in indexed variable 0. The constructor will then call the selectionSort and the calculateMean methods. • calculateMean—this is a method that uses a for loop to access each score in the array and add it to a running total. The total divided by the number of scores (use the length of the array), and the result is stored into mean. • toString—returns a String containing data in descending order and the mean. • selectionSort—his method uses the selection sort algorithm to rearrange the data set from highest to lowest. import java.util.Scanner; public class Average { private int [] data; private double mean; public Average() { data = new int[5]; Scanner keyboard = new Scanner (System.in); for (int index = 0; index &lt; data.length; index++) { System.out.println("Enter score #" + (index + 1) + ": "); data[index] = keyboard.nextInt; } keyboard.close(); return data; } /** * calculateMean Method */ public static float calculateMean(int[] data) { int total = 0; for (int index = 0; index &lt; data.length; index++) { total += data[index]; } float mean = ((float)total) / data.length; return mean; } /** * selectionSort Method */ public static void selectionSort(int[] data) { int startScan, index, minIndex, minValue; for (startS…

http://stackoverflow.com/q/27390722
has comment: http://stackoverflow.com/comment/43238853
has answer: http://stackoverflow.com/a/27397837
has title: Play framework: Unexpected exception after or during DB evolution
has comment: http://stackoverflow.com/comment/43241291
tagged with: playframework
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27397837
type: Question
has body: Suddenly I got this strange error right after I confirm DB evolution for my Play-Framework project: Unexpected exception NullPointerException: null No source available, here is the exception stack trace: -&gt;java.lang.NullPointerException: com.avaje.ebean.Ebean.save(Ebean.java:533) Global.onStart(Global.java:18) play.core.j.JavaGlobalSettingsAdapter.onStart(JavaGlobalSettingsAdapter.scala:22) play.api.GlobalPlugin.onStart(GlobalSettings.scala:220) play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:91) play.api.Play$$anonfun$start$1$$anonfun$apply$mcV$sp$1.apply(Play.scala:91) scala.collection.immutable.List.foreach(List.scala:383) play.api.Play$$anonfun$start$1.apply$mcV$sp(Play.scala:91) play.api.Play$$anonfun$start$1.apply(Play.scala:91) play.api.Play$$anonfun$start$1.apply(Play.scala:91) play.utils.Threads$.withContextClassLoader(Threads.scala:21) play.api.Play$.start(Play.scala:90) play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:157) play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1$$anonfun$1.apply(ApplicationProvider.scala:130) scala.Option.map(Option.scala:145) play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:130) play.core.ReloadableApplication$$anonfun$get$1$$anonfun$apply$1.apply(ApplicationProvider.scala:128) scala.util.Success.flatMap(Try.scala:230) play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvider.scala:128) play.core.ReloadableApplication$$anonfun$get$1.apply(ApplicationProvider.scala:120) scala.concurrent.impl.Future$PromiseCompletingRunnable.liftedTree1$1(Future.scala:24) scala.concurrent.impl.Future$PromiseCompletingRunnable.run(Future.scala:24) scala.concurrent.forkjoin.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1361) scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) scala.…
score: 0
tagged with: java
answer count: 1

http://stackoverflow.com/q/27394945
accepted answer: http://stackoverflow.com/a/27395134
type: Question
has title: Why do fields seem to be initialized before constructor?
has comment: http://stackoverflow.com/comment/43236601
has comment: http://stackoverflow.com/comment/43236634
has answer: http://stackoverflow.com/a/27395195
score: 23
favorite count: 0
has answer: http://stackoverflow.com/a/27395047
upvote count: 25
has answer: http://stackoverflow.com/a/27395133
answer count: 5
possible better answer: http://stackoverflow.com/a/27395047
has body: public class Dog { public static Dog dog = new Dog(); static final int val1 = -5; static int val2 = 3; public int val3; public Dog() { val3 = val1 + val2; } public static void main(String[] args) { System.out.println(Dog.dog.val3); } } The output is -5 From this result, it seems that the initialization of val2 is before the completion of dog member and its instantiating. Why is this order like this?
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27395134
has comment: http://stackoverflow.com/comment/43236647
tagged with: java
downvote count: 2
has answer: http://stackoverflow.com/a/27396348
tagged with: output
linked to: http://stackoverflow.com/q/12448465

http://stackoverflow.com/comment/43346963
comment on: http://stackoverflow.com/q/27454475
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete Verifiable Example) or [SSCCE](http://www.sscce.org/) (Short, Self Contained, Correct Example).
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/27473895
favorite count: 0
has answer: http://stackoverflow.com/a/27485941
has body: i was working on the code to convert a DICOM Iamge (.dcm) to JPEG format - here is the code i used, it is giving me a: javax.imageio.spi.ImageReaderSpi:Provider com.sun.media.imageioimpl.plugins.pcx.PCXImageReaderSpi not found ERROR ... import java.awt.image.BufferedImage; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.util.Iterator; import javax.imageio.ImageIO; import javax.imageio.ImageReader; import javax.imageio.stream.ImageInputStream; import org.dcm4che.imageio.plugins.DcmImageReadParam; import org.dcm4che.util.BufferedOutputStream; import org.dcm4che2.imageio.plugins.dcm.DicomImageReadParam; public class DicomToJpeg { public static void main(String[] args) { //our DICOM file File my`enter code here`DicomFile = new File("IM-0001-0001.dcm"); //declaring our JPEG image BufferedImage myJpegImage = null; //iterator containing all registered ImageReades that claim to decome the name format Iterator&lt;ImageReader&gt; iter= ImageIO.getImageReadersByFormatName("DICOM"); //geting our ImageReader object ImageReader reader = (ImageReader) iter.next(); //getting the parameters to read the DICOM image DicomImageReadParam param = (DicomImageReadParam)reader.getDefaultReadParam(); try { ImageInputStream iis = ImageIO.createImageInputStream(myDicomFile); reader.setInput(iis,false); myJpegImage = reader.read(0,param); iis.close(); if(myJpegImage==null) { System.out.println("\nError: Couldn't read teh dicom image!"); return; } File myJpegFile = new File("OutputJpegImage.jpg"); OutputStream output = new BufferedOutputStream( new FileOutputStream(myJpegFile)); ImageIO.write(myJpegImage, "jpeg", output); output.close(); } catch (IOException e) { System.out.println("\nError: couldn't read dicom image!"+ e.getMessage()); return; } } } This is the error i am receiving ? any idea what am i missing Exception in thread "main" java.util.ServiceConfigurationError: javax.imageio.spi.ImageReaderSpi: Provider com.s…
has title: Error while converting DICOM to JPEG
upvote count: 1
possible better answer: http://stackoverflow.com/a/54505930
accepted answer: http://stackoverflow.com/a/27485941
tagged with: http://stackoverflow.com/tag/jpeg
has answer: http://stackoverflow.com/a/54505930
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: image
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43382349
tagged with: dicom
downvote count: 0
has comment: http://stackoverflow.com/comment/43382147

http://stackoverflow.com/comment/43586475
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27474565
has text: Ou, I overlooked this comment. Thank you very much StanislavL. That is exactly what I was looking for.
score: 0

http://stackoverflow.com/comment/43203261
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27376618
has text: @jeeps95 No, // do operation means handle the Exception. don't put your code inside catch.
type: AnswerComment

http://stackoverflow.com/a/27399619
answers question: http://stackoverflow.com/q/27358078
has body: This is not possible right now, except for forking the project and changing the code.
downvote count: 0
score: 7
upvote count: 7
type: Answer

http://stackoverflow.com/comment/61456854
has text: Can you give a link to a bug?
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/27392770
type: Comment

http://stackoverflow.com/a/27678144
type: AcceptedAnswer
score: 0
type: Answer
has body: It's a documentation bug. As Herve Roggero noted, the service model documentation states that Bytes aren't supported.
accepted answer of: http://stackoverflow.com/q/27360989
answers question: http://stackoverflow.com/q/27360989

http://stackoverflow.com/comment/43291109
comment on: http://stackoverflow.com/q/27424491
score: 0
has text: You will want to learn how to [search this site](http://stackoverflow.com/search?q=%5Bjava%5D+%5Bswing%5D+jframe+background+image), for surely a similar question has been asked many times before.
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43106723
type: AnswerComment
type: Comment
has text: Oh thats just my example, For you it is findElement()
comment on: http://stackoverflow.com/a/27323649
score: 0

http://stackoverflow.com/comment/43142738
type: AnswerComment
type: Comment
has text: @overexchange Learn in the way that is easiest to understand for you, though afterwards, learn this approach. It is Java's way of Thread pooling, and you will begin to see this approach used more and more often as time passes.
comment on: http://stackoverflow.com/a/27343697
score: 0

http://stackoverflow.com/q/27460267
upvote count: 0
has title: .exists() method always returns false
tagged with: file-io
answer count: 1
has answer: http://stackoverflow.com/a/27460319
favorite count: 0
has comment: http://stackoverflow.com/comment/43357021
type: UnansweredQuestion
has body: In the below code, I am checking if a file exists in a specific path using the method isExist(). The problem is this method always returns false no matter the file exists or not. Kindly please have a look at the code posted below, and let me know what I am missing. Code: if (isExist(SYS_CONFIG_PATH, SYS_CONFIG_FILE)) { System.out.println("@SystemConfig-&gt;getInstance(): System Configuration File " + SYS_CONFIG_FILE + " exists."); return new File(SYS_CONFIG_PATH + "\\" + SYS_CONFIG_FILE); }else { System.out.println("@SystemConfig-&gt;getInstance(): System Configuration File " + SYS_CONFIG_FILE + " is not existing, will be created."); return buildPathAt(SYS_CONFIG_PATH); .... .... private static boolean isExist(String path1, String path2) { // TODO Auto-generated method stub String path = path1 + path2; return new File(path.trim()).exists(); }
downvote count: 1
tagged with: java
score: -1
type: Question

http://stackoverflow.com/q/27463098
upvote count: 0
possible better answer: http://stackoverflow.com/a/27463176
has comment: http://stackoverflow.com/comment/43362464
has answer: http://stackoverflow.com/a/27463176
has title: Android project, jar mismatch issue
favorite count: 0
accepted answer: http://stackoverflow.com/a/27463186
tagged with: android
type: AnsweredQuestion
has body: I am developing Android Application but when I imported to project at another computer after installing sdk and eclipse etc, I am getting Path: D:\AndroidDevelopment\project_name\libs\android-support-v4.jar [2014-12-13 23:53:54 - project_name] Length: 758727 [2014-12-13 23:53:54 - project_name] SHA-1: efec67655f6db90757faa37201efcee2a9ec3507 [2014-12-13 23:53:54 - project_name] Jar mismatch! Fix your dependencies I have android-support-v7-appcompat library installed and its copy at workspace. I am not sure why I am getting error about android-support-v4.jar mismatch. Attach is screen shot of properties of my project. Any help would be highly appreciated.
tagged with: java
tagged with: eclipse
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27463186
score: -1
answer count: 2

http://stackoverflow.com/comment/43107346
score: 0
has text: @chancea no you are correct. I was looking at jdk 1.6 implementation.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27323087

http://stackoverflow.com/q/27464781
has answer: http://stackoverflow.com/a/27465914
has answer: http://stackoverflow.com/a/27464848
tagged with: java-7
has comment: http://stackoverflow.com/comment/43367422
linked to: http://stackoverflow.com/q/1019854
has answer: http://stackoverflow.com/a/45413545
has answer: http://stackoverflow.com/a/27464820
has body: If I have: List&lt;Integer&gt; listInts = { 1, 1, 3, 77, 2, 19, 77, 123, 14, 123... } in Java what is an efficient way of creating a List&lt;Integer&gt; listDistinctInts containing only the distinct values from listInts? My immediate thought is to create a Set&lt;Integer&gt; setInts containing all the values from listInts then call List&lt;Integer&gt; listDistinctInts = new ArrayList&lt;&gt;(setInts); But this seems potentially inefficient - is there a better solution using Java 7? I'm not using Java 8, but I believe using it I could do something like this(?): List&lt;Integer&gt; listDistinctInts = listInts.stream().distinct().collect(Collectors.toList()); Would this be more performant than the approach above and/or is there any more efficient way of doing this in Java 8? Finally, (and I'm aware that asking multiple questions might be frowned upon but it's directly related) if I only cared about the count of distinct elements in listInts is there a more efficient way to get that value (in Java 7 and 8) - without first creating a list or set of all the distinct elements? I'm most interested in native Java ways of accomplishing this and avoiding re-inventing any wheels but would consider hand-rolled code or libraries if they offer better clarity or performance. I've read this related question Java - Distinct List of Objects but it's not entirely clear about the differences in performance between the Java 7 and 8 approaches or whether there might be better techniques?
favorite count: 0
has comment: http://stackoverflow.com/comment/43365980
has comment: http://stackoverflow.com/comment/43365986
has comment: http://stackoverflow.com/comment/43365965
type: Question
has answer: http://stackoverflow.com/a/27477005
has comment: http://stackoverflow.com/comment/43367046
linked to: http://stackoverflow.com/q/11564352
has answer: http://stackoverflow.com/a/27489572
linked to: http://stackoverflow.com/q/12242083
score: 21
has comment: http://stackoverflow.com/comment/43385524
has comment: http://stackoverflow.com/comment/43385109
has title: Creating distinct list from existing list in Java 7 and 8?
has comment: http://stackoverflow.com/comment/43365867
tagged with: java-8
downvote count: 1
answer count: 7
has comment: http://stackoverflow.com/comment/43385170
has comment: http://stackoverflow.com/comment/43384170
tagged with: list
has answer: http://stackoverflow.com/a/27501774
tagged with: java
tagged with: distinct-values
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43384186
has comment: http://stackoverflow.com/comment/43365906
upvote count: 22

http://stackoverflow.com/comment/43200866
type: Comment
score: 2
type: AnswerComment
comment on: http://stackoverflow.com/a/27375393
has text: @PreethiJain This is a solution but I still strongly recommend to read the docs so you'll understand what you are doing

http://stackoverflow.com/q/27331832
tagged with: bit
has answer: http://stackoverflow.com/a/27331892
type: AnsweredQuestion
upvote count: 3
tagged with: bit-manipulation
accepted answer: http://stackoverflow.com/a/27331996
has comment: http://stackoverflow.com/comment/43121637
type: Question
has title: Bit manipulation modify bits to include number
has body: I am studying for an interview and I have been trying to understand this question for hours now: You are given two 32-bit numbers, N and M, and two bit positions, i and j. Write a method to set all bits between i and j in N equal to M (e.g., M becomes a substring of N located at i and starting at j). Could someone give a complete example and walk through what is actually required? Do i need to set the between i and j to form the value of M, or to actually the bits in M? Is there some good tutorial on bits manipulation which explains the concepts? Thank you!
score: 3
has comment: http://stackoverflow.com/comment/43121594
tagged with: bit-shift
tagged with: java
has comment: http://stackoverflow.com/comment/43121549
answer count: 2
has comment: http://stackoverflow.com/comment/43130976
downvote count: 0
has answer: http://stackoverflow.com/a/27331996
favorite count: 0
possible better answer: http://stackoverflow.com/a/27331892

http://stackoverflow.com/q/27467470
tagged with: java
has body: I'm trying to execute a mapreduce job using mahout 0.9 library on Hadoop 2.4. But I'm getting following error : Exception in thread "main" java.lang.IncompatibleClassChangeError: Found interface org.apache.hadoop.mapreduce.JobContext, but class was expected So I clone the Mahout from github, checkout the branch master and recompile using: mvn clean package -Dhadoop2.version=2.4.0 But I got another error : [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] [INFO] Mahout Build Tools ................................ SUCCESS [1.954s] [INFO] Apache Mahout ..................................... SUCCESS [0.589s] [INFO] Mahout Math ....................................... SUCCESS [12.393s] [INFO] Mahout MapReduce Legacy ........................... FAILURE [2:05.777s] [INFO] Mahout Integration ................................ SKIPPED [INFO] Mahout Examples ................................... SKIPPED [INFO] Mahout Release Package ............................ SKIPPED [INFO] Mahout Math Scala bindings ........................ SKIPPED [INFO] Mahout Spark bindings ............................. SKIPPED [INFO] Mahout Spark bindings shell ....................... SKIPPED [INFO] Mahout H2O backend ................................ SKIPPED [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2:21.184s [INFO] Finished at: Sun Dec 14 15:40:54 CST 2014 [INFO] Final Memory: 34M/120M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.4:single (job) on project mahout-mrlegacy: Failed to create assembly: Error creating assembly archive job: error in opening zip file -&gt; [Help 1] [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException [ERROR] [ERROR] A…
type: Question
has comment: http://stackoverflow.com/comment/43477886
upvote count: 2
tagged with: hadoop
has comment: http://stackoverflow.com/comment/43372186
has title: Mahout error with Hadoop2.4.0
favorite count: 0
type: UnansweredQuestion
tagged with: mahout
has comment: http://stackoverflow.com/comment/43370903
tagged with: maven
score: 2
has comment: http://stackoverflow.com/comment/43371116
downvote count: 0
answer count: 0

web-services
type: Tag
tags question: http://stackoverflow.com/q/27457969
tags question: http://stackoverflow.com/q/27412889
tags question: http://stackoverflow.com/q/27397549
tags question: http://stackoverflow.com/q/27356283
tags question: http://stackoverflow.com/q/27377709
tags question: http://stackoverflow.com/q/27390089
tags question: http://stackoverflow.com/q/27363376
tags question: http://stackoverflow.com/q/27354648
tags question: http://stackoverflow.com/q/27430052
tags question: http://stackoverflow.com/q/27379073
tags question: http://stackoverflow.com/q/27353493
tags question: http://stackoverflow.com/q/27413814
tags question: http://stackoverflow.com/q/27318330
tags question: http://stackoverflow.com/q/27427509
tags question: http://stackoverflow.com/q/27403960
tags question: http://stackoverflow.com/q/27394621
tags question: http://stackoverflow.com/q/27443958
tags question: http://stackoverflow.com/q/27422036
tags question: http://stackoverflow.com/q/27448099
tags question: http://stackoverflow.com/q/27382286
tags question: http://stackoverflow.com/q/27377020
tags question: http://stackoverflow.com/q/27466447
tags question: http://stackoverflow.com/q/27370101
tags question: http://stackoverflow.com/q/27434192
tags question: http://stackoverflow.com/q/27445890
tags question: http://stackoverflow.com/q/27462112
tags question: http://stackoverflow.com/q/27357394
tags question: http://stackoverflow.com/q/27417363
tag name: web-services
tags question: http://stackoverflow.com/q/27372940
tags question: http://stackoverflow.com/q/27338848
tags question: http://stackoverflow.com/q/27407975
tags question: http://stackoverflow.com/q/27460513
tags question: http://stackoverflow.com/q/27327801
tags question: http://stackoverflow.com/q/27331033
tags question: http://stackoverflow.com/q/27404406
tags question: http://stackoverflow.com/q/27427423
tags question: http://stackoverflow.com/q/27429274
tags question: http://stackoverflow.com/q/27441363

http://stackoverflow.com/a/28229107
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27429873
answers question: http://stackoverflow.com/q/27429873
type: Answer
has body: It appears it had to do something with the Batch Jobs we had created within the same application. (Using Quartz Scheduler). Disabling the jobs fixed this issue. It appears that the Quartz scheduler was creating new threads which was making the application switch to newly created threads.

http://stackoverflow.com/comment/43191299
type: QuestionComment
comment on: http://stackoverflow.com/q/27369771
has text: Hint: you need a nested for loop.
score: 0
type: Comment

http://stackoverflow.com/comment/43343107
comment on: http://stackoverflow.com/q/27451982
score: 0
type: Comment
type: QuestionComment
has text: What issues are those? I don't think there is a unified class loader in Weblogic (but I haven't used 8.1 in a very long time).

http://stackoverflow.com/comment/43380128
type: Comment
has text: I'm sorry, I tried to provide only the relevant parts since I cannt seem to find a way to copy it all at once. The line which gives me the error is: `db.insert(TABLE_ITEMS, null, values);` Here. in AddItem
comment on: http://stackoverflow.com/a/27472437
score: 0
type: AnswerComment

http://stackoverflow.com/comment/133436361
type: AnswerComment
has text: Note that both the `@PostConstruct` and `@PreDestroy` annotations are part of Java EE. Since Java EE was deprecated in Java 9, and removed in Java 11, we have to add the dependency manually ( javax.annotation-api) to use these annotations.
type: Comment
score: 1
comment on: http://stackoverflow.com/a/57592172

http://stackoverflow.com/comment/62513462
has text: That is the answer I expected, thank you. Unfortunatelly, the question was asked more than year ago and I have to end my work sooner. However, thanks so much :) Maybe some day I will try your hints
comment on: http://stackoverflow.com/a/37498768
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43173091
type: Comment
comment on: http://stackoverflow.com/a/27360399
has text: @Gimby If you imply that the fields are there *for* these methods, then you have it upside-down. The methods are there for the *fields* to be more useful, and the fields are public API on their own.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43209426
type: AnswerComment
comment on: http://stackoverflow.com/a/27379877
score: 0
has text: @PreethiJain your initial code will work if you correct the data in the table, i'm pretty sure T2 should not be null!
type: Comment

http://stackoverflow.com/q/27385347
tagged with: datasource
has answer: http://stackoverflow.com/a/27389108
has title: Java DataSource SessionFactory
type: Question
has comment: http://stackoverflow.com/comment/43222130
has comment: http://stackoverflow.com/comment/43224801
answer count: 1
has comment: http://stackoverflow.com/comment/43223291
score: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27389108
upvote count: 2
downvote count: 1
has comment: http://stackoverflow.com/comment/43226513
tagged with: sessionfactory
type: AnsweredQuestion
has body: I'm confused about the difference between DataSource and SessionFactory. I think SessionFactory is a manager for retrieve Sessions (which are in fact connections to a database I guess). DataSource has the method getConnection() "Attempts to establish a connection with the data source that this DataSource object represents." It means a DataSource object always works directly with the database? If I have a pool of connections, DataSource will ask to the pool for a connection? Or will it try to get another connection to the database. Are in fact DataSource and SessionFactory the same? Both try to give sessions/connections?
has comment: http://stackoverflow.com/comment/43223749
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/27402324
score: 1
tagged with: java
downvote count: 1
has body: I am trying to understand how to best make use of spring application context hierarchies. Assuming I have an Application where I have @Controller beans, @Service beans, and @Repository beans, representing a front-end, business and persistence layer, it would seem nice if the layers had contexts in which only beans are visible which are relevant to the context. It would also be nice if I did not need special code for creating beans, just using @Autowired should be enough. I can create a context for my repositories, let's say repoContext, in which there exist only the repository beans. The service layers needs access to those, but not vice versa, so I'd might create another context serviceContext which has repoContext as parent. Now the front-end layer needs the services, so I might create a controllerContext with serviceContext as parent. But doing so, the controllerContext would also be able to deliver repository beans to the front-end layer, which is the opposite of what I wanted. So it seems to me that to properly separate bean dependencies in separate contexts, the parent-child relationship is not very useful to provide dependencies to a context. Is there any better way? Could there be a front-end and a backend context sharing configuration of the service beans, but with the backend context being resposible to insatntiate service beans first (because only this context has repositories)? Or would that approach lead to the frontend context trying to instantiate own service beans?
type: Question
has comment: http://stackoverflow.com/comment/43262881
has title: Spring hierarchy visibility best practice
tagged with: applicationcontext
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: spring
answer count: 0

http://stackoverflow.com/a/27328351
downvote count: 0
type: Answer
upvote count: 6
answers question: http://stackoverflow.com/q/27325536
score: 6
has body: Counters represent global counters, defined either by the Map-Reduce framework or applications. Each Counter can be of any Enum type. You can define counter as an enum in Driver class static enum UpdateCount{ CNT } And then increment the counter in map/reduce task public class CntReducer extends Reducer&lt;IntWritable, Text, IntWritable, Text&gt;{ public void reduce(IntWritable key,Iterable&lt;Text&gt; values,Context context) { //do something context.getCounter(UpdateCount.CNT).increment(1); } } and access them in Driver class public int run(String[] args) throws Exception { . . . job.setInputFormatClass(TextInputFormat.class); job.setOutputFormatClass(TextOutputFormat.class); FileInputFormat.setInputPaths(job,in ); FileOutputFormat.setOutputPath(job, out); job.waitForCompletion(true); c = job.getCounters().findCounter(UpdateCount.CNT).getValue(); //Print "c" } } c gives the counter value. You can find an example here

http://stackoverflow.com/a/27423288
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27422319
has body: The Thread.getAllStackTraces().keySet(); displays all the available threads n the stack, but not the TERMINATED ones. So, i think your "mqtt thread" might not making heavy work that consumes time, therefore, by the time you press the "play" buton the thread might have finished its work and hence, TERMINATED and would not be listed in the Thread.getAllStackTraces().keySet()

http://stackoverflow.com/comment/43267832
comment on: http://stackoverflow.com/q/27411689
score: 0
type: Comment
type: QuestionComment
has text: How long does it take to loop through everything in `datas` and run the ones that need it? I don't believe that scheduled tasks will run until the current one completes, so if it takes longer than 1 second to process your data, your next task won't execute on time.

http://stackoverflow.com/a/27348905
has comment: http://stackoverflow.com/comment/43152604
has comment: http://stackoverflow.com/comment/43152685
score: 0
has body: I don't think the standard JDK provides a way to do this. Basically the LinkedHashMap retains insertion order, adding the new entry in a new map and then the other entries from the old map would be inefficient, as you'll have to iterate through all the entries of the old map each time you want to add a new key-value pair. One workaround would be to create your own pojo and use a LinkedList&lt;MyData&gt; with the addFirst method. If you need the uniquess of the keys, you could have in parallel a Set&lt;String&gt; to check this constraint. class MyData { private final String key; private final Conversation value; //constructor, getter, hashcode, equals } Otherwise there is a ListOrderedMap in Apache Commons Collections, which provides put(int index, K key, V value) method (never tested) but it should do the trick.
type: Answer
has comment: http://stackoverflow.com/comment/43152646
has comment: http://stackoverflow.com/comment/43152523
answers question: http://stackoverflow.com/q/27348831

http://stackoverflow.com/a/27466495
answers question: http://stackoverflow.com/q/27466476
has comment: http://stackoverflow.com/comment/43368886
score: -1
downvote count: 1
upvote count: 0
type: Answer
has body: Two things... 1) Make sure you include the extensions, e.g filename.txt as you String fileName. 2) Objects should be compared with .equals() if it's a string and you are worried about caps there is .equalsIgnoreCase(). I am pretty sure == is not the issue for you here even though objects should be compared differently == in java does work for some string objects. NOTE that just because it works doesn't mean it is right.

http://stackoverflow.com/q/27411993
type: UnansweredQuestion
tagged with: shapes
has title: Rectangle rotation in java changes geometry in Java
has body: In my application I'm drawing spatial data from database after I convert them from SDO_GEOMETRY to java's Shape object. Everything works fine, my geometry from DB converts to shape (Rectangle2D) which is exactly what I need, but when I want to rotate this rectangle it also work but it converts my geometry from Rectangle2D to Path2D. Why is that so? What to do to rotate Rectangle2D shape to keep its shape? By the way, this is code I use for rotating and it doesn't seem to be a problem. AffineTransform af = new AffineTransform(); af.rotate( Math.toRadians(45), clickedCase.getBounds().getX() + clickedCase.getBounds().getWidth()/2, clickedCase.getBounds().getY() + clickedCase.getBounds().getHeight()/2); Shape trShape = af.createTransformedShape(clickedCase);
answer count: 0
tagged with: java
linked to: http://stackoverflow.com/q/24986287
has comment: http://stackoverflow.com/comment/43268420
type: Question
tagged with: rectangles
has comment: http://stackoverflow.com/comment/43268343
score: 0

http://stackoverflow.com/q/27349093
tagged with: methods
has answer: http://stackoverflow.com/a/27349134
answer count: 1
type: UnansweredQuestion
has body: Is there any difference between these 2 generic methods? public static &lt;E&gt; void fill(ArrayList&lt;? extends Comparable&lt;? super E&gt;&gt; a) public static &lt;E extends Comparable&lt;? super E&gt;&gt; void fill2(ArrayList&lt;E&gt; a)
upvote count: 4
downvote count: 0
tagged with: generics
favorite count: 0
type: Question
score: 4
tagged with: java
has title: Generic Methods Java

http://stackoverflow.com/comment/43149306
type: AnswerComment
comment on: http://stackoverflow.com/a/27347251
type: Comment
score: 0
has text: Thanks for the response. I saw that when searching, but I got the impression that the precision error was on the nanosecond level, rather than hundreds of milliseconds. Any suggestions for a workaround? I was unable to find anything effective.

header
type: Tag
tags question: http://stackoverflow.com/q/27394251
tag name: header

http://stackoverflow.com/q/27394290
favorite count: 0
has answer: http://stackoverflow.com/a/27394815
has comment: http://stackoverflow.com/comment/43235577
answer count: 3
has comment: http://stackoverflow.com/comment/43235677
has body: //reads file into a String array public String[] readFixedString()throws FileNotFoundException { int i = 0; Scanner fileIn=null; try { fileIn = new Scanner(new FileInputStream("Spices.txt")); } catch (IOException e) { System.out.println(e.getMessage()); System.exit(0); } while(fileIn.hasNextLine()) { this.textfile[i++] = fileIn.nextLine(); } fileIn.close(); return textfile; } main method public static void main(String[] args)throws FileNotFoundException { ProductData pd=new ProductData(); pd.readFixedString(); } java.lang.NullPointerException at ProductData.readFixedString(ProductData.java:57) at ProductData.main(ProductData.java:125) 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 u.rice.cs.drjava.model.compiler.JavacCompiler.runCommand(JavacCompiler.java:272) I Don't understand where my error is coming from my file does exist and the path is being followed to the right spot i checked by just reading in the file with out putting the entries into an array
type: UnansweredQuestion
downvote count: 1
has title: reading a file into an array ... I dont understand where the error is coming from
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/27394358
type: Question
has answer: http://stackoverflow.com/a/27395052
upvote count: 0
tagged with: arrays

http://stackoverflow.com/comment/43192692
type: QuestionComment
comment on: http://stackoverflow.com/q/27370423
has text: It shouldn't affect the artifact, but, as the warning message states, it should give more detail. You may need to run it from the command line rather than from within an IDE (although intellij should show whatever message the compiler returns).
score: 0
type: Comment

http://stackoverflow.com/a/27472654
has body: Just ran your code and it is showing me 5 grey rectangles: So to achive rectangles unti the end of the screen, maybe use for (int y = 0; y &lt; height / spatie; y++) { rect (50, y * spatie, 100, 10); }
type: Answer
has comment: http://stackoverflow.com/comment/43379864
answers question: http://stackoverflow.com/q/27472584
score: 0

http://stackoverflow.com/comment/43186125
comment on: http://stackoverflow.com/q/27365725
has text: I'm creating a list which contains shows I'm watching online. I'm dynamically adding custom JPanels which contain the name, episode, etc. The JPanel also includes buttons that remove/update the JPanels. As soon as I update them this happens: http://imgur.com/a/iFSvs Everything except the text disappears and I have to hover over each button with my cursor to make it visible again. This only happens if the custom panels are wrapped inside another JPanel/JScrollPane and not if I'm displaying them directly on the JFrame.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/a/27426654
type: Answer
has comment: http://stackoverflow.com/comment/43319519
has body: Well, there is not a list of what exactly you are looking for, at least not that I know. But, sure there is a list of api available in different packages that might help you to understand. So far I know, it is not very feasible to record and export the selenium tests for long run. Look here for the list of all available classes. Answer is taken from here
accepted answer of: http://stackoverflow.com/q/27426616
answers question: http://stackoverflow.com/q/27426616
has comment: http://stackoverflow.com/comment/43329767
type: AcceptedAnswer
score: 0

http://stackoverflow.com/q/27397975
duplicate of: http://stackoverflow.com/q/19243708
accepted answer: http://stackoverflow.com/a/27398001
favorite count: 0
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43241837
tagged with: java
has title: executing sequence of static methods in java
upvote count: 1
has body: I have a dummy program in java given below- public class DummyTest { public static void main(String[] args) { hungry(null); } public static void hungry(Object o){ System.out.println("object"); } public static void hungry(String s){ System.out.println("string"); } } this program returns prints string. please tell me the concept that why it prints string and not object.
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27398001
tagged with: static-methods
score: 0
linked to: http://stackoverflow.com/q/19243708
answer count: 1

http://stackoverflow.com/q/27438232
has comment: http://stackoverflow.com/comment/43316837
tagged with: logging
has body: I am using slf4j with log4j, and for some reason all the logs are showing except the logs that I write in my code - Spring logs, Hibernate logs, you name it logs are showing and in the level configured in log4j.properties. My logs however, are not showing. Maven dependencies: log4j log4j 1.2.17 test org.slf4j slf4j-api ${org.slf4j.version} org.slf4j slf4j-log4j12 ${org.slf4j.version} test When running with -Dlog4j.debug I see that my log4j.propertes file is being used log4j: Trying to find [log4j.xml] using context classloader sun.misc.Launcher$AppClassLoader@11a5ee7c. log4j: Trying to find [log4j.xml] using sun.misc.Launcher$AppClassLoader@11a5ee7c class loader. log4j: Trying to find [log4j.xml] using ClassLoader.getSystemResource(). log4j: Trying to find [log4j.properties] using context classloader sun.misc.Launcher$AppClassLoader@11a5ee7c. log4j: Using URL [ile:/C:/x/y/myProject/target/test-classes/log4j.properties] for automatic log4j configuration. log4j: Reading configuration from URL file:/C:/x/y/myProject/target/test-classes/log4j.properties And I'm using the following log code: private static final Logger LOG = LoggerFactory.getLogger(MyClass.class); LOG.warn("Very informative message"); My log4j.properties file: # Define the root logger to the system property "hbase.root.logger". log4j.rootLogger=DEBUG, console # Logging Threshold log4j.threshhold=ALL # # console appender # Add "console" to rootLogger above if you want to use this # log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.target=System.out log4j.appender.console.layout=org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern=%d %-5p [%t] %C{2}(%L): %m%n Adding a specific line for my logger doesn't help as well log4j.logger.com.my.path=DEBUG, console And I can see that it is being recognized: Parsing for [com.my.path] with value=[DEBUG, console]. log4j: Level token is [DEBUG]. log4j: Category com.my.path set to DEBUG But still nothing is being log…
has answer: http://stackoverflow.com/a/29630861
has comment: http://stackoverflow.com/comment/43316855
type: UnansweredQuestion
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/43316843
type: Question
score: 3
has comment: http://stackoverflow.com/comment/43316742
has comment: http://stackoverflow.com/comment/43316573
has comment: http://stackoverflow.com/comment/43316870
tagged with: slf4j
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43316556
has comment: http://stackoverflow.com/comment/43316666
tagged with: log4j
favorite count: 0
has title: slf4j + log4j shows all logs except mine

http://stackoverflow.com/comment/43183642
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27365725
has text: @MadProgrammer beat me to the punch

http://stackoverflow.com/a/27471320
type: Answer
downvote count: 0
has body: To get an autoincrementing column, you need to declare it as INTEGER PRIMARY KEY (not INT). Then you can just insert a NULL value, or omit the column from the INSERT statement.
score: 3
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27469999
upvote count: 3
accepted answer of: http://stackoverflow.com/q/27469999

http://stackoverflow.com/q/27355124
type: AnsweredQuestion
score: 3
has title: Unable to drop schema in derby
accepted answer: http://stackoverflow.com/a/27355535
upvote count: 3
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27355535
tagged with: database
has body: Here as you can see I have a schema with name MySchema But now I wanted to delete it But it is not working and showing me the error saying "Encountered EOF" : How could I delete this schema? Using java-8, netbeans-8, and execution was being made using Client driver i.e. org.apache.derby.jdbc.ClientDriver
tagged with: derby
answer count: 1
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/27333545
upvote count: 1
has comment: http://stackoverflow.com/comment/43128802
type: Answer
has comment: http://stackoverflow.com/comment/43125396
has comment: http://stackoverflow.com/comment/43125504
has body: Use a Semaphore, they are very practical for these kind of things. To make the example a bit more realistic: imagine you need to do 200 HTTP get-requests, but the server will ban you if you run more than 4 requests at the same time. The example below shows how you can limit the number of requests running at the same time using a Semaphore. import java.util.Random; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Semaphore; public class ResourceUsageLimiter { static ExecutorService executor = Executors.newCachedThreadPool(); static int requests = 20; static int maxRequestsConcurrent = 4; static int maxRequestTime = 1000; static Random randomizer = new Random(); static Semaphore openSlots = new Semaphore(maxRequestsConcurrent); static long startTime = System.currentTimeMillis(); public static void main(String[] args) { try { for (int i = 0; i &lt; requests; i++) { openSlots.acquire(); executor.execute(new RequestRunner(i)); } } catch (Exception e) { e.printStackTrace(); } finally { executor.shutdown(); } } static long time() { return System.currentTimeMillis() - startTime; } static class RequestRunner implements Runnable { int sleepTime, reqId; public RequestRunner(int reqId) { this.reqId = reqId; sleepTime = randomizer.nextInt(maxRequestTime); } @Override public void run() { try { System.out.println(time() + " " + reqId + " sleeping " + sleepTime); Thread.sleep(sleepTime); System.out.println(time() + " " + reqId + " sleep done"); } catch (Exception e) { e.printStackTrace(); } finally { openSlots.release(); } } } } Ofcourse, another way to limit the maximum number of requests running at the same time in the example is to use a thread pool with a fixed size of 4.
answers question: http://stackoverflow.com/q/27330259
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43125568

http://stackoverflow.com/comment/43169818
has text: I don't see a generic class here...
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27358792
score: 6

http://stackoverflow.com/comment/56563528
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27495520
score: 1
has text: @Xoppa i did it, yes i really made it work, i made a Sprite3D that can be rendered in ModelBatch. ---- I created a MyModelBatch class which extends ModelBatch, and it can render a object of interface VerticesRenderable(methods getTexture(), getVertices(), getIndices()) and the Sprite3D implements the VerticesRenderable. Here the plus point is that we can render Sprites and models in the MyModelBatch all together, and the script of creating mesh of grouped sprites is in MyModelBatch. I also managed to make 3D Label for texts using these sprites for rendering texts in 3D.

http://stackoverflow.com/q/27459207
tagged with: servlets
has comment: http://stackoverflow.com/comment/43356086
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27462629
accepted answer: http://stackoverflow.com/a/27462629
favorite count: 0
tagged with: cdi
has comment: http://stackoverflow.com/comment/43356175
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43355666
has comment: http://stackoverflow.com/comment/43355754
upvote count: 1
has title: How to use @Resource annotation in servlet (or in any other Java class)?
type: Question
tagged with: dependency-injection
has body: I am experimenting with Java Dependency Injection. Many questions here on SO talk about jndi resources being wired. But I think, a java class can be wired using @Resource annotation. I have a simple servlet in which I have two properties to be wired using CDI. I am using Tomcat6, Servlet 2.5, and Weld configuration. The servlet code: @Inject private HikariConnectionProperties hikariConnectionProperties; @Resource(name = "connectionProvider") private IConnectionProvider connectionProvider; However I get the code compiled, deployed. But, when there is a request for the corresponding servlet I get javax.naming.NameNotFoundException: Name connectionProvider is not bound in this Context. But, I have @Named annotation for the ConnectionProvider class. The same configuration works with @Inject for both the fields. So, my first question is how can I fix this issue? And is there any way that I can specify scope for a particular injection(using only annotations of JSR) without using Spring's @Scope? Any example is a great help as I am a newbie to CDI.
score: 1
tagged with: java

http://stackoverflow.com/comment/43353223
type: QuestionComment
has text: And if you need more details why you cannot access this from static then please google or read other post on stackoverflow
comment on: http://stackoverflow.com/q/27458104
score: 0
type: Comment

http://stackoverflow.com/q/27382149
has body: So, I have a class with a composition relationship with many instances of another class. I used the following code: public class dungeon{ public Set&lt;Character&gt; character; public dungeon(){ super(); Set&lt;Character&gt; = new Set&lt;Character&gt;; } } But this doesn't work. (Might be obvious, but I don't know what to do) How would I fix this code?
favorite count: 0
possible better answer: http://stackoverflow.com/a/27382186
has answer: http://stackoverflow.com/a/27382186
type: AnsweredQuestion
tagged with: java
score: 0
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/27382212
type: Question
answer count: 3
has answer: http://stackoverflow.com/a/27382216
has title: Use Sets in composition
accepted answer: http://stackoverflow.com/a/27382212

http://stackoverflow.com/q/27394940
has body: I am trying to make a method with java that includes the simulation of rolling three dice, and it counts how many times the three six-sided dice must be rolled until the values showing are all different. I tried to create it while using a while loop but it doesn't seem to even run although there aren't any compiler errors. Here's the code I have so far: public class Rollin { public static void diceGenerator() { int numOfRolls = 0; //starts at zero for the number of rolls int x = ((int)(Math.random() * 6 +1)); //simulation of three dice int y = ((int)(Math.random() * 6 +1)); int z = ((int)(Math.random() * 6 +1)); while(!(x != y &amp;&amp; y != z &amp;&amp; x != z)) { // to check if the dice have any similar numbers numOfRolls++; // counting the number of rolls } System.out.println(numOfRolls); //prints the number of rolls } }
type: AnsweredQuestion
score: 1
has answer: http://stackoverflow.com/a/27394974
tagged with: java
has title: Dice Rolling loop
has answer: http://stackoverflow.com/a/27394998
accepted answer: http://stackoverflow.com/a/27394998
type: Question
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/27395010
possible better answer: http://stackoverflow.com/a/27394974
downvote count: 0
favorite count: 0

http://stackoverflow.com/a/27349159
accepted answer of: http://stackoverflow.com/q/27349069
score: 0
type: AcceptedAnswer
has body: Yes, you can. One way you could accomplish this is with anonymous inner classes (saves keystrokes): import java.awt.BorderLayout; import java.awt.event.*; import javax.swing.*; public class Foo { JLabel one; JLabel two; public static void main(String[] args) { (new Foo()).go(); } public void go() { JFrame frame = new JFrame("Test"); // Panel with buttons JPanel buttonPanel = new JPanel(); JButton changeOne = new JButton("Change One"); changeOne.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { one.setText("New text for one"); } } buttonPanel.add(changeOne); JButton changeTwo = new JButton("Change Two"); changeTwo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { two.setText("New text for two"); } } buttonPanel.add(changeTwo); frame.add(buttonPanel, BorderLayout.NORTH); // Panel with labels JPanel labelPanel = new JLabel(); one = new JLabel("One"); labelPanel.add(one); two = new JLabel("Two"); labelPanel.add(two); // Set up the frame frame.add(labelPanel, BorderLayout.SOUTH); frame.setBounds(50, 50, 500, 500); frame.setDefaultCloseAction(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }
type: Answer
answers question: http://stackoverflow.com/q/27349069

http://stackoverflow.com/comment/43192934
score: 0
type: Comment
has text: well like it needs to print the first word just like in a dictionary . for example if you have (mike, aaaa, dave, ccc)
type: AnswerComment
comment on: http://stackoverflow.com/a/27370611

http://stackoverflow.com/a/27402015
has body: You are doing it wrong way Collection and Collections are both are different Collection is interface which is implemented by all collection class like list ,set etc while Collections is utility class which gives many method for performing various operation on the collection like sorting searching etc you can't assign collection object like list ,set to Collections class reference
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27401426

http://stackoverflow.com/comment/43370402
type: AnswerComment
comment on: http://stackoverflow.com/a/27467382
score: 0
type: Comment
has text: constructor of class TrieNode has `this.child = new TrieNode[len]`. Please explain more.

http://stackoverflow.com/comment/43203832
type: Comment
has text: Yes, I think so. Once your scenes get complex enough, you'll want to sort the `Model`s by state changes (similar shader, textures, etc), and the object that does the sorting may as well be `Renderer`. Also, it may help to think about multi-pass scenarios, like reflections or fancy lighting effects (or it may be confusing, in which case just deal with it when you come to it :).
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27367982

http://stackoverflow.com/comment/43296584
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27427334
has text: I was talking about one which doesnt have hibernate in its name. Also check for the jar hibernate-validator

http://stackoverflow.com/comment/43259682
score: 2
comment on: http://stackoverflow.com/q/27407522
has text: Well, yes it is; while you can broaden the visibility of an implemented method, you cannot restrict it. Note that methods in interfaces are `public abstract` by default as well, so all implementations of interfaces have to have the `public` modifier (even though there are no restrictions on the visibility of the interface itself)
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27344869
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27344740
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27344740
type: Answer
has body: Bitmap.setWidth and Bitmap.setHeight are introduced from API19 (KitKat). Didn't you set the minSdkVersion to 19 or later? update: BitmapFactory.Options options = new BitmapFactory.Options(); options.inMutable = true; ball= BitmapFactory.decodeResource(getResources(), R.drawable.start_bg, options);
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43145561

http://stackoverflow.com/q/27419491
has title: Trying to run a simple GLSL shader program with LWJGL but this code isn't working
has comment: http://stackoverflow.com/comment/43282460
tagged with: opengl
tagged with: glsl
score: 1
tagged with: java
tagged with: lwjgl
upvote count: 1
has comment: http://stackoverflow.com/comment/43283087
type: Question
has comment: http://stackoverflow.com/comment/43282034
downvote count: 0
answer count: 2
has comment: http://stackoverflow.com/comment/43282768
has answer: http://stackoverflow.com/a/27433788
has comment: http://stackoverflow.com/comment/43283004
favorite count: 0
has answer: http://stackoverflow.com/a/27420305
has comment: http://stackoverflow.com/comment/43282582
type: UnansweredQuestion
has body: I'm trying to run this simple GLSL shader code using LWJGL but the display remains black. (The toFloatBuffer(float[] array) method is specified in the class and works). try { Display.create(); Display.setDisplayMode(new DisplayMode(800, 600)); } catch (LWJGLException e) { e.printStackTrace(); } GL11.glViewport(0, 0, Display.getWidth(), Display.getHeight()); //Using buffers //bufferStuff(); //shaderStuff(); System.out.println(GL11.glGetString(GL11.GL_VERSION) + "\n"); String vertexShaderSource = "#version 400 core \n" + " \n" + "void main() \n" + "{ \n" + " gl_Position = vec4(0.0, 0.0, 0.0, 0.0); \n" + "} \n"; String fragmentShaderSource = "#version 400 core \n" + " \n" + "out vec4 color; \n" + " \n" + "void main() \n" + "{ \n" + " gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); \n" + "} \n"; int vertexShader = GL20.glCreateShader(GL20.GL_VERTEX_SHADER); GL20.glShaderSource(vertexShader, vertexShaderSource); GL20.glCompileShader(vertexShader); System.out.println(GL20.glGetShaderInfoLog(vertexShader, GL20.glGetShaderi(vertexShader, GL20.GL_INFO_LOG_LENGTH))); int fragmentShader = GL20.glCreateShader(GL20.GL_FRAGMENT_SHADER); GL20.glShaderSource(fragmentShader, fragmentShaderSource); GL20.glCompileShader(fragmentShader); System.out.println(GL20.glGetShaderInfoLog(fragmentShader, GL20.glGetShaderi(fragmentShader, GL20.GL_INFO_LOG_LENGTH))); int program = GL20.glCreateProgram(); GL20.glAttachShader(program, vertexShader); GL20.glAttachShader(program, fragmentShader); GL20.glLinkProgram(program); System.out.println(GL20.glGetProgramInfoLog(program, GL20.glGetProgrami(program, GL20.GL_INFO_LOG_LENGTH))); GL20.glDeleteShader(vertexShader); GL20.glDeleteShader(fragmentShader); int VAO = GL30.glGenVertexArrays(); GL30.glBindVertexArray(VAO); GL11.glPointSize(4); while(!Display.isCloseRequested()) { GL30.glClearBuffer(GL11.GL_COLOR, 0, toFloatBuffer(new float[]{0, 0, 0, 1})); GL20.glUseProgram(program); GL11.glDrawArrays(GL11.GL_POINTS, 0, 3); Display.sync(60); Display.update(); } Th…

http://stackoverflow.com/a/27374964
upvote count: 1
has comment: http://stackoverflow.com/comment/43207669
type: AcceptedAnswer
downvote count: 0
has body: As of jOOQ 3.5, jOOQ's code generator does not yet detect a view's underlying primary key information, if such information exists. Few databases can actually reliably provide such information, so perhaps, the Javadoc you cited might be a bit misleading. More information on that subject can be found in this question: How to discover the underlying primary (or unique) key columns from an Oracle view However, you can specify the primary key to the code generator using either the flag to generate additional key information, or you can use the flag to use unique keys placed on (materialized) views as the view's primary key. SCHEMA\.TABLE\.COLUMN(1|2) MY_UNIQUE_KEY_NAME Setting these flags will turn your generated Records into UpdatableRecords, and thus will also generate corresponding DAOs More information on these code generation flags can be found here: http://www.jooq.org/doc/latest/manual/code-generation/codegen-advanced/
has comment: http://stackoverflow.com/comment/43307377
accepted answer of: http://stackoverflow.com/q/27364314
type: Answer
has comment: http://stackoverflow.com/comment/43207447
answers question: http://stackoverflow.com/q/27364314
score: 1
has comment: http://stackoverflow.com/comment/43207076

http://stackoverflow.com/comment/43144404
comment on: http://stackoverflow.com/a/27342158
has text: I have 4 model class and I want to populate my arraylist with instance of WeatherResp.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43227633
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27389828
score: 1
has text: What about `if (str.size() == num)` instead?

http://stackoverflow.com/a/27409194
has comment: http://stackoverflow.com/comment/43263664
has comment: http://stackoverflow.com/comment/43263278
has body: userResponse = "Y"; While(userResponse.equals("Y")){ Random randomNumbers = new Random(); slotOne = randomNumbers.nextInt(10); // Random number between 0 and 9 slotTwo= randomNumbers.nextInt(10); slotThree = randomNumbers.nextInt(10); System.out.println(slotOne + " " + slotTwo + " " + slotThree + " " ); if (slotOne != slotTwo &amp;&amp; slotOne != slotThree &amp;&amp; slotTwo != slotThree) { System.out.println("No numbers match"); } else if (slotOne == slotTwo &amp;&amp; slotOne == slotThree) { System.out.println("All three match - jackpot"); }else { System.out.println("Two numbers match"); } System.out.print("Play again? (Y/N?)"); userResponse = scan.next(); }
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43263142
has comment: http://stackoverflow.com/comment/43263254
has comment: http://stackoverflow.com/comment/43263694
has comment: http://stackoverflow.com/comment/43262909
has comment: http://stackoverflow.com/comment/43263407
has comment: http://stackoverflow.com/comment/43263297
score: 0
answers question: http://stackoverflow.com/q/27409131
has comment: http://stackoverflow.com/comment/43263005
type: Answer

http://stackoverflow.com/comment/43284632
type: AnswerComment
type: Comment
has text: Ok, if you find any, let me know.
comment on: http://stackoverflow.com/a/27420348
score: 0

http://stackoverflow.com/comment/43278934
comment on: http://stackoverflow.com/a/27417546
has text: no if i use detail2 then also not working sir please check it properly why i am using tlname2 instead of detail2 because i have different values u see it and please try to help me and its not normal one its multimap thats why giving problem
score: 0
type: AnswerComment
type: Comment

snappy
type: Tag
tags question: http://stackoverflow.com/q/27375581
tag name: snappy

http://stackoverflow.com/q/27432128
has body: I just realize I can't set Integer value using JSTL set tag. I checked other post but didn't find related issue. My JSTL code looks like &lt;c:set var="endIndex" value="${fn:length(offeredService) - fn:length(serviceHistory) - 1} lt 0 ? ${fn:length(offeredService)} : ${fn:length(offeredService) - fn:length(serviceHistory) - 1}"/&gt; And error I am getting is javax.el.ELException: Cannot convert -1 lt 0 ? 0 : -1 of type class java.lang.String to class java.lang.Integer Whaat I am missing?
type: Question
tagged with: jstl
accepted answer: http://stackoverflow.com/a/27432787
score: 0
answer count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27432787
has title: Assiging Integer value using JSTL set
tagged with: java

http://stackoverflow.com/comment/43358528
comment on: http://stackoverflow.com/q/27460751
score: 0
type: QuestionComment
type: Comment
has text: @Charlie, oh sorry, I had copied many links in my notepad which i had referred to find a solution for this scenario. Hope i've pasted a different link..

android-edittext
tags question: http://stackoverflow.com/q/27464334
tags question: http://stackoverflow.com/q/27454535
type: Tag
tags question: http://stackoverflow.com/q/27353809
tags question: http://stackoverflow.com/q/27447945
tags question: http://stackoverflow.com/q/27465024
tag name: android-edittext
tags question: http://stackoverflow.com/q/27342056

http://stackoverflow.com/comment/43231946
type: Comment
score: 0
comment on: http://stackoverflow.com/a/27391906
type: AnswerComment
has text: Oh, sorry. Using integer division you can get your index into queueArray like so: `int index = item / 100;`

http://stackoverflow.com/q/27429009
favorite count: 0
has comment: http://stackoverflow.com/comment/43299431
has title: Java Array Size Initialization
has comment: http://stackoverflow.com/comment/43299948
downvote count: 2
has comment: http://stackoverflow.com/comment/43299928
upvote count: 6
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43300245
accepted answer: http://stackoverflow.com/a/27429177
has comment: http://stackoverflow.com/comment/43299759
has comment: http://stackoverflow.com/comment/43299448
tagged with: java
has comment: http://stackoverflow.com/comment/43299640
possible better answer: http://stackoverflow.com/a/27429386
has comment: http://stackoverflow.com/comment/43299517
has comment: http://stackoverflow.com/comment/43300084
has comment: http://stackoverflow.com/comment/43300102
has answer: http://stackoverflow.com/a/27429386
type: Question
has body: I'm reading a book "Java: A Beginners Guide (5th Edition)" by Herbert Schildt and I keep noticing a peculiar method of declaring arrays. Here's my own example to personify this practice: public int[] generateArray(int size) { int[] x = new int[size+1]; return x; } int[] y = generateArray(3); Now, what this author is doing is ALWAYS creating the array with +1 to the size. I do not understand why he would do this. Is it avoiding ArrayOutOfBounds exceptions? Furthermore, why not just send in 4 instead of 3 if he's already going to increment it by 1? Here's an example from his book to clear up the ambiguity of this question: // A dynamic queue. class DynQueue implements ICharQ { private char q[]; private int putLoc, getLoc; public DynQueue(int size) { q = new char[size+1]; //allocate memory putLoc = getLoc = 0; } }
answer count: 2
tagged with: arrays
has comment: http://stackoverflow.com/comment/43299416
has comment: http://stackoverflow.com/comment/43299382
score: 4
has comment: http://stackoverflow.com/comment/43299432
has answer: http://stackoverflow.com/a/27429177
has comment: http://stackoverflow.com/comment/43299780
has comment: http://stackoverflow.com/comment/43299458

http://stackoverflow.com/q/27399662
upvote count: 1
tagged with: methods
type: Question
score: 1
tagged with: java
tagged with: getter
answer count: 3
downvote count: 0
has title: I need to pass into a function and return all the account details in order to tidy up my code java
has answer: http://stackoverflow.com/a/27400027
has answer: http://stackoverflow.com/a/27399986
has answer: http://stackoverflow.com/a/27400035
favorite count: 0
has comment: http://stackoverflow.com/comment/43244825
has comment: http://stackoverflow.com/comment/43244985
type: UnansweredQuestion
has body: New to Stack Overflow so go easy on me. This is a pretty basic question but I am just unsure. I have the following two functions in Java, and I attempting to clean up my code more. I was wondering how to create another function that would create a new account, pass in all the parameters of setAccountDetailsTesterOne in order to get a function that I could call in addTestAccounts that would be like getAccountDetails() and this would do all of setAccountDetailsTesterOne. private void addTestAccounts(DSLContext sql) { Account account = new Account(); setAccountDetailsTesterOne(sql, account); } private void setAccountDetailsTesterOne(DSLContext sql, Account account) { account.setEmail("tester1@gmail.com"); account.setPassword("Tester1#"); account.hashPassword(); account.getPasswordSalt(); account.setFirstName("Tester"); account.setLastName("One"); account.setRole(Roles.lecturer); account.setInstitutionId(getInstitutionId(sql,"1000000")); addAccount(account, sql); } Any help, advice or tips would be much appreciated.

http://stackoverflow.com/a/27409319
has body: What you're describing is often called a "game loop". Essentially the logic of the whole game is wrapped in a loop which checks for any terminating condition of the game. In this case, the player saying they don't want to play again. It might look something like this: boolean playGame = true; while (playGame) { Scanner scan = new Scanner(System.in); int slotOne; int slotTwo; // and so on... // then after the game... while (!(userResponse.equals("Y") || userResponse.equals("N"))) { System.out.print("Play again? (Y/N?)"); userResponse = scan.next(); if (userResponse.equals("N")) { playGame = false; } } } This particular implementation is admittedly a little hurried, but you get the idea. There's an overall condition which determines if the game is still playable. If it isn't, the game loop ends. Internal to that you can also have a user input loop to keep prompting while any invalid input is received. For simple games you might even combine these two, by declaring userResponse outside of the game loop, initializing it to "Y", and doing something like while (userResponse.Equals("Y")). That semantically couples the two concepts, so for larger games you'd want to separate the loop condition from the user input if for no other reason than cleaner variable names and conditional statements. You might also find other reasons to break out of a game, in which case you could use something like a continue statement to re-iterate the loop part-way through after updating the playGame value, to reset or quit the game before it's been completed.
type: Answer
has comment: http://stackoverflow.com/comment/43263118
has comment: http://stackoverflow.com/comment/43263068
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/27409131
score: 0

http://stackoverflow.com/q/27327081
has body: When developing TestNG tests with Guice, a la this: @Guice(modules=MyTestModule.class) public class MyTestClass { } It's very easy to use field injection to declare the dependencies of the test class. Now, suppose we have this: @Guice(modules=MyTestModule.class) public class MyTestClass { @Inject private Foo foo; @Test public void myTest() { Injector injector = Guice.createInjector(new SomeOtherModule()); } } Because of field injection, if SomeOtherModule doesn't provide a binding for Foo, myTest() will fail due to CreationException, because it does not have the ability to create a MyTestClass, even if we do not intend for the test to create a MyTestClass with that injector. Is there a way to express that intention, without changing into constructor injection of the Foo? That is, is there a way to somehow make it not an error to create the injector, but do make it an error when trying to specifically provision a MyTestClass, without changing how MyTestClass is written?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43174368
score: 2
tagged with: java
type: Question
upvote count: 2
tagged with: dependency-injection
tagged with: guice
downvote count: 0
has comment: http://stackoverflow.com/comment/43156417
has title: Guice field injection and TestNG
tagged with: testng
favorite count: 0
answer count: 0
has comment: http://stackoverflow.com/comment/43131352

http://stackoverflow.com/comment/43259794
type: QuestionComment
comment on: http://stackoverflow.com/q/27407501
score: 3
has text: Read up about Oracle hard and soft parsing and the SGA. There is plenty of processing cycles used for the unprepared/literal's version of the insert for hard parsing.
type: Comment

http://stackoverflow.com/a/27423755
accepted answer of: http://stackoverflow.com/q/27423375
upvote count: 2
answers question: http://stackoverflow.com/q/27423375
score: 2
type: AcceptedAnswer
downvote count: 0
has body: You have to listen for the completion of the animation, before you set visibility to GONE. shrink.setAnimationListener(new AnimationListener() { public void onAnimationStart(Animation anim) {} public void onAnimationRepeat(Animation anim) {} public void onAnimationEnd(Animation anim) { ivEventGuide.setVisibility(View.GONE); } };
type: Answer

http://stackoverflow.com/comment/43339759
type: QuestionComment
score: 3
has text: What's this got to do with ColdFusion? It's a JS question.
comment on: http://stackoverflow.com/q/27450438
type: Comment

http://stackoverflow.com/comment/43284357
comment on: http://stackoverflow.com/q/27420797
score: 1
has text: It also depends on the type of transaction and the DBMS. I've had a situation where a distributed transaction to an Oracle database was interrupted (server brutally switched off) and that resulted in the transaction remaining "open" in the database side until an admin forceably annexed it - all the while locking involved tables.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27428041
has answer: http://stackoverflow.com/a/27428263
has answer: http://stackoverflow.com/a/27428305
tagged with: arraylist
upvote count: 0
tagged with: bufferedreader
accepted answer: http://stackoverflow.com/a/27428263
favorite count: 0
answer count: 5
possible better answer: http://stackoverflow.com/a/27428392
score: -1
has title: BufferedReader reading each newline a comma
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27428392
has answer: http://stackoverflow.com/a/27428445
has body: My code is suppose to read a file with integers separated by newlines and prints them out in reverse. My code would work only if the integers are on in the first line, but if the integers are separated by a new line it gives this Opening file... File opened Before Reverse Order [5 12 3 5 4 , 0] After Reverse Order [ 4 5 3 21 5, 0] With the file containing this 5 12 3 5 4 0 How can make my code instead display: 0 4 5 3 21 5 Below is my code public static void main(String[] args) throws Exception { String line =null; ArrayList&lt;StringBuilder&gt; arrayList = new ArrayList&lt;StringBuilder&gt;(); System.out.println("Opening file... \n"); try { BufferedReader in = new BufferedReader(new FileReader(new File("file.txt"))); System.out.println("File opened"); while((line = in.readLine()) != null &amp;&amp; line.length()!= 0) { //String[] input = line.split(" "); arrayList.add(new StringBuilder(line)); } in.close(); System.out.println("Before Reverse Order " + arrayList); for(int i = 0; i &lt; arrayList.size(); i++) { arrayList.get(i).reverse(); } System.out.println("After Reverse Order " + arrayList); } catch (IOException e) { e.printStackTrace(); } }
tagged with: java
has answer: http://stackoverflow.com/a/27428432
downvote count: 1
type: Question

http://stackoverflow.com/q/27397242
has title: java.text.DecimalFormat positive prefix mantissa
favorite count: 0
has comment: http://stackoverflow.com/comment/43241331
type: Question
answer count: 1
tagged with: decimalformat
score: 0
tagged with: java
has answer: http://stackoverflow.com/a/27397885
linked to: http://stackoverflow.com/q/1213747
upvote count: 1
downvote count: 1
has body: Is it possible to have an obligatory sign in mantissa? For example I would like to get 0.01 and 1040.3 formatted using the same DecimalFormat as: 1.00000e-002 and 1.040300e+003 At the moment I'm using: DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols(Locale.getDefault() ); otherSymbols.setDecimalSeparator('.'); otherSymbols.setExponentSeparator("e"); format="0.00000E000"; DecimalFormat formatter = new DecimalFormat(format, otherSymbols); but this pattern fails to display '+' in mantissa.
type: UnansweredQuestion

http://stackoverflow.com/a/27434656
score: 0
answers question: http://stackoverflow.com/q/27434553
has body: Change to an array like this. One could use SparseArray since indices 0, 1, 2, 3 are never used but it doesn't seem worth it to me. I made the array 25 long (24 + 1) so that results[x] holds the number of times a dice roll of x occurred. import java.util.Scanner; import java.util.Random; import java.util.Scanner; import java.lang.Math; public class DieSimulator { public static void main(String[] args) { Die d1 = new Die(6); Die d2 = new Die(6); Die d3 = new Die(6); Die d4 = new Die(6); int roll = 100; int [] rolls = new int[roll]; int [] results = new int[25]; for (int i=0; i &lt; rolls.length; i++) { int n1 = d1.cast(); //System.out.print(n1 + ""); int n2 = d2.cast(); //System.out.print(n2 + ""); int n3 = d3.cast(); //System.out.print(n3 + ""); int n4 = d4.cast(); int sum = n1 + n2 + n3 + n4; results[sum]++; System.out.println("Total Dice roll: " + sum); } System.out.print(results); } }
type: Answer

debugging
tags question: http://stackoverflow.com/q/27340064
tags question: http://stackoverflow.com/q/27346721
tag name: debugging
tags question: http://stackoverflow.com/q/27338639
tags question: http://stackoverflow.com/q/27345304
tags question: http://stackoverflow.com/q/27427700
type: Tag
tags question: http://stackoverflow.com/q/27333575
tags question: http://stackoverflow.com/q/27440369
tags question: http://stackoverflow.com/q/27389557
tags question: http://stackoverflow.com/q/27364591
tags question: http://stackoverflow.com/q/27342330
tags question: http://stackoverflow.com/q/27473045

http://stackoverflow.com/q/27336506
tagged with: hashmap
tagged with: arrays
has body: I'm looking to find a way to group and count a sequence of words in a String. Example String = " 15, 15 , 15 , 2 , 2 , 0 " The output that I'm looking for is 15(3) 2(2) 0(1) In other word , it must be unsorted , so i will know the sequence will be like 3x15 then 2x2 and 0x1 So it will have a pattern like 15(3)2(2)0(1) I try this code String str = "15|15|15|11|15|15|15|15|15|12|"; String[] splitStr = str.split("\\|"); Map&lt;String, Integer&gt; wordCount = new HashMap&lt;&gt;(); for (String word : splitStr) { if (wordCount.containsKey(word)) { // Map already contains the word key. Just increment it's count by 1 wordCount.put(word, wordCount.get(word) + 1); } else { // Map doesn't have mapping for word. Add one with count = 1 wordCount.put(word, 1); } } for (Entry&lt;String, Integer&gt; entry : wordCount.entrySet()) { System.out.println(entry.toString().replaceAll("=","(")+")"); } But the output become 15(8) 11(1) 12(1) I'm looking for output like 15(3) 11(1) 15(5) 12(1)
has comment: http://stackoverflow.com/comment/43129867
upvote count: 0
accepted answer: http://stackoverflow.com/a/27336540
answer count: 1
favorite count: 0
score: -1
has comment: http://stackoverflow.com/comment/43129771
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43129850
tagged with: java
tagged with: set
has answer: http://stackoverflow.com/a/27336540
downvote count: 1
has title: Java to count sequence of String
type: Question

http://stackoverflow.com/comment/43376966
type: AnswerComment
has text: The one-argument Graphics2D.rotate method rotates about the origin, (0, 0). You probably want to use the [three-argument rotate method](https://docs.oracle.com/javase/8/docs/api/java/awt/Graphics2D.html#rotate-double-double-double-), which rotates about whatever point you specify. Try rotating around the component's center: `g2d.rotate(Math.toRadians(degrees), getWidth() / 2.0, getHeight() / 2.0)`
comment on: http://stackoverflow.com/a/27462573
type: Comment
score: 0

http://stackoverflow.com/comment/43225714
has text: this is my url http://localhost/testurl/test1.php?name=akash&city=ngong ... here name if anyone use nname which main variable for this url....i dono mentioning value as akash...thanks
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27387770

http://stackoverflow.com/comment/43353409
type: Comment
comment on: http://stackoverflow.com/a/27386885
score: 0
type: AnswerComment
has text: what superclass do i need to use this getResources() method?

http://stackoverflow.com/comment/43236969
comment on: http://stackoverflow.com/q/27395167
type: Comment
has text: If you provide a bit of source it code might be helpful.
score: 1
type: QuestionComment

http://stackoverflow.com/q/27378694
answer count: 4
favorite count: 0
has comment: http://stackoverflow.com/comment/43206768
has title: Hindi decoding error while sending message. Output is something like à¤µà¤? à¤¹à¤µà¦?à¦? à¤µà¤?à¤¹à¤µ à¤?à¤?à¤µà¦? à¤¹à¤µà¤¹à¦¬ à¤µà¤?à¤¹
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27381538
downvote count: 0
accepted answer: http://stackoverflow.com/a/27381538
possible better answer: http://stackoverflow.com/a/27379052
score: 1
tagged with: java
type: Question
tagged with: jakarta-ee
has answer: http://stackoverflow.com/a/27380131
has answer: http://stackoverflow.com/a/27378999
has body: static String username = "######"; static String password = "#####"; static String senderid = "###"; static String message = "वउह"; static String mobileNo = "08447475458"; static String mobileNos = "08447475458,08447475458"; static String scheduledTime = "20110701 02:27:00"; static HttpURLConnection connection = null; public static void main(String[] args) { try { URL url = new URL("http://msdgweb.mgov.gov.in/esms/sendsmsrequest"); connection = (HttpURLConnection) url.openConnection(); connection.setDoInput(true); connection.setDoOutput(true); connection.setRequestMethod("POST"); connection.setFollowRedirects(true); connection = sendSingleSMS(username, password, senderid, mobileNo, message); System.out.println("Resp Code:" + connection.getResponseCode()); System.out.println("Resp Message:" + connection.getResponseMessage()); } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // Method for sending single SMS. public static HttpURLConnection sendSingleSMS(String username, String password, String senderId, String mobileNo, String message) { try { byte[] bytes = message.getBytes("UTF-8"); String smsservicetype = "singlemsg"; // For single message. String query = "username=" + URLEncoder.encode(username) + "&amp;password=" + URLEncoder.encode(password) + "&amp;smsservicetype=" + URLEncoder.encode(smsservicetype) + "&amp;content=" + URLDecoder.decode(message,"utf-8") + "&amp;mobileno=" + URLEncoder.encode(mobileNo) + "&amp;senderid=" + URLEncoder.encode(senderId); connection.setRequestProperty("Content-length", String .valueOf(query.length())); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset = utf-8"); connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)"); DataOutputStream output = new DataOutputStream(connection .getOutputStream()); int queryLength = query.le…
has answer: http://stackoverflow.com/a/27379052
upvote count: 1

http://stackoverflow.com/q/27440540
score: 0
answer count: 1
tagged with: wso2-identity-server
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27443306
accepted answer: http://stackoverflow.com/a/27443306
tagged with: java
tagged with: maven
linked to: http://stackoverflow.com/q/27253739
has title: Error during Build from Source WSO2 Identity Server
type: Question
tagged with: wso2
has body: I want to make some changes in WSO2 Identity Server v5.0.0 through using following tools; Eclipse (kepler) Subversive (for svn) JDK 1.7 Maven 3.2.3 Windows 7 I have done following 1. svn checkout (/svn.wso2.org/repos/wso2/carbon/platform/tags/turing-chunk11/) 2. then choose the is5.0.0 from the "products20494/is204941" 3. right click on pom.xml file 4. Run as maven clean (result show success with following warning) "SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". [INFO] Scanning for projects... [WARNING] ............................. ...................... [WARNING] Some problems were encountered while building the effective model for org.wso2.identity:org.wso2.sample.user.store.manager:bundle:1.0 [WARNING] The expression ${pom.artifactId} is deprecated. Please use ${project.artifactId} instead. [WARNING] The expression ${pom.artifactId} is deprecated. Please use ${project.artifactId} instead. [WARNING] 'dependencies.dependency.systemPath' for org.wso2.carbon:org.wso2.carbon.utils:jar should not point at files within the project directory, ${project.basedir}/src/main/webapp/WEB-INF/lib/org.wso2.carbon.utils-4.0.0.jar will be unresolvable by dependent projects @ line 78, column 25 -------------------- ------------ [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2.043s [INFO] Finished at: Fri Dec 12 10:14:57 PKT 2014 [INFO] Final Memory: 12M/113M [INFO] ------------------------------------------------------------------------ But when I Run as maven install it show following errors; [ERROR] Failed to execute goal org.apache.felix:maven-bundle-plugin:2.3.5:bundle (default-bundle) on project org.wso2.identity.styles: Error calculating classpath for project MavenProject: org.wso2.identity:org.wso2.identity.styles:5.0.0 @ D:\wso2is\5.0.0\modules\styles\product\pom.xml: The JAR/ZIP file (C:\Users\Rizvi\.m2\r…
tagged with: eclipse

http://stackoverflow.com/a/27349319
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27349266
downvote count: 0
type: Answer
upvote count: 2
has comment: http://stackoverflow.com/comment/43153236
has body: In the below example, the outcome should be 006 No. It should be 531, the last three digits of the value 6578336356630531. But 6578336356630531 is alnmost certainly too large to fit into a double without loss of precision. A double only has 53 bits of precision, which is 15.9 decimal digits. And casting that value to int is going to cause further truncation and loss of precision.
has comment: http://stackoverflow.com/comment/43153298
accepted answer of: http://stackoverflow.com/q/27349266
has comment: http://stackoverflow.com/comment/43153405
score: 2

http://stackoverflow.com/q/27438429
has comment: http://stackoverflow.com/comment/43350808
accepted answer: http://stackoverflow.com/a/27458401
has body: I am developing java swing application on Windows 8.1 64bit with 4GB RAM with JDK version 8u20 64bit. The problem is when I launched the application with Netbeans profiler with Monitor option. When the first Jframe is loaded the application Memory Heap is around 18mb and the JVM process size around 50mb (image1). Then when I launch the other Jframe which contains a JFxPanel with webView the Heap jumps to 45mb and the JVM proccess jumps to 700mb very fast (image2) which is very confusing. Then when I close the second JFrame and it get disposed and a System.gc() is called and the JVM perform a GC (in most times) the heap drops to around 20mb but the JVM proccess never drops (image3). Why there is a huge difference between memory Heap (45 Mb) and JVM proccess (699 Mb)? Why the JVM needs all that Memory? And how to reduce that amount? And I am launching the app with those vm options: -Xms10m -Xmx60m -Xss192k -XX:+UseG1GC -XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 -XX:PermSize=20m -XX:MaxPermSize=32m EDIT :- I just read the question in that link JVM memory usage out of control and he have the same problem but the situation is different his heap size is arround 33% of the total JVM process memory size which is in my case less than 7% and he is doing multiple jobs simultaneously (Tomcat webapp) which I don't (java swing application) and he didn't launch his application with the same VM arguments I did. UPDATE :- after the first JFrame is launched (image1) after the second JFrame is launched (image2) after the second JFrame is closed (image3) EDIT 2 :- I just tried the same application with the same VM arguments above and added -client -XX:+UseCompressedOops and used JDK 8u25 32-bit because as mentioned in this answer https://stackoverflow.com/a/15471505/4231826 the 64-bit version doesn't include client folder in the JRE and will ignore -client argument. The result is that the total memory process jumped to 540Mb when the second JFrame was open and the heap sizes (in th…
has comment: http://stackoverflow.com/comment/43319344
has comment: http://stackoverflow.com/comment/43321082
answer count: 1
has comment: http://stackoverflow.com/comment/43320328
tagged with: jvm
favorite count: 0
has comment: http://stackoverflow.com/comment/43318309
has title: Big difference between JVM process size and Memory Heap size
tagged with: swing
has comment: http://stackoverflow.com/comment/43317987
upvote count: 6
has answer: http://stackoverflow.com/a/27458401
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43350712
has comment: http://stackoverflow.com/comment/43341801
linked to: http://stackoverflow.com/q/11768615
has comment: http://stackoverflow.com/comment/43349889
tagged with: java
has comment: http://stackoverflow.com/comment/43318175
linked to: http://stackoverflow.com/q/198577
downvote count: 1
type: Question
linked to: http://stackoverflow.com/q/561245
linked to: http://stackoverflow.com/q/19951087
score: 5

http://stackoverflow.com/comment/43285320
type: AnswerComment
score: 0
has text: ok @michael: the problem is "There are countless tutorial websites out there in online" i just confused with one another. am an indian.can you provide some books, links..?/
type: Comment
comment on: http://stackoverflow.com/a/27419714

http://stackoverflow.com/comment/43199423
comment on: http://stackoverflow.com/a/27374502
type: Comment
has text: That's perhaps because you get multiple email ids and you are not iterating over them. Try the updated code.
score: 0
type: AnswerComment

http://stackoverflow.com/a/27459713
score: 1
upvote count: 1
has body: I'm using Qt Creator a lot. With the latest versions, you write your whole application in C++, using Qt toolkit, and you can compile it targetting PC, Android and iOS (never tested this last one). If you need to call some SDK functions not available in Qt API, they provide wrapper objects to create and manipulate Jni objects, and you can also execute pure Jni code (loading a java file) if you want to.
answers question: http://stackoverflow.com/q/27459135
downvote count: 0
has comment: http://stackoverflow.com/comment/43357146
type: Answer
has comment: http://stackoverflow.com/comment/43356716

http://stackoverflow.com/q/27335005
has answer: http://stackoverflow.com/a/27335326
tagged with: nio
score: 9
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/27335326
has title: Java NIO Files.createFile() fails with NoSuchFileException
tagged with: java
tagged with: file
has comment: http://stackoverflow.com/comment/43127210
type: Question
has body: I am trying to lay down some core files in a dev-test-prod setup. Basically if the file is newer it needs to be copied to the next level as part of the QA process. I am using Java 8 so I decided to try the NIO Files/Path apis for the first time. I am creaky old, having been programming for 48 years and have used almost exclusively Java since early 1996, and every release since prerelease, so this NIO "enhancement" should not be too hard for me to assimilate, but . . . FileSystem fs = FileSystems.getDefault(); Path in = fs.getPath(fromFileName); Path out = fs.getPath(toFileName); if (Files.exists(out)) { FileTime inTime = Files.getLastModifiedTime(in); FileTime outTime = Files.getLastModifiedTime(out); if (0 &gt; outTime.compareTo(inTime)) { Files.copy(in, out, StandardCopyOption.REPLACE_EXISTING); } } else { Files.createFile(out); Files.copy(in, out); } I initially just tried Files.copy() without Files.createFile() and got a NoSuchFileException on the copy() call. I looked a several StackOverflow posts which referred to this, one of which stated authoritatively that copy() will fail if the destination file does not already exist. For the life of me I cannot understand why the designers thought this was a good idea, but so be it. I accordingly added the createFile() call as above (having read the API doc for Files which says that Files.createFile() "Creates a new and empty file, failing if the file already exists." When I ran it again I got exactly the same Exception, but on the createFile() instead of the copy(). Notice the path is inside my home directory on Windows, so no access denied issues should occur. Also NOTHING other than Eclipse containing this project is running on my PC at this time. java.nio.file.NoSuchFileException: C:\Users\ChrisGage\myproject\site\ttws\css\core.css at sun.nio.fs.WindowsException.translateToIOException(Unknown Source) at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source) at sun.nio.fs.WindowsException.rethrowAsIOExcepti…
type: AnsweredQuestion
upvote count: 9

http://stackoverflow.com/q/27351913
has answer: http://stackoverflow.com/a/27352975
has answer: http://stackoverflow.com/a/27351944
answer count: 2
accepted answer: http://stackoverflow.com/a/27351944
upvote count: 1
has body: package test; public class TestMain { public static void main(String[] args) { Animal cat = new Cat(); cat.xyz(); } } class Animal{ public static void xyz(){System.out.println("Inside animal");} } class Cat extends Animal{ public static void xyz(){System.out.println("Inside cat");} } Output: Inside animal [ here ideally xyz() of Cat class should have been executed but its not happening. Instead xyz() of Animal class is being executed. It only happens when I am making this xyz() function static, otherwise it's fine. ] Please explain the reason.
has title: Calling inherited class function but still function of parent class gets executed
tagged with: oop
tagged with: java
tagged with: overriding
linked to: http://stackoverflow.com/q/27345510
has comment: http://stackoverflow.com/comment/43157809
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: inheritance
favorite count: 0
possible better answer: http://stackoverflow.com/a/27352975
type: Question

eclipse-plugin
tags question: http://stackoverflow.com/q/27355267
tags question: http://stackoverflow.com/q/27472311
tags question: http://stackoverflow.com/q/27467095
tags question: http://stackoverflow.com/q/27441852
tags question: http://stackoverflow.com/q/27401764
type: Tag
tags question: http://stackoverflow.com/q/27454741
tags question: http://stackoverflow.com/q/27372119
tags question: http://stackoverflow.com/q/27317529
tags question: http://stackoverflow.com/q/27380445
tags question: http://stackoverflow.com/q/27383134
tags question: http://stackoverflow.com/q/27368069
tags question: http://stackoverflow.com/q/27460053
tags question: http://stackoverflow.com/q/27443028
tags question: http://stackoverflow.com/q/27438338
tags question: http://stackoverflow.com/q/27384368
tags question: http://stackoverflow.com/q/27451478
tags question: http://stackoverflow.com/q/27458695
tags question: http://stackoverflow.com/q/27389900
tags question: http://stackoverflow.com/q/27404824
tags question: http://stackoverflow.com/q/27375644
tags question: http://stackoverflow.com/q/27420787
tags question: http://stackoverflow.com/q/27426450
tags question: http://stackoverflow.com/q/27423318
tags question: http://stackoverflow.com/q/27360921
tags question: http://stackoverflow.com/q/27377808
tags question: http://stackoverflow.com/q/27387573
tags question: http://stackoverflow.com/q/27376032
tags question: http://stackoverflow.com/q/27382205
tags question: http://stackoverflow.com/q/27449433
tag name: eclipse-plugin

http://stackoverflow.com/comment/43208451
comment on: http://stackoverflow.com/a/27379301
type: AnswerComment
has text: thanks for your response - but changes nothing for me =(
score: 0
type: Comment

http://stackoverflow.com/comment/43299696
type: AnswerComment
score: 0
type: Comment
has text: Can you explain some more?
comment on: http://stackoverflow.com/a/27429187

http://stackoverflow.com/comment/43352042
score: 0
type: AnswerComment
has text: hi are you there @chiastic-security
type: Comment
comment on: http://stackoverflow.com/a/27419358

http://stackoverflow.com/q/27359074
has answer: http://stackoverflow.com/a/27359205
has answer: http://stackoverflow.com/a/27359212
tagged with: hashset
tagged with: sorting
has answer: http://stackoverflow.com/a/27359298
has title: Sort List based on index value
type: AnsweredQuestion
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43170444
favorite count: 0
type: Question
has body: This is what i have so far, i'm trying to sort a bunch of List&lt;String&gt;'s based on the value of an index. LinkedHashSet&lt;List&lt;String&gt;&gt; sorted = new LinkedHashSet&lt;List&lt;String&gt;&gt;(); How do i sort the LinkedHashSet in order from Highest to Lowest index 2 value of the List's? Example input: List&lt;String&gt; data1 = Database.getData(uuid); double price = Double.valueOf(data1.get(2)) data1.add("testval"); data1.add("testval"); data1.add("100.00"); sorted.add(data1); and on another seperate List: List&lt;String&gt; data2 = Database.getData(uuid); double price = Double.valueOf(data2.get(2)) data2.add("anotherval"); data2.add("anotherval"); data2.add("50.00"); sorted.add(data2); Output of the sorted LinkedHashSet in descending order. testval testval 100.00 anotherval anotherval 50.00 Sorry if this is confusing, im not sure where to go about sorting like this.
has comment: http://stackoverflow.com/comment/43170457
accepted answer: http://stackoverflow.com/a/27359298
tagged with: linkedhashset
tagged with: java
possible better answer: http://stackoverflow.com/a/27359205
answer count: 3
has comment: http://stackoverflow.com/comment/43170541
upvote count: 1
linked to: http://stackoverflow.com/q/17370909

http://stackoverflow.com/q/27468933
has title: AlarmManager executed even if the time is wrong
has body: I am using the following code to execute the Alarm at 10:30 AM and then keep executing every 8seconds, but the problem is, this code execute the Alarm manager even when the time is not 10:30. I have tried everything but the code keep executing the Alarm regardless of what time is set, public class MainActivity extends Activity { private PendingIntent pendingIntent; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); /* Retrieve a PendingIntent that will perform a broadcast */ Intent alarmIntent = new Intent(MainActivity.this, AlarmReceiver.class); pendingIntent = PendingIntent.getBroadcast(MainActivity.this, 0, alarmIntent, 0); startAt10(); } public void startAt10() { AlarmManager manager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); /* Set the alarm to start at 10:30 AM */ Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); calendar.set(Calendar.HOUR_OF_DAY, 10); calendar.set(Calendar.MINUTE, 30); /* Repeating on every 8 seconds interval */ manager.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 1000 * 8, pendingIntent); } } and this is my AlarmReceiver class, public class AlarmReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { // For our recurring task, we'll just display a message Toast.makeText(context, "Welcome Back ! ", Toast.LENGTH_SHORT).show(); } I have also added this in my AndroidManifest.xml, &lt;receiver android:name="com.example.test2.AlarmReceiver" android:enabled="true" &gt; &lt;/receiver&gt; How to make it to only execute at 10:30AM ?
answer count: 1
has comment: http://stackoverflow.com/comment/43373141
score: 0
tagged with: android
has answer: http://stackoverflow.com/a/27469511
accepted answer: http://stackoverflow.com/a/27469511
has comment: http://stackoverflow.com/comment/43373754
has comment: http://stackoverflow.com/comment/43373164
type: Question
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/43363701
has text: I am able to create a script. Added that script to Login item, but everytime I log in it ask me to run scripts. Can we run that in the background.
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27370525

http://stackoverflow.com/comment/43141880
type: QuestionComment
has text: can you be a bit more explicit about the pipeline you used there ? using gabor features makes a lot of sense, but the hamming distance does not (unless you omit something)
comment on: http://stackoverflow.com/q/27343030
score: 0
type: Comment

http://stackoverflow.com/q/27375776
favorite count: 0
has comment: http://stackoverflow.com/comment/43201562
has comment: http://stackoverflow.com/comment/43201391
accepted answer: http://stackoverflow.com/a/27375876
type: AnsweredQuestion
has title: condition`s value is false but the program enters if
has answer: http://stackoverflow.com/a/27375864
has body: i have a main class that implements Runnable. In my function I check if a specific button inside a panel was clicked. I have an if conditions but the program always enters the if, even if its values is false. I tried to switch the condition to if(true==false) and that's how I realized that it enters the if always. The output is always false and inside if. this is my run() function : public void run() { while (true) { System.out.println(categorys_list_panel.isMovetoErrorsList()); if(categorys_list_panel.isMovetoErrorsList()); { System.out.println("inside if"); category = categorys_list_panel.getCategoryValue(); categorys_list_panel.MovedToErrorList(); try { errors_list_panel.refresh(category); } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } //cardLayout.show(const_panel, "2"); } } }
downvote count: 2
has answer: http://stackoverflow.com/a/27375845
has comment: http://stackoverflow.com/comment/43201488
has answer: http://stackoverflow.com/a/27375876
type: Question
tagged with: if-statement
score: -2
tagged with: java
has comment: http://stackoverflow.com/comment/43201508
answer count: 3
upvote count: 0
possible better answer: http://stackoverflow.com/a/27375864

http://stackoverflow.com/q/27413741
has body: I followed the instructions on here http://www.programmingmoney.com/setup-libgdx-android-studio/ for installing and using LibGdx on Android Studio 1.0(official release). I am on step 4, the actual generation step. When I tried import project, I got this exception Gradle version 2.1 is required. Current version is 2.2.1. If using the gradle wrapper, try editing the distributionUrl in C:\Users\chris\AndroidStudioProjects\SetUpGame\gradle\wrapper\gradle-wrapper.properties to gradle-2.1-all.zip. This was a similar error to what this person got in this thread - Upgrading project to Android Studio 1.0 (Gradle problems). When i went to view gradle-wrapper.properties with notepad ++, this was what i saw distributionUrl=http\://services.gradle.org/distributions/gradle-2.1-all.zip which meant that this didn't have to be changed. (the answer that was given in the other thread) Does anyone know what the issue is? Is Android studio version 1.0 too new for Libgdx? I m not that familiar with Gradle.
tagged with: android-studio
type: AnsweredQuestion
tagged with: java
score: 0
accepted answer: http://stackoverflow.com/a/27426029
tagged with: gradle
type: Question
tagged with: libgdx
answer count: 1
has answer: http://stackoverflow.com/a/27426029
linked to: http://stackoverflow.com/q/27400793
tagged with: android
has title: Generating a LibGdx project into android studio version 1.0?

http://stackoverflow.com/q/27437431
type: Question
tagged with: phone-number
score: 4
has answer: http://stackoverflow.com/a/43922415
has comment: http://stackoverflow.com/comment/43315318
has answer: http://stackoverflow.com/a/27438560
has title: Convert Letters & Numbers in a Phone Number to all Numbers (Java)
answer count: 3
has body: import java.util.Scanner; import javax.swing.JOptionPane; public class PhonePadTranslator { private static Scanner input; public static void main(String[] args) { input = new Scanner(System.in); System.out.println("Enter The Phone Number (With Letters) "); String initial_phone_number = input.nextLine(); initial_phone_number = initial_phone_number.toUpperCase(); int phone_number_final = 0; System.out.printf("The phone number for %s is %s", initial_phone_number, phone_number_final); }//end of main public static int full_number(String initial_phone_number) { int which_character = 0; int phone_number_final = 0; char ch = (Character) null; for (which_character = 0; which_character &lt; initial_phone_number.length(); which_character++) { if (Character.isLetter(ch)) { switch(ch) { case 'A' : case 'B' : case 'C' : phone_number_final = 2; break; case 'D' : case 'E' : case 'F' : phone_number_final = 3; break; case 'G' : case 'H' : case 'I' : phone_number_final = 4; break; case 'J' : case 'K' : case 'L' : phone_number_final = 5; break; case 'M' : case 'N' : case 'O' : phone_number_final = 6; break; case 'P' : case 'Q' : case 'R' : case 'S' : phone_number_final = 7; break; case 'T' : case 'U' : case 'V' : phone_number_final = 8; break; case 'W' : case 'X' : case 'Y' : case 'Z' : phone_number_final =9; break; } return (char)phone_number_final; } if (Character.isDigit(ch)) { return (char)phone_number_final; } else { return (char)phone_number_final; } } //end of for return ch; }//end of full_number }//end of class I just thought I'd copy/paste the whole thing... but whenever I run the code, it keeps outputting The phone number for 1800FLOWERS is 0. Now I'm sure there's some other things that are wrong, but my main concern is why it keeps giving me a 0? I feel like it's because I initialised it to that and for some reason I'm never changing the value. Please help, my professor takes forever to respond to my emails :(
has answer: http://stackoverflow.com/a/27437449
accepted answer: http://stackoverflow.com/a/27437449
favorite count: 0
tagged with: letters
upvote count: 4
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27438560
tagged with: numbers
downvote count: 0
tagged with: java
tagged with: loops

http://stackoverflow.com/comment/43238639
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27395598
has text: @galovics can you please explain why it's not good to keep business logic code in JSP?? m new to JSP

http://stackoverflow.com/comment/43107937
type: Comment
has text: That example doesn't use a war file at all, it uses direct Servlet definitions.
type: QuestionComment
comment on: http://stackoverflow.com/q/27323768
score: 0

http://stackoverflow.com/comment/43252564
has text: Try running your app on an **emulator** with a different (lower) API Level. Try API Levels **8**, **9**, **10**, **11**, **14** and **16**. Note the differences.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27382934

http://stackoverflow.com/q/27344359
has body: As the topic's name mentions, I'm facing a problem when I'm trying to implement live ListView filtering, when user enters some text in search bar, which is located in the Action Bar. P.S. I didn't even hav Log.i("Nomad", "onQueryTextChange") in onQueryTextChange() printed in the log, when I'm debugging the application :/ AllLists.java public class AllLists extends Fragment implements SearchView.OnQueryTextListener{ private TypedArray navMenuIcons; private Context context; private int position = 0; private String location; private List&lt;Item&gt; items = new ArrayList&lt;Item&gt;(); private ListView listView; private CustomListAdapter adapter; private SearchView mSearchView; public AllLists(Context context) { this.context = context; } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.alllists, container, false); View header = inflater.inflate(R.layout.list_header, null); // View list_view = inflater.inflate(R.layout.list_item, null); ImageView image = (ImageView) header.findViewById(R.id.small_icon); header.setClickable(false); // ImageView logo = (ImageView) list_view.findViewById(R.id.image); navMenuIcons = getResources().obtainTypedArray(R.array.nav_drawer_icons); Bundle bundle = getArguments(); position = bundle.getInt("position"); location = bundle.getString("location"); image.setImageDrawable(navMenuIcons.getDrawable(position)); DatabaseHandler db = new DatabaseHandler(context); items = db.getAllItems(location); listView = (ListView) rootView.findViewById(R.id.list); adapter = new CustomListAdapter(context, items); listView.setAdapter(adapter); listView.addHeaderView(header); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { if (location.equals("accommodation") || location.equals("eat") || location.equals("events") || location.equals("entert…
type: Question
has comment: http://stackoverflow.com/comment/43147857
answer count: 2
has comment: http://stackoverflow.com/comment/43148378
tagged with: listview
score: 0
has comment: http://stackoverflow.com/comment/43170488
tagged with: android
has comment: http://stackoverflow.com/comment/43148016
tagged with: searchview
has comment: http://stackoverflow.com/comment/43148343
has title: Filtering ListView by SearchView's query - what am I doing wrong?
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27346794
has answer: http://stackoverflow.com/a/27396104
tagged with: java

http://stackoverflow.com/a/31282093
has body: I had same problem, then found my imports were wrong: the last one of them was using fileupload from sun, not from commons.fileupload. After I changed them all to commons.fileupload, the error disappeared: import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.FileUploadException; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; import org.apache.commons.fileupload.servlet.ServletRequestContext;
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27466194
downvote count: 0

http://stackoverflow.com/a/27485941
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/95815429
has comment: http://stackoverflow.com/comment/95796661
has comment: http://stackoverflow.com/comment/95796271
type: Answer
score: 4
has comment: http://stackoverflow.com/comment/95772974
accepted answer of: http://stackoverflow.com/q/27473895
has comment: http://stackoverflow.com/comment/95773511
answers question: http://stackoverflow.com/q/27473895
has body: Somewhere in your classpath, you haven an entry (a file or a resource inside a JAR), named: /META-INF/services/javax.imageio.spi.ImageReaderSpi ...containing (at least) the line: com.sun.media.imageioimpl.plugins.pcx.PCXImageReaderSpi Whenever ImageIO is initialized, or an invocation of ImageIO.scanForPlugins() is made, the IIORegistry/ServiceLoader will scan the class path for resources matching the name above. For each line in this file/resource, it will try to instantiate the class with the given name (typically a service provider). If the class can't be found, or can't be instantiated (access protection, missing constructor etc.), it will fail with a ServiceConfigurationError. See for example this link for more information. To fix, you either need to remove the file or the JAR containing the resource (or edit it out of the JAR), or remove the line containing the bad service provider. Alternatively, add the service provider to your class path (I think it's normally in a JAR called jai_imageio.jar). But I don't think you'll need PCX (ZSoft Paintbrush format) support to decode DICOM.
upvote count: 4

http://stackoverflow.com/comment/43319519
type: Comment
comment on: http://stackoverflow.com/a/27426654
type: AnswerComment
has text: I don't quite understand how the list of available classes relates to the list of commands eligible for code generation. For example, `WebDriver.Timeouts` class does exist, yet setTimeout command is unsupported, even with literal timeout values like 1234.
score: 0

http://stackoverflow.com/comment/43203278
type: QuestionComment
has text: Use a `GridLayout` for the labels...
comment on: http://stackoverflow.com/q/27376816
score: 1
type: Comment

http://stackoverflow.com/comment/43128306
type: Comment
type: QuestionComment
has text: Please edit your original [duplicate question](http://stackoverflow.com/q/27334155/230513).
comment on: http://stackoverflow.com/q/27335292
score: 0

http://stackoverflow.com/comment/43314076
has text: You should test what you wrote, and properly format it.
comment on: http://stackoverflow.com/a/27436599
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43292773
has text: Thank you for the suggestions but none of them fits my purpose as I had to use only the tomcat plugin for maven The following configuration alongside with **mvn clean install tomcat7:run** command will deploy your app in an embedded tomcat ` org.apache.tomcat.maven tomcat7-maven-plugin 2.2 9090 / "path to context file" run `
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27361410

http://stackoverflow.com/comment/43311713
has text: `HashMap` includes a lot of internal fields that may trip up the reflection and/or JSON conversion of `sameBeanAs`. I would stick with Java Beans when using that matcher.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27411798

http://stackoverflow.com/a/27425796
answers question: http://stackoverflow.com/q/27425476
score: 5
upvote count: 5
has body: At this line: jTable1.remove(selectedRow); This remove(int index) method doesn't do what you think it does. It is inherited from Container class and it is intended to remove components from a given container. Instead of that you need to work with the TableModel and remove the selected row from it. Since you are using matisse (NetBeans' GUI Builder) then the table model attached to your table will be an instance of DefaultTableModel, so you can do as follows: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { int viewIndex = jTable1.getSelectedRow(); if(viewIndex != -1) { int modelIndex = jTable1.convertRowIndexToModel(viewIndex); // converts the row index in the view to the appropriate index in the model DefaultTableModel model = (DefaultTableModel)jTable1.getModel(); model.removeRow(modelIndex); } } Please take a look to: How to Use Tables JTable#convertRowIndexToModel(int rowIndex) DefaultTableModel#removeRow(int rowIndex)
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43315099
type: Answer
accepted answer of: http://stackoverflow.com/q/27425476

http://stackoverflow.com/q/27400419
answer count: 1
tagged with: java
has answer: http://stackoverflow.com/a/27401222
type: AnsweredQuestion
downvote count: 0
favorite count: 0
has title: What happens internally when the outermost Stream is closed?
type: Question
accepted answer: http://stackoverflow.com/a/27401222
score: 1
has body: I know that to close all the internal and enclosing streams you can close the outermost Stream and it will take care of the enclosing Streams but do it waits to read and write data completely before closing the internal streams or just perform the required operations. I just want to figure out what happens and how internal functions are called on the inner streams when we close an enclosing Stream? Just like in the below code public static void serialize(Object obj, String fileName) throws IOException { FileOutputStream fos = new FileOutputStream(fileName); BufferedOutputStream bos = new BufferedOutputStream(fos); ObjectOutputStream oos = new ObjectOutputStream(bos); bos.flush(); oos.writeObject(obj); oos.close(); } When I close the Object Stream will it wait for File Stream to perform its function?
upvote count: 1

http://stackoverflow.com/q/27471781
has comment: http://stackoverflow.com/comment/43378273
downvote count: 0
score: 1
favorite count: 0
has body: I have following controller: @ModelAttribute("multipartFileWrapper") public MultipartFileWrapper createEmployeeModel() { return new MultipartFileWrapper(); } @RequestMapping(value = "/member/createCompany/uploadImage", method = RequestMethod.POST) @ResponseBody public ResponseEntity&lt;String&gt; handleFileUpload(@RequestParam("file") @Validated MultipartFileWrapper file, BindingResult result, Principal principal) { if(result.hasErrors()){ System.out.println("ololololo"); } return null; } } @Component public class MultipartFileWrapper { @Extensions(".jpg") MultipartFile multipartFile; public MultipartFile getMultipartFile() { return multipartFile; } public void setMultipartFile(MultipartFile multipartFile) { this.multipartFile = multipartFile; } } and following jsp: &lt;form:form method="POST" action="uploadImage" enctype="multipart/form-data" id="imageUploadForm" commandName="multipartFileWrapper" &gt; &lt;div class="load-line"&gt; &lt;td&gt;&lt;form:input path="multipartFile" name="file" type = "file" class = "file" accept=".jpg,.png,.gif,.bmp,.wbmp" /&gt;&lt;/td&gt; &lt;td&gt;&lt;form:errors path="multipartFile" cssClass="error" /&gt;&lt;/td&gt; &lt;input type="submit" value="Submit" /&gt; &lt;/div&gt; &lt;/form:form&gt; When I submit form I get following error: HTTP Status 400 - Required MultipartFileWrapper parameter 'file' is not present What do I make wrong?
type: Question
has answer: http://stackoverflow.com/a/27472007
upvote count: 1
has comment: http://stackoverflow.com/comment/43378389
answer count: 1
tagged with: spring-mvc
tagged with: java
accepted answer: http://stackoverflow.com/a/27472007
has title: HTTP Status 400 - Required ... parameter ... is not present
has comment: http://stackoverflow.com/comment/43378440
tagged with: hibernate-validator
type: AnsweredQuestion
tagged with: validation

http://stackoverflow.com/q/27398584
has title: EJBConfigurationException: Bean class for EJB not found
has answer: http://stackoverflow.com/a/27427076
downvote count: 0
has comment: http://stackoverflow.com/comment/43243394
score: 1
has comment: http://stackoverflow.com/comment/43245278
has body: I have an java web-project where ejb's (3.1) are configured. When I add (add projects) the ear-project to the local websphere aplication server v8.0 (in eclipse) and start the server I receive the following error: Error while processing references for EJB-in-WAR: com.ibm.ejs.container.EJBConfigurationException: The bean class "nl.xx.xx.xx.xx.xx.GebruikerFacade" for EJB "xx-xx-ear#xx-xx-web.war#GebruikerFacade" is not found. Because I couldn't find the problem I deployed the ear-file to the websphere application server via the admin console (new application). The ear-file I created using mvn clean install package. Then when starting the application from within de admin console the error is not given. In stead it is reporting that the remote interface of the GebruikerFacade is binded. What can be the cause of the error when starting the application server where the ear-project is added using add project. Extra info: Added 20141211 The reason why the bean class cannot be found is the fact that when the ear is deployed to the webspere application server via add project the business interface is empty within the deployed ear. This is a property in Enterprise Java Bean properties/Bind EJB Business of an Enterprise bean. The module, bean and uri property are set but the business interface which has to be the full path to the Remote interface class is not. When de ear is deployed on the application server via new application the business interface contains the Remote interface Class. Console-output in new answer below.
has comment: http://stackoverflow.com/comment/43246516
type: Question
tagged with: jakarta-ee
tagged with: ejb
tagged with: java
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43244667
has comment: http://stackoverflow.com/comment/43296294
tagged with: websphere
answer count: 2
upvote count: 1
has answer: http://stackoverflow.com/a/27399271
has comment: http://stackoverflow.com/comment/43244322
favorite count: 0
has comment: http://stackoverflow.com/comment/43257018
type: UnansweredQuestion

http://stackoverflow.com/comment/43283660
has text: The `notifyDataSetInvalidated` did it!
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27420144

http://stackoverflow.com/q/27383003
has comment: http://stackoverflow.com/comment/43215793
type: UnansweredQuestion
has body: My application is developed on Windows 7 and Play framework 2.2.5. After dist command i had snapshot.zip file. How to configure my app on Tomcat 6 web server? Zip file consists of bin, conf, lib, share folders and README file.
tagged with: playframework-2.2
answer count: 0
tagged with: java
duplicate of: http://stackoverflow.com/q/9737562
has comment: http://stackoverflow.com/comment/43217705
type: Question
has title: How to deploy Play framework 2.2.5 on tomcat 6?
has comment: http://stackoverflow.com/comment/43216404
has comment: http://stackoverflow.com/comment/43215516
score: 0
tagged with: tomcat

http://stackoverflow.com/comment/43232196
comment on: http://stackoverflow.com/q/27392216
type: QuestionComment
type: Comment
score: 0
has text: Done.Added the method.

http://stackoverflow.com/comment/43380731
comment on: http://stackoverflow.com/a/27472123
score: 0
type: AnswerComment
has text: I cannot copy and paste the code correctly, it's not working for me.
type: Comment

http://stackoverflow.com/comment/43160679
type: Comment
score: 1
comment on: http://stackoverflow.com/q/27353667
type: QuestionComment
has text: you are using "localhsot" instead of "localhost" somewhere in your code.

http://stackoverflow.com/a/27353035
answers question: http://stackoverflow.com/q/27351197
type: AcceptedAnswer
downvote count: 0
score: 4
accepted answer of: http://stackoverflow.com/q/27351197
type: Answer
upvote count: 4
has body: You encoded your IV as Base64 before returning it from generateRandomIV. You have to decode it before using it for encryption and decryption. cipher.init(Cipher.ENCRYPT_MODE, key, new IvParameterSpec(java.util.Base64.Decoder.decode(IV.getBytes("UTF-8")))); Java 8 provides the java.util.Base64 class for getting different Base 64 encoders and decoders.

http://stackoverflow.com/comment/43335009
type: Comment
comment on: http://stackoverflow.com/q/27447765
has text: java.library.path is for native libraries, not class libraries. Have you tried running with `-verbose:class` to see where the class is loaded from?
score: 1
type: QuestionComment

http://stackoverflow.com/comment/43143924
type: Comment
type: QuestionComment
score: 2
has text: Do you have another exception(s) in the log before this one? this exception is related to destroying the protocol handler which happens after the application failed to start
comment on: http://stackoverflow.com/q/27344048

http://stackoverflow.com/comment/43119949
type: QuestionComment
has text: example:String monday ----- in output, MON or LUN
score: 0
comment on: http://stackoverflow.com/q/27330358
type: Comment

dialog
tag name: dialog
tags question: http://stackoverflow.com/q/27322302
tags question: http://stackoverflow.com/q/27381963
tags question: http://stackoverflow.com/q/27390476
tags question: http://stackoverflow.com/q/27339151
type: Tag
tags question: http://stackoverflow.com/q/27320056
tags question: http://stackoverflow.com/q/27445220

http://stackoverflow.com/q/27318130
downvote count: 0
answer count: 1
has body: I have problems with setting the font of a JMenuBar. I personally don't like the bold font Java frames use by default, so I tried to change it by using something like this: public class MyFrame extends javax.swing.JFrame { public MyFrame() { JMenuBar menuBar = new JMenuBar(); menuBar.setFont(new Font("sans-serif", Font.PLAIN, 12)); setJMenuBar(menuBar); setSize(600, 400); // add some menus to the menu bar menuBar.add(new JMenu("Foo")); menuBar.add(new JMenu("Bar")); menuBar.add(new JMenu("Baz")); menuBar.add(new JMenu("Qux")); setVisible(true); } } As far as I know, the line menuBar.setFont(...) sets the font used by the component menuBar. But when I instantiated one of these frames, the default font didn't change at all, not even when I put the font's size to 30. I appreciate any help concerning this.
favorite count: 0
accepted answer: http://stackoverflow.com/a/27318212
has comment: http://stackoverflow.com/comment/43095771
type: AnsweredQuestion
upvote count: 2
tagged with: jmenubar
tagged with: swing
tagged with: jmenu
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/27318212
has title: Changing a JMenuBar's font
score: 2

http://stackoverflow.com/comment/43124526
type: Comment
comment on: http://stackoverflow.com/a/27327993
has text: In my code, I guess the line which is causing problem is this - `Map<String, String> jsonIn = gson.fromJson(data, type);`. When I try serialize JSON to a Map, it is getting converted to double values.
score: 0
type: AnswerComment

http://stackoverflow.com/a/56680991
has comment: http://stackoverflow.com/comment/102429451
upvote count: 24
answers question: http://stackoverflow.com/q/27379059
has comment: http://stackoverflow.com/comment/102195486
type: Answer
has body: Since Java 12 there is method Files.mismatch which returns -1 if there is no mismatch in the content of the files. Thus the function would look like following: private static boolean sameContent(Path file1, Path file2) throws IOException { return Files.mismatch(file1, file2) == -1; }
downvote count: 0
score: 24

http://stackoverflow.com/comment/43284678
type: QuestionComment
comment on: http://stackoverflow.com/q/27421101
type: Comment
score: 3
has text: What do you mean by "type of file"?

http://stackoverflow.com/q/27438847
tagged with: android-fragments
score: 1
tagged with: java
type: Question
has body: im creating a fragment that needs to receive an object as part of its initialization now i read that i need to worry about configuartion changes and therefore use a Bundle. what i want to know are 2 things: 1)can i set the fragment using a nonDefault constructor (not using a bundle) and handle the bundle part only in the onSaveInstance, or is there a case in which that wont work out? (i have a default empty constructor for android framework to use if needed) 2)i use an array inside my extention of the Application instance as a pipe to save objects so i wont have to implement the parcelable interface (have lots of objects that are needed to be saved and retained after the changes), is there anything that can go wrong with this approach, if so is there a better way (without implementing serializable or parcelable?) public FragmentAddContactGroups (ContactGroup group) { if (group!=null)//editin a group { set_editExisting(true); set_groupContactList(group.get_contactsInGroup()); } else //a new group { set_editExisting(false); ContactGroup newGroup=new ContactGroup(); ArrayList&lt;Contact&gt; array=new ArrayList&lt;&gt;(); newGroup.set_contactsInGroup(array); set_groupContactList(array); } } the saveinstance method: public void onSaveInstanceState(Bundle outState) { //save the chosen group int id=getApplication().set_pipeItem(get_group()); outState.putInt(GROUP_KEY,id);//add the pipe id for the item to the bundle super.onSaveInstanceState(outState); } the onCreateView: public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //in case the view is restarted and we edit an existing group get the group from pipe if (savedInstanceState!=null) { int itemId=savedInstanceState.getInt(GROUP_KEY);//get the pipe item key set_group((ContactGroup)getApplication().get_pipeItem(itemId)); set_groupContactList(get_group().get_contactsInGroup()); } View rootView = inflater.inflate(R.layout.f_add_contact_group, container, false); setPlaceHolders(…
upvote count: 1
tagged with: android
favorite count: 0
answer count: 0
downvote count: 0
type: UnansweredQuestion
has title: can i Use a fragment non default constructor with an onSaveInstanceState method

http://stackoverflow.com/comment/43177671
type: QuestionComment
comment on: http://stackoverflow.com/q/27362563
type: Comment
has text: It is inside of a jar that I can not possibly dare to change...
score: 0

http://stackoverflow.com/a/27349543
score: 2
answers question: http://stackoverflow.com/q/27349528
has body: Your error is because you are trying to make a char with two characters, and you can only make a char with one. You'll want to change your array to store ints, or as it is commonly done if you need to store char's, with 'T' or 't'.
downvote count: 0
upvote count: 2
type: Answer

http://stackoverflow.com/q/27339235
possible better answer: http://stackoverflow.com/a/27339283
tagged with: java
type: Question
has title: Java Polymorphism: non-final method Invocation
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27339294
tagged with: polymorphism
has answer: http://stackoverflow.com/a/27339283
has body: //employee class public class Employee { protected String psrn; public Employee(String n) { psrn =n; } public String getPSRN() { return ("Emp:"+psrn); } void computeSimilarity(Employee t) { System.out.println("Emp::compute---"+t.getPSRN()); } } //student class public class Student extends Employee{ public Student(String n) { super(n); // TODO Auto-generated constructor stub } public String getPSRN() { return("Std:"+psrn); } void computeSimilarity(Student t) { System.out.println("Std::compute---"+t.getPSRN()); } } //tester class public class Tester { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Employee e0=new Employee("0"); Employee e=new Student("1"); Student s=new Student("2"); e.computeSimilarity(s); s.computeSimilarity(e); s.computeSimilarity(s); s.computeSimilarity(e0); } } The output comes out to be: Emp::compute---Std:2 Emp::compute---Std:1 Std::compute---Std:2 Emp::compute---Emp:0 But by my understanding,it should come out to be Emp::compute---Std:2 Emp::compute---Std:1 Std::compute---Std:2 Std::compute---Emp:0 Can anyone tell me where am I going wrong?
accepted answer: http://stackoverflow.com/a/27339294
type: AnsweredQuestion

http://stackoverflow.com/comment/43274458
type: QuestionComment
has text: Is there a possibility that `if(priceParsed <= price)` is never true. in such a case you will receive such errors. you can deal with it my initializing then with `null`. and `system.out.printf` will tell you if the condition was ever true, given that comData[i] is never `null`.
comment on: http://stackoverflow.com/q/27415199
score: 0
type: Comment

spring-messaging
tags question: http://stackoverflow.com/q/27431385
tag name: spring-messaging
type: Tag

http://stackoverflow.com/q/27419024
answer count: 0
upvote count: 2
type: UnansweredQuestion
score: 2
has body: I was trying to implement Maze using Undirected unweighted list graph. But i have difficulties with java. I am getting null pointer exception. I have no idea how to make this happen. I already spend a lot of time and i want to make this working, if anyone can give me direction i will be very grateful. The code is here. I don't use any already-implemented methods. The most of those method i implemented myself: package maze3; import java.util.Stack; import java.util.LinkedList; import java.util.NoSuchElementException; import java.util.Hashtable; import java.util.Stack; // Single linked list class SLLNode&lt;E&gt; { protected E element; protected SLLNode&lt;E&gt; succ; public SLLNode(E elem, SLLNode&lt;E&gt; succ) { this.element = elem; this.succ = succ; } @Override public String toString() { return element.toString(); } } class GraphNode&lt;E&gt; { private int index; private E info; private LinkedList&lt;GraphNode&lt;E&gt;&gt; neighbors; public GraphNode(int index, E info) { this.index = index; this.info = info; neighbors = new LinkedList&lt;GraphNode&lt;E&gt;&gt;(); } boolean containsNeighbor(GraphNode&lt;E&gt; o) { return neighbors.contains(o); } void addNeighbor(GraphNode&lt;E&gt; o) { neighbors.add(o); } void removeNeighbor(GraphNode&lt;E&gt; o) { if (neighbors.contains(o)) { neighbors.remove(o); } } @Override public String toString() { String ret = "INFO:" + info + " NEIGHBORS:"; for (int i = 0; i &lt; neighbors.size(); i++) { ret += neighbors.get(i).info + " "; } return ret; } @Override public boolean equals(Object obj) { @SuppressWarnings("unchecked") GraphNode&lt;E&gt; pom = (GraphNode&lt;E&gt;) obj; return (pom.info.equals(this.info)); } public int getIndex() { return index; } public void setIndex(int index) { this.index = index; } public E getInfo() { return info; } public void setInfo(E info) { this.info = info; } public LinkedList&lt;GraphNode&lt;E&gt;&gt; getNeighbors() { return neighbors; } public void setNeighbors(LinkedList&lt;GraphNode&lt;E&gt;&gt; ne…
tagged with: java
type: Question
tagged with: graph
tagged with: algorithm
downvote count: 0
has title: Maze implementation with Undirected Unweighted List Graph
favorite count: 0

http://stackoverflow.com/comment/43096290
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27318023
has text: You would probably need some sort of HTML parser like [Cobra](http://lobobrowser.org/cobra/java-html-parser.jsp). I have not used it myself, so I don't know if it's good match for your problem.
type: Comment

http://stackoverflow.com/comment/43115678
type: Comment
has text: If at all possible, re-design JSON format -- it makes no sense to add redundant information like "string" in there -- value is already a String, so why add useless decoration?
comment on: http://stackoverflow.com/q/27327838
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43236939
score: 0
type: Comment
has text: i solve the logcat ady..but it become the another new error.."java.lang.NullPointerException"..
comment on: http://stackoverflow.com/a/27395066
type: AnswerComment

http://stackoverflow.com/comment/43231539
score: 0
comment on: http://stackoverflow.com/a/27391922
type: Comment
has text: After changing it I'm getting these errors from Eclipse: Syntax error, insert "VariableDeclarators" to complete LocalVariableDeclaration - PassEntries cannot be resolved to a type
type: AnswerComment

http://stackoverflow.com/comment/43330098
type: QuestionComment
has text: long is the IDL code for integer.
comment on: http://stackoverflow.com/q/27445362
score: 0
type: Comment

http://stackoverflow.com/a/27363701
score: 3
has comment: http://stackoverflow.com/comment/43197214
upvote count: 3
has comment: http://stackoverflow.com/comment/43181657
has comment: http://stackoverflow.com/comment/43185270
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27363601
has body: If your bounds are completely arbitrary (unlike the example you have posted), then your idiom is almost as fast as you can get. You should just eliminate the redundant lower bound checks. First ensure that the result is positive and after that just test the upper bounds. If you use the ternary operator, and with proper formatting, you can get very concise and readable code: if (d &lt; 0) throw new IllegalArgumentException("Argument was negative"); if (d &gt; UPPER_LIMIT) throw new IllegalArgumentException("Argument too large"); return d &lt; THRESHOLD_0? 0 : d &lt; THRESHOLD_1? 1 : d &lt; THRESHOLD_2? 2 : d &lt; THRESHOLD_3? 3 : 4; If your bounds, however, are as regular as you have presented them in the example, and are not going to change, then it would of course pay off to exploit that regularity, for example if (d &lt; 0) throw new IllegalArgumentException("Argument was negative"); if (d &gt; UPPER_LIMIT) throw new IllegalArgumentException("Argument too large"); return (int) (d / 5);
has comment: http://stackoverflow.com/comment/43182513
answers question: http://stackoverflow.com/q/27363601
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43180010
type: Answer
has comment: http://stackoverflow.com/comment/43179358

http://stackoverflow.com/a/27344772
type: Answer
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27334387
has body: I think you can get away with just using toPlainString() on the returned bigdecimal. Simple testing program: BigDecimal[] bds={new BigDecimal("1.0"),new BigDecimal("20.50"), new BigDecimal("13.25"), new BigDecimal("30.0"), new BigDecimal("30.01000"), new BigDecimal("0.0000") }; for (BigDecimal bd: bds) System.out.println(bd+"==>"+bd.stripTrailingZeros().toPlainString()); returns: 1.0==>1 20.50==>20.5 13.25==>13.25 30.0==>30 30.01000==>30.01 0.0000==>0.0000 There is only one boundary case that i know that it doesn't work for..and that is all variants of 0. 0.0 => 0.0 0.00 => 0.00 I believe this is covered in this stack overflow article: Why does new BigDecimal("0.0").stripTrailingZeros() have a scale of 1? As per the article, this is corrected in java 8 (but i haven't tested it yet). You can get away with it by doing a compareTo(BigDecimal.ZERO)==0 and using BigDecimal.ZERO in that case. BigDecimal[] bds={new BigDecimal("1.0"), new BigDecimal("20.50"), new BigDecimal("13.25"), new BigDecimal("30.0"), new BigDecimal("30.01000"), new BigDecimal("0.0000") }; for (BigDecimal bd: bds){ if (bd.compareTo(BigDecimal.ZERO) == 0){ System.out.println(bd+"=>"+BigDecimal.ZERO); } else { System.out.println(bd+"==>"+bd.stripTrailingZeros().toPlainString()); } returns: 1.0==>1 20.50==>20.5 13.25==>13.25 30.0==>30 30.01000==>30.01 0.0000=>0
upvote count: 2

http://stackoverflow.com/a/27367544
answers question: http://stackoverflow.com/q/27367465
score: 0
has body: Try this PrintWriter output = new PrintWriter(new BufferedWriter(new FileWriter("transaction-list.txt", true))) // take away true, if you dont want it to append. output.println(date);
type: Answer

http://stackoverflow.com/comment/43244440
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27399564
has text: what IDE are you using? is that eclipse?
score: 0

http://stackoverflow.com/comment/43267759
type: Comment
type: QuestionComment
has text: You need to set layoutParams before. setting width.
score: 0
comment on: http://stackoverflow.com/q/27411408

http://stackoverflow.com/a/27420307
type: Answer
has comment: http://stackoverflow.com/comment/43284147
has body: Your TitreExtensionAccueil is said to be null when you are trying to set the text. You may want to point out where are CustomCardAccueil.TitreExtensionAccueil.setText("Test"); is called for better respond to your question.
score: 0
answers question: http://stackoverflow.com/q/27420082

http://stackoverflow.com/comment/43137410
has text: Briefly, it has to do with the way that the classloader finds a class. If you refer to a class, it's going to check on your classpath to see if it exists already. If it doesn't, it's going to look for a file with the right name, and try to compile that.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27340603
type: AnswerComment

http://stackoverflow.com/q/27376129
type: Question
accepted answer: http://stackoverflow.com/a/27376201
score: 4
upvote count: 4
has title: Java - Regexp group match exception
downvote count: 0
answer count: 1
has body: I'm trying to create some templates inside an XML file, and i want to have arguments with the following syntax : {%test%} where "test" is the name of the argument. private static final Pattern _hasArgPattern = Pattern.compile( "\\{%[a-zA-Z0-9_-]*%\\}" ); private static final Pattern _getArgNamePattern = Pattern.compile( "\\{%([a-zA-Z0-9_-]*)%\\}" ); private static final Pattern _replaceArgPattern = Pattern.compile( "(\\{%[a-zA-Z0-9_-]*%\\})" ); I first check if an argument is present in the string, then I attempt to extract the argmument's name, and then I replace the whole pattern by the arguments value contained in an HashMap : if( _hasArgPattern.matcher( attr ).matches() ) { String argName = _getArgNamePattern.matcher( attr ).group( 1 ); if( ! args.containsKey( argName ) ) { throw new Exception( "Argument \"" + argName + "\" not found." ); } return _replaceArgPattern.matcher( attr ).replaceFirst( args.get( argName ) ); } else { return attr; } I tested my reg exps on an online reg exp tester and they seemd to work as intented. But for some reason I'm getting an exception when trying to extract the name of the argument using group() : java.lang.IllegalStateException: No successful match so far What can this be due to ? Thank you :)
favorite count: 0
tagged with: pattern-matching
tagged with: extract
tagged with: exception
has answer: http://stackoverflow.com/a/27376201
tagged with: regex
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/comment/43147210
type: QuestionComment
has text: If you would like an easier way to extract single characters from a string by index, you could use 'str.charAt(index)' rather than substring.
comment on: http://stackoverflow.com/q/27346012
score: 0
type: Comment

compareto
tags question: http://stackoverflow.com/q/27328344
tags question: http://stackoverflow.com/q/27343244
tags question: http://stackoverflow.com/q/27417139
type: Tag
tag name: compareto
tags question: http://stackoverflow.com/q/27468114
tags question: http://stackoverflow.com/q/27410241
tags question: http://stackoverflow.com/q/27473047

http://stackoverflow.com/comment/137061877
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27321340
has text: @TWiStErRob, your solution works good for me. But unfortunately now the lines are invisible until I touch up. Added this before invalidate() in ACTION_UP: linesCoords.add(lineStartX); linesCoords.add(lineStartY); linesCoords.add(lineEndX); linesCoords.add(lineEndY); and in my onDraw I call this: canvas.drawLines(linesCoords.toFloatArray(),paint); How can I make the lines visibly follow my finger and that the canvas will keep previous added lines?
score: 0

http://stackoverflow.com/comment/43146579
has text: Alright, that seems to have fixed the problem with the sizing, thank you so much. But now about the image. Now if I set Resizable to true once I resize the window the image shows up, but just running to application it does not.
type: Comment
comment on: http://stackoverflow.com/q/27345395
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43346090
type: Comment
has text: Thanks for pointing this out. I was thinking if there is a way to get this without using JOIN
comment on: http://stackoverflow.com/a/27452414
type: AnswerComment
score: 0

http://stackoverflow.com/q/27333994
type: Question
has body: Hi i implemented a java file watcher which reads the file when it is created. It works fine on development machine. I created a few files and through the logs, the ENTRY_CREATE is called and my program reads the files as expected. The ENTRY_MODIFY is not called. But on a production machine it behaves differently. Many files are written to the directory, and my program failed to read the files properly when the ENTRY_CREATE is called. I noticed there were a few ENTRY_MODIFY. How do I tell if the file is completed so my program can read the file properly. From this article, it mentioned that the file is done when the last modified is called. But how do i know? And sometimes ENTRY_MODIFY is not called.
has title: Java watcher - How to know if a file is fully created
has comment: http://stackoverflow.com/comment/43125462
upvote count: 2
has comment: http://stackoverflow.com/comment/43125413
tagged with: java
has answer: http://stackoverflow.com/a/27334774
answer count: 1
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/17933557
score: 2
downvote count: 0
favorite count: 0

http://stackoverflow.com/comment/88210305
score: 0
type: Comment
comment on: http://stackoverflow.com/a/30106146
type: AnswerComment
has text: To use this, we also need to add xom jar because it contain nu.xom.parsingException class, if you don't use then it will throw error.

http://stackoverflow.com/q/27323683
linked to: http://stackoverflow.com/q/427653
type: Question
downvote count: 0
accepted answer: http://stackoverflow.com/a/27323717
answer count: 1
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43106502
type: AnsweredQuestion
has title: Validating an objects arguments
has body: I'm not really sure how to validate the info of an object's arguments(parameters? if someone can also explain the difference, that would be great!). So basically, the default values of the variables need to be 1.0 but when I run anything below 1.0, it doesn't take into consideration the if statements that I have put up. For example, the negative values stay negative.How can I make it so that if anything is below 1.0, it must be set to 1.0? Thank you! private double length; private double width; private double height; public Box(double l, double w, double h){ length=l; if(l&lt;1.0) l=1.0; width=w; if(w&lt;1.0) w=1.0; height=h; if(h&lt;1.0) h=1.0; } public void setLength(double l){ if(l&lt;1.0) l=1.0; } public void setWidth(double w){ if(w&lt;1.0) w=1.0; } public void setHeight(double h){ if(h&lt;1.0) h=1.0; } Here is the main Box box3= new Box(7,8,9); Box box4= new Box(-1.0,-2.0,-3.0);
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/27323717

http://stackoverflow.com/q/27437201
upvote count: 3
has body: I want to filter a source code directory from the Objectify 3.1 library I'm including in my Google App Engine project that uses the Google Plugin for Eclipse. Most likely I imported their library incorrectly but I'd like to see if I can just "hide" this source directory from Eclipse so it doesn't try to compile it. I'm trying to use the a Resource Filter. The Project Relative Path seems most appropriate but I can't figure out the syntax. Which way do slashes go? Do I put a slash at the beginning?
answer count: 1
has answer: http://stackoverflow.com/a/27437202
accepted answer: http://stackoverflow.com/a/27437202
favorite count: 0
tagged with: objectify
tagged with: google-app-engine
type: AnsweredQuestion
score: 3
downvote count: 0
tagged with: java
tagged with: google-plugin-eclipse
tagged with: eclipse
type: Question
has title: What is the syntax for Project Relative Path in Eclipse Resource Filter?

http://stackoverflow.com/q/27390992
has comment: http://stackoverflow.com/comment/43234309
tagged with: jena
score: 1
tagged with: java
downvote count: 0
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27392348
has body: I'm new to SPARQL and Jena framework, and I would like to perform a SPARQL query from Java with a regular expression. Here is my code : String queryString = "select ?a where { filter regex(?a, 'e', 'i') }"; Query query = QueryFactory.create(queryString); try (QueryExecution qexec = QueryExecutionFactory.create(query, ontology)) { ResultSet results = qexec.execSelect() ; for ( ; results.hasNext() ; ) { QuerySolution soln = results.nextSolution() ; System.out.println("a : " + soln.get("a").toString()); } } Ontology variable contains an OntModel that has concept with 'e' in their names. I would like this request to retrieve those concepts, however this code displays nothing while it does if I replace the regex by simpler stuff. I do not understand what is wrong with my request, could anyone help me ?
tagged with: regex
tagged with: sparql
accepted answer: http://stackoverflow.com/a/27392348
has title: SPARQL request in Java String with regex
type: AnsweredQuestion
upvote count: 1
type: Question

http://stackoverflow.com/comment/43382605
score: 0
type: Comment
type: QuestionComment
has text: You also need to specify the type for the `addNumber` parameter, so `(String addName, String addNumber)`, and add the appropriate constructor that takes two Strings as parameter, which seems to be missing.
comment on: http://stackoverflow.com/q/27474115

http://stackoverflow.com/q/27343268
favorite count: 0
tagged with: android-studio
has answer: http://stackoverflow.com/a/58316469
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/58315676
tagged with: package
tagged with: android
has body: how can I have a directory structure like src/main/java/com.L33Tcode.example/Adapters src/main/java/com.L33Tcode.example/Fragments android studio doesn't seem to want to let me have source folders inside a package folder for some reason. Also if I want to have jni libraries and native c++ code how can I have this inside the same package. The android studio is a great program but the directory structure is really confusing please help. Right now my project doesn't even have a package folder and none of the source code has "package" at the top but it seems to find everything alright.
score: 13
has title: android studio folders inside packages
downvote count: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43142319
tagged with: java-native-interface
upvote count: 13
answer count: 3
has comment: http://stackoverflow.com/comment/43202713
has answer: http://stackoverflow.com/a/52575575

amazon-elastic-beanstalk
tag name: amazon-elastic-beanstalk
type: Tag
tags question: http://stackoverflow.com/q/27472559

http://stackoverflow.com/comment/43232882
comment on: http://stackoverflow.com/a/27392664
type: Comment
score: 1
type: AnswerComment
has text: Thanks, this is something the professor suggested at the beginning but I had no idea on how to do, so I made the deliminator. This cut 40 lines out of my code and makes it look much nicer! If you care to know, the real numbers were 1,7,14,21,28,29,35,51,58,62,65,66,70,73,88,91,94,97,100 so you were fairly close

http://stackoverflow.com/comment/43365267
has text: Thank you! I'll take a look at this when I get some time
type: AnswerComment
comment on: http://stackoverflow.com/a/27413629
type: Comment
score: 0

http://stackoverflow.com/q/27319446
score: 13
has answer: http://stackoverflow.com/a/27320337
linked to: http://stackoverflow.com/q/1223072
has comment: http://stackoverflow.com/comment/43098544
downvote count: 1
has title: Does multithreading always yield better performance than single threading?
has body: I know the answer is No, here is an example Why single thread is faster than multithreading in Java? . So when processing a task in a thread is trivial, the cost of creating a thread will create more overhead than distributing the task. This is one case where a single thread will be faster than multithreading. Questions Are there more cases where a single thread will be faster than multithreading? When should we decide to give up multithreading and only use a single thread to accomplish our goal? Although the question is tagged java, it is also welcome to discuss beyond Java. It would be great if we could have a small example to explain in the answer.
has comment: http://stackoverflow.com/comment/43099115
upvote count: 14
tagged with: java
has comment: http://stackoverflow.com/comment/43099290
has answer: http://stackoverflow.com/a/27320082
type: Question
has comment: http://stackoverflow.com/comment/43098213
has comment: http://stackoverflow.com/comment/43098693
has answer: http://stackoverflow.com/a/27331437
has answer: http://stackoverflow.com/a/27332074
has comment: http://stackoverflow.com/comment/43099379
has comment: http://stackoverflow.com/comment/43098169
has comment: http://stackoverflow.com/comment/43099021
has comment: http://stackoverflow.com/comment/43099235
answer count: 7
linked to: http://stackoverflow.com/q/19901915
has comment: http://stackoverflow.com/comment/43099205
favorite count: 0
has answer: http://stackoverflow.com/a/55337895
has comment: http://stackoverflow.com/comment/43099288
has answer: http://stackoverflow.com/a/27320153
type: UnansweredQuestion
tagged with: multithreading
has answer: http://stackoverflow.com/a/27319663

http://stackoverflow.com/q/27320902
type: Question
tagged with: spring-mvc
tagged with: java
has comment: http://stackoverflow.com/comment/43101238
has comment: http://stackoverflow.com/comment/43403450
has comment: http://stackoverflow.com/comment/43161195
upvote count: 1
tagged with: jsp
has comment: http://stackoverflow.com/comment/43101420
has title: How to retrieve object attributes to run some dynamic logic in Spring MVC view
has comment: http://stackoverflow.com/comment/43101120
favorite count: 0
has comment: http://stackoverflow.com/comment/43101336
has body: I am having trouble dealing with the objects passing from controller in a Spring MVC app. I want to pass an object from the home controller and want to receive the object ina view, that i am able to do. But, I want to make some dynamic decision depending on that objects attributes in that view (here jsp page). Which i don't know how to do. Can anybody please help me.. My controller looks like: HashMap hm = usr.getRightsHM(usr.getId_user()); model.addAttribute("rights", hm); return "index"; index.jsp &lt;p&gt;${rights.get("RIGHT_FIRST_ATTRIBUTE")}&lt;/p&gt; This is working ok. But, what if i wanted to run some logic depending on that value, like we do in normal java application using &lt;% %> tag.. How to retrieve the attributes here to run some logic based on the values? Please help. Hi, I have went through the doc and tried to implement the logic this way.. &lt;c:set var="i_right" scope="session" value="${rights.get("RIGHT_FIRST_ATTRIBUTE")"/&gt; &lt;c:if test="${i_right &gt; 0}"&gt; &lt;li ... &gt;&lt;/li&gt; &lt;/c:if&gt; But it is giving warning as 'Undefined attribute name "RIGHT_FIRST_ATTRIBUTE"' And then when i run it, it throws an error org.apache.jasper.JasperException:equal symbol expected How to resolve it.. can you please help?
tagged with: spring
tagged with: view
answer count: 0
downvote count: 0
type: UnansweredQuestion
score: 1

http://stackoverflow.com/q/27382100
upvote count: 10
has comment: http://stackoverflow.com/comment/43214015
type: Question
has comment: http://stackoverflow.com/comment/43214205
downvote count: 0
has comment: http://stackoverflow.com/comment/43212915
has comment: http://stackoverflow.com/comment/43213868
accepted answer: http://stackoverflow.com/a/27383497
has title: Syntax of JDBC Connection prepareCall SQL
answer count: 1
has comment: http://stackoverflow.com/comment/43213902
score: 10
has body: I am reading the JavaDocs for Connection#prepareCall: sql - an SQL statement that may contain one or more '?' parameter placeholders. Typically this statement is specified using JDBC call escape syntax. According to this popular mkyong JDBC tutorial, I see the method executed like so: String insertStoreProc = "{call insertDBUSER(?,?,?,?)}"; callableStatement = dbConnection.prepareCall(insertStoreProc); I am wondering: Why is the string encapsulated in curly braces ({ ... })? Why does call proceed the name of the procedure? Most importantly: is { call &lt;nameOfProcedure&gt; } the correct syntax for executing all stored procedures across all JDBC drivers? Or is { call ... } specific to a particular type of driver? Are there variations of this procedure invocation syntax? For instance, are there scenarios/drivers where one might pass "{ execute &lt;nameOfProcedure&gt; }" into the prepareCall method? Is there documentation on any of this? Update: According to CallableStatement, JDBC offers 2 valid syntaxes for calling procs in a standard way, across all drivers: {?= call &lt;procedure-name&gt;[(&lt;arg1&gt;,&lt;arg2&gt;, ...)]} And: {call &lt;procedure-name&gt;[(&lt;arg1&gt;,&lt;arg2&gt;, ...)]} But it is still unclear as to when to use either (that is: when to preprend call with ?=).
favorite count: 0
has comment: http://stackoverflow.com/comment/43213468
tagged with: jdbc
type: AnsweredQuestion
tagged with: stored-procedures
has comment: http://stackoverflow.com/comment/43213987
has comment: http://stackoverflow.com/comment/138377625
has comment: http://stackoverflow.com/comment/43213190
tagged with: java
has answer: http://stackoverflow.com/a/27383497

code-generation
tag name: code-generation
type: Tag
tags question: http://stackoverflow.com/q/27379810

http://stackoverflow.com/comment/43167272
score: 1
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27357428
has text: you aren't reading line by line but everything at once and iterate over the lines. this will break with large files due to massive memory consumption.

http://stackoverflow.com/a/27380993
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/43211079
has body: NewProjectModalWindow.this refers to the enclosing instance of your anonymous inner class, so it refers to the same instance in which the Button.ClickListener instance was created. Here's the relevant JLS entry : 15.8.4. Qualified this Any lexically enclosing instance (§8.1.3) can be referred to by explicitly qualifying the keyword this. Let T be the type denoted by TypeName. Let n be an integer such that T is the n'th lexically enclosing type declaration of the class or interface in which the qualified this expression appears. The value of an expression of the form TypeName.this is the n'th lexically enclosing instance of this. The type of the expression is T. It is a compile-time error if the expression occurs in a class or interface which is not an inner class of class T or T itself.
downvote count: 0
has comment: http://stackoverflow.com/comment/43211288
score: 2
answers question: http://stackoverflow.com/q/27380933
has comment: http://stackoverflow.com/comment/43210995
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43210885
accepted answer of: http://stackoverflow.com/q/27380933
has comment: http://stackoverflow.com/comment/43211248

http://stackoverflow.com/comment/43236153
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27394645
has text: @Simran, can you try to get rid of those extra spaces in the tags?, I mean this `type = "checkbox"` likewise others as well.

http://stackoverflow.com/q/27332937
type: UnansweredQuestion
tagged with: input
upvote count: 1
has body: Code: File f = new File("E:\\image.png"); FileInputStream is = null; HttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost("http://www.framesocket.com/api/media/upload.php"); MultipartEntity multipartEntity = new MultipartEntity(); String fsKey = "***"; String fsSecret = "***"; String fsGatekeeper = "***"; String mediaFilename = "test"; JSONObject resultJson; try { // Add authentication variables. multipartEntity.addPart("key", new StringBody(fsKey)); multipartEntity.addPart("secret", new StringBody(fsSecret)); multipartEntity.addPart("sig", new StringBody(md5(fsGatekeeper + "upload"))); // Optionally add title, description, etc. multipartEntity.addPart("title", new StringBody("Test")); // Add the media file: multipartEntity.addPart("media", new InputStreamBody(is = new FileInputStream(f), "E:\\image.png")); // Execute POST request. httpPost.setEntity(multipartEntity); HttpResponse httpResponse = httpClient.execute(httpPost); // Handle Response HttpEntity httpEntity = httpResponse.getEntity(); InputStream inputStream = httpEntity.getContent(); String resultString = convertStreamToString(inputStream); resultJson = new JSONObject(resultString); } catch (Exception e) { e.printStackTrace(); } Html-form: File Uploading Form File Upload: Select a file to upload: I write web application, which upload files to framesocket.com. I uploaded file with certain path, for example: E:\\image.png. But I want upload file used input type="file" or any other way dynamically from user machine. How easy do this? Any idea?
score: 1
tagged with: java
tagged with: servlets
type: Question
tagged with: upload
downvote count: 0
tagged with: http://stackoverflow.com/tag/html
has title: How to easy upload file with api framesocket
favorite count: 0
answer count: 0

http://stackoverflow.com/comment/43193345
comment on: http://stackoverflow.com/a/27370689
type: AnswerComment
score: 0
type: Comment
has text: The program runs smoothly now, thanks for the help!!

http://stackoverflow.com/comment/43318430
type: Comment
has text: oh. didn't knew that. Like the sql blob code. Still, would have chosen JNI.
score: 1
comment on: http://stackoverflow.com/a/27437145
type: AnswerComment

http://stackoverflow.com/comment/43205290
type: Comment
type: QuestionComment
has text: You will have to implement space() which returns JavaSpace or any of it's sub type
comment on: http://stackoverflow.com/q/27377299
score: 0

http://stackoverflow.com/a/27387369
has comment: http://stackoverflow.com/comment/43225026
score: 3
has comment: http://stackoverflow.com/comment/43224781
has comment: http://stackoverflow.com/comment/43223545
has comment: http://stackoverflow.com/comment/43223725
has comment: http://stackoverflow.com/comment/43224684
has comment: http://stackoverflow.com/comment/43223763
has comment: http://stackoverflow.com/comment/43224251
upvote count: 3
has comment: http://stackoverflow.com/comment/43226975
has comment: http://stackoverflow.com/comment/43226884
has body: Your type is a java.sql.Date which is a java.util.Date which is considered special for Jackson. By default, it writes dates (instances of type java.util.Date) as their timestamps. You can disable this with objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false); or the corresponding configuration for your version of Jackson. This, however, will give you something like "2014-12-08T08:00:00.000+0000" It will not use your SimpleDateFormat. You can register a DateFormat with the ObjectMapper like so objectMapper.setDateFormat(new SimpleDateFormat("MM/dd/yyyy")); The best solution would be to use composition over inheritance. Do not extend java.util.Date directly or indirectly.
type: Answer
has comment: http://stackoverflow.com/comment/43226623
has comment: http://stackoverflow.com/comment/43227258
has comment: http://stackoverflow.com/comment/43225062
has comment: http://stackoverflow.com/comment/43223392
downvote count: 0
answers question: http://stackoverflow.com/q/27386883
has comment: http://stackoverflow.com/comment/43222990

http://stackoverflow.com/q/27419257
tagged with: java
tagged with: m2e
tagged with: eclipse
type: Question
score: 0
has body: I imported a small project with a pom file in Eclipse Kepler. Now (without me doing anything yet) this project is in red, and I am seeing these errors shown by Eclipse which I guess means I am missing some Eclipse plugin related to Maven support. "Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (execution: default-compile, phase: compile)" Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:2.3.2:testCompile (execution: default-testCompile, phase: test-compile) I already read here ... Plugin execution not covered by lifecycle configuration maven error ... that I can get into some m2e connector mess but I want to avoid this as I don't have much time to waste on all this, I just have to get some code running with or without Maven. Also, I noticed this question above is about 2 years ago. Btw, I tried what it says but Eclipse didn't allow the installation saying I am having some conflicting dependencies?! So I decided to ask a new question: Why am I seeing this error and what's the simplest, and most reliable way to get rid of it? I have no experience with Maven, I just have a basic idea what it's about.
linked to: http://stackoverflow.com/q/11448298
answer count: 1
has answer: http://stackoverflow.com/a/27419497
type: UnansweredQuestion
has title: Eclipse - Maven project error
tagged with: maven

http://stackoverflow.com/comment/134770114
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27325990
score: 4
has text: The question was about JUnit, where you need the change to be scoped to a single test function, not just changed globally.

http://stackoverflow.com/comment/43196690
type: Comment
type: QuestionComment
has text: @KarthickM Refer this [Link](http://stackoverflow.com/questions/18711342/android-google-map-version-2-shows-blank-white-page)
comment on: http://stackoverflow.com/q/27372686
score: 0

http://stackoverflow.com/q/27434340
has comment: http://stackoverflow.com/comment/43309734
accepted answer: http://stackoverflow.com/a/27434573
has comment: http://stackoverflow.com/comment/43309675
has comment: http://stackoverflow.com/comment/43309623
downvote count: 3
has body: I'm working on homework that asks me to research the java api for which class is inherited by the JFrame class that declares the setVisible method. Then, import that class and modify the code in the main method so the frame variable is declared as that type rather than the JFrame type. I've found what class declares the setVisible method, JWindow, but anytime I try to change the code it won't run so any help would be appreciated. import javax.swing.JFrame; import javax.swing.JWindow; //JFrame is inherited from java.awt.Frame class //setVisible is declared by the java.awt.Window class public class ProductFrame extends JWindow { public ProductFrame() { // all of these methods are available because // they are inherited from the JFrame class // and its superclasses this.setTitle("Product"); this.setSize(200, 200); this.setLocation(10, 10); this.setResizable(false); // this method uses a field that's available // because it's inherited this.setDefaultCloseOperation(EXIT_ON_CLOSE); } public static void main(String[] args) { // this creates an instance of the ProductFrame JWindow frame = new ProductFrame(); // this displays the frame frame.setVisible(true); } }
favorite count: 0
has answer: http://stackoverflow.com/a/27434573
has comment: http://stackoverflow.com/comment/43309687
tagged with: constructor
tagged with: swing
type: Question
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27434420
has title: Java Homework using inheritence
score: -2
tagged with: java
possible better answer: http://stackoverflow.com/a/27434420
answer count: 2
upvote count: 1
tagged with: jwindow

http://stackoverflow.com/comment/43303328
has text: @JeroenVannevel How do you figure that? The question says "what is the difference between abstract class and interface..."
comment on: http://stackoverflow.com/q/27430975
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/q/27409879
has body: I'm running an example from Apache Mahout 0.9 (org.apache.mahout.classifier.df.mapreduce.BuildForest) using the PartialBuilder implementation on Hadoop, but I'm getting an error no matter what I try. The error is: 14/12/10 10:58:36 INFO mapred.JobClient: Running job: job_201412091528_0004 14/12/10 10:58:37 INFO mapred.JobClient: map 0% reduce 0% 14/12/10 10:58:50 INFO mapred.JobClient: map 10% reduce 0% 14/12/10 10:59:44 INFO mapred.JobClient: map 20% reduce 0% 14/12/10 11:32:23 INFO mapred.JobClient: Task Id : attempt_201412091528_0004_m_000000_0, Status : FAILED java.io.IOException: All datanodes 127.0.0.1:50010 are bad. Aborting... at org.apache.hadoop.hdfs.DFSClient$DFSOutputStream.processDatanodeError(DFSClient.java:3290) at org.apache.hadoop.hdfs.DFSClient$DFSOutputStream.access$2200(DFSClient.java:2783) at org.apache.hadoop.hdfs.DFSClient$DFSOutputStream$DataStreamer.run(DFSClient.java:2987) There are no glaring errors in the datanode log file: 2014-12-10 11:32:19,157 INFO org.apache.hadoop.hdfs.server.datanode.DataNode.clienttrace: src: /127.0.0.1:50010, dest: /127.0.0.1:62662, bytes: 549024, op: HDFS_READ, cliID: DFSClient_attempt_201412091528_0004_m_000000_0_1249767243_1, offset: 0, srvID: DS-957555695-10.0.1.9-50010-1418164764736, blockid: blk_-7548306051547444322_12804, duration: 2012297405000 2014-12-10 11:32:25,511 INFO org.apache.hadoop.hdfs.server.datanode.DataNode.clienttrace: src: /127.0.0.1:50010, dest: /127.0.0.1:64109, bytes: 1329, op: HDFS_READ, cliID: DFSClient_attempt_201412091528_0004_m_000000_1_-1362169490_1, offset: 0, srvID: DS-957555695-10.0.1.9-50010-1418164764736, blockid: blk_4126779969492093101_12817, duration: 285000 2014-12-10 11:32:29,496 INFO org.apache.hadoop.hdfs.server.datanode.DataNode.clienttrace: src: /127.0.0.1:50010, dest: /127.0.0.1:64110, bytes: 67633152, op: HDFS_READ, cliID: DFSClient_attempt_201412091528_0004_m_000000_1_-1362169490_1, offset: 0, srvID: DS-9575556 ... or in the namenode file. The jobtracker just repea…
tagged with: mahout
has comment: http://stackoverflow.com/comment/43304920
linked to: http://stackoverflow.com/q/25232179
has answer: http://stackoverflow.com/a/27431965
has comment: http://stackoverflow.com/comment/43276146
upvote count: 1
type: Question
has title: Hadoop: All datanodes 127.0.0.1:50010 are bad. Aborting
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: mapreduce
tagged with: hadoop
downvote count: 0
answer count: 1
tagged with: hdfs
favorite count: 0
accepted answer: http://stackoverflow.com/a/27431965

http://stackoverflow.com/q/27369577
tagged with: parameters
tagged with: opencv
tagged with: java
type: Question
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27370060
has body: I'm trying to detect faces from a video stream using OpenCV 2.4.8 with Java using detectMultiScale. When searching through the web I noticed two versions of it with different parameter lists. Like here: detectMultiScale(image, faceDetections) in [here][1] and face_cascade.detectMultiScale( frame_gray, faces, 1.1, 2, 0|CV_HAAR_SCALE_IMAGE, Size(30, 30) ) When I used it inside my code it gives an error : OpenCV Error: Bad flag (parameter or structure field) (Unrecognized or unsupported array type) in cvGetMat When I debug the code I see that error occurs at line: face_cascade.detectMultiScale(frame_gray, faces); I'm confused with these two parameter method because in OpenCV documentation site they have only one method with seven parameters. detectMultiScale(const Mat&amp; image, vector&lt;Rect&gt;&amp; objects, double scaleFactor=1.1, int minNeighbors=3, int flags=0, Size minSize=Size(), Size maxSize=Size()) Can anyone please describe what is this two parameter method and does it has any connection with the error in my code. Following is the code I was checking on: import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.core.MatOfRect; import org.opencv.core.Point; import org.opencv.core.Rect; import org.opencv.core.Scalar; import org.opencv.core.Size; import org.opencv.highgui.Highgui; import org.opencv.highgui.VideoCapture; import org.opencv.imgproc.Imgproc; import org.opencv.objdetect.CascadeClassifier; public class FaceDetectSVM { /** * @param args */ public static void main(String[] args) { //load opencv native library System.loadLibrary(Core.NATIVE_LIBRARY_NAME); CascadeClassifier face_cascade = new CascadeClassifier("haarcascade_frontalface_alt.xml"); CascadeClassifier eyes_cascade = new CascadeClassifier("haarcascade_eye.xml"); String window_name = "Capture - Face detection.jpg"; System.out.println("capture through camera "+Core.VERSION); //load the face xml cascade if(!face_cascade.load("haarcascade_frontalface_alt.xml")) { System.out.print…
score: 2
upvote count: 2
type: UnansweredQuestion
has title: detectMultiScale parameters in OpenCV 2.4.8 , Java

http://stackoverflow.com/q/27318261
has title: separate string from numeric string pattern
answer count: 1
has answer: http://stackoverflow.com/a/27318313
favorite count: 0
type: UnansweredQuestion
tagged with: android
tagged with: regex
tagged with: java
downvote count: 3
upvote count: 1
type: Question
score: -2
has body: I am working on android project. I am getting sensor values from Accelerometer and Gyro sensor which are in the form A1 A2 A3 G1 G2 G3 for eg. consider string pattern"-553 39 -415 -540 168 -209".So how to extract -553,39,-415 values from this string pattern and assign to variables A1,A2,A3 and similarly extract -540,168,-209 and assign to G1,G2,G3.I have converted it into ArrayList But when reading values from it the app crashes. Any other Ideas to get result? Using ArrayList: String str= "-553 39 -415 -540 168 -209"; ArrayList&lt;String&gt; myList = new ArrayList&lt;String&gt;(Arrays.asList(str)); String x1 = myList.get(0); String y1 = myList.get(1); String z1 = myList.get(2); String x2 = myList.get(3); String y2 = myList.get(4); String z2 = myList.get(5); Log.d("Accel",x1 ); Log.d("Accel",y1 ); Log.d("Accel",z1 ); Log.d("Gyro",x2 ); Log.d("Gyro",y2 ); Log.d("Gyro",z2 );

http://stackoverflow.com/a/27388385
answers question: http://stackoverflow.com/q/27388201
type: Answer
has body: A null pointer exception occurs probably means that you are trying to access something which doesn't exist. In this case, your int[][] map is null and in the 2nd line of you search method, you are trying to get the map.length. Make any sense to you? Java is unable to get the length of an array which does not exist, thus giving your the nullPointerException. You can solve your problem by either: Pass in an array reference instead of null when calling your method. Do this in your main: searchMap search = new searchMap(); int[][] map = new int [5][5]; //Just an example search.search(map, 0); //Pass in an existing 2D array instead of null OR Add a check to see whether array is null You can do it as below: if (map== null) length = 0; else length = map.length; int row[] = new int[length]; Personally, as a habit, I will also suggest your refrain from using similar names for methods and objects.
score: 0

http://stackoverflow.com/q/27345193
answer count: 1
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/43149123
accepted answer: http://stackoverflow.com/a/27347208
has comment: http://stackoverflow.com/comment/43149134
type: AnsweredQuestion
has body: I have a JSON-file, which I want to convert to XML in JAVA to process some different things with the outcoming XML-structure. My file looks like this: { "published" : "2014-04-15T12:00:13.760Z", "actor" : { "objectType" : "person", "id" : "a00906a9-d3e3-40b5-8ef2-9e1051828c09", "displayName" : "Ashley Wessels" }, "verb" : "floating_run", "object" : { "objectType" : "experiments", "id" : "e9d9f71a-6c9e-4724-98d1-32dee57bb015", "content" : [ { "mass" : 10, "volume" : 392.2, "density" : 0.025497195308516064, "fluid" : 1 }, { "mass" : 150, "volume" : 150, "density" : 1, "fluid" : 1 }, { "mass" : 50, "volume" : 50, "density" : 1, "fluid" : 1 }, { "mass" : 50, "volume" : 100, "density" : 0.5, "fluid" : 1 }, { "mass" : 100, "volume" : 50, "density" : 2, "fluid" : 1 }, { "mass" : 400, "volume" : 300, "density" : 1.3333333333333333, "fluid" : 1 } ] }, "target" : { "objectType" : "experiment", "id" : "9383fbbe-e071-49b2-9770-46ddc4f8cd6e", "displayName" : "Grundel experiment" }, "generator" : { "objectType" : "application", "url" : "splash", "id" : "04123e9e-14d0-447b-a851-805b9262d9a6", "displayName" : "splash" }, "provider" : { "objectType" : "study", "url" : "http://go-lab.gw.utwente.nl/experiments/siswagrundel/", "id" : "0f8184db-53ba-4868-9208-896c3d7c25bb", "displayName" : "SiswaGrundel" }, "publishedClient" : "2014-04-15T12:17:03.902Z", "publishedServer" : "2014-04-15T12:00:13.760Z", "_id" : "534d1f4ddd5532e74400019f" } I used the org.json library and also tried some other libraries like JETTISON to create a xml-file from this guy but most of the `XML.toString()" methodd are not able to handle the JSONArray in this file. It just produces weird output of quotations marks etc. Is there a library which can handle this type of JSON structure? If not: how should I handle this file type? ** EDIT ** I have looked on the internet and found this file which seems to have the same structure as mine. But mine is encoded wrong, does anyone know why? Here it is: {"menu": { "header":…
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
has comment: http://stackoverflow.com/comment/43149222
has comment: http://stackoverflow.com/comment/43149099
has title: Create XML from JSON
score: 0
has answer: http://stackoverflow.com/a/27347208

http://stackoverflow.com/comment/43116942
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27329249
has text: Isn't that kind of validation saying good or bad? Or you are looking for checking some instance etc. Please clarify in the question.
score: 0

http://stackoverflow.com/q/27354438
answer count: 2
downvote count: 0
score: 4
possible better answer: http://stackoverflow.com/a/27773621
favorite count: 0
has answer: http://stackoverflow.com/a/27773621
tagged with: bigdata
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27354610
accepted answer: http://stackoverflow.com/a/27354610
tagged with: apache-storm
has title: nextTuple() is called infinite times using BaseRichSpout on Storm
upvote count: 4
has body: I implemented simple Storm topology having single spout and a bolt running on local cluster mode. for some reason nextTuple() of the spout is called more than once. Any idea why? code: spout: public class CommitFeedListener extends BaseRichSpout { private SpoutOutputCollector outputCollector; private List&lt;String&gt; commits; @Override public void declareOutputFields(OutputFieldsDeclarer declarer) { declarer.declare(new Fields("commit")); } @Override public void open(Map configMap, TopologyContext context, SpoutOutputCollector outputCollector) { this.outputCollector = outputCollector; } **//that method is invoked more than once** @Override public void nextTuple() { outputCollector.emit(new Values("testValue")); } } bolt: public class EmailExtractor extends BaseBasicBolt { @Override public void declareOutputFields(OutputFieldsDeclarer declarer) { declarer.declare(new Fields("email")); } @Override public void execute(Tuple tuple, BasicOutputCollector outputCollector) { String commit = tuple.getStringByField("commit"); System.out.println(commit); } } running configuration: public class LocalTopologyRunner { private static final int TEN_MINUTES = 600000; public static void main(String[] args) { TopologyBuilder builder = new TopologyBuilder(); builder.setSpout("commit-feed-listener", new CommitFeedListener()); builder .setBolt("email-extractor", new EmailExtractor()) .shuffleGrouping("commit-feed-listener"); Config config = new Config(); config.setDebug(true); StormTopology topology = builder.createTopology(); LocalCluster cluster = new LocalCluster(); cluster.submitTopology("github-commit-count-topology", config, topology); Utils.sleep(TEN_MINUTES); cluster.killTopology("github-commit-count"); cluster.shutdown(); } } thanks all, ray.

http://stackoverflow.com/comment/43207640
type: Comment
comment on: http://stackoverflow.com/a/27378964
score: 0
type: AnswerComment
has text: in the project i'm trying to finish that's exactly what we're expected to use, wait and notify! i'm using daniel liang's java programming as basic bibliography and although i love the book it doesn't help much in the multithreading subject because, like you said, wait and notify seems to be discouraged and deprecated... the book covers it very slightly.

http://stackoverflow.com/comment/43170409
has text: generally static is used for so called "utils" classes. I would avoid static usage when possible.
score: 0
comment on: http://stackoverflow.com/q/27358994
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43381549
comment on: http://stackoverflow.com/q/27473457
score: 0
type: Comment
type: QuestionComment
has text: String literals are "intern"ed which means there is actually only one String.

http://stackoverflow.com/q/27420161
has answer: http://stackoverflow.com/a/27420659
downvote count: 0
type: UnansweredQuestion
tagged with: java
tagged with: hibernate
type: Question
has title: Envers audits parent entity when inserting a sub-entity, but not when updating
tagged with: hibernate-envers
score: 4
has body: I have a Store/Clerks classes in my application, that are related via the "storeId" foreign key in the "clerks" DB table , and with the Hibernate annotations given in the following code: Store.java : @Entity @Audited @Table(name="stores") Public Class Store { private Set&lt;Clerks&gt; clerks; //.... @OneToMany(fetch = FetchType.LAZY, mappedBy = "store") public Set&lt;Clerks&gt; getClerks() { return clerks; } } Clerk.java: @Entity @Audited @Table(name="clerks") Public Class Clerk { private Store store; //.... @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "storeId",referencedColumnName = "storeId") public Store getStore() { return store; } } When I'm inserting (persisting) the new Clerk, Envers makes entries in audit tables of both entities ("stores_aud" and "clerks_aud") . But, when I'm updating the existing Clerk, it only makes an entry in the "clerks_aud" table. Can anyone explain to me, why this is happening, and how to enforce Envers to behave the same in both of the cases (insert and update)? Thank you
answer count: 1
linked to: http://stackoverflow.com/q/27250271
favorite count: 0
upvote count: 4

http://stackoverflow.com/comment/43373522
type: Comment
comment on: http://stackoverflow.com/a/27469121
has text: You can pass the controller as an argument when calling the view's constructor `View myView = new View(this)` inside the controller. Then the view can methods on the controller object. If you want to make something happen at the press of a button, please check out the `actionListener` page I linked in the original answer.
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43441503
type: QuestionComment
comment on: http://stackoverflow.com/q/27330664
score: 0
has text: Also, convert your statements to parameterized queries with nvarchar parameters. This will prevent any conversions *and* improve security and performance
type: Comment

http://stackoverflow.com/comment/43348054
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27455103
score: 0
has text: What version of eclipse are you running?

http://stackoverflow.com/comment/43324810
has text: @Holger The current code does not submit to the executor within the constructor. Therefore I believe it remains an unsafe publication. Could you comment on my example in my answer? (Either here or under my answer).
comment on: http://stackoverflow.com/a/27441491
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43183236
type: Comment
comment on: http://stackoverflow.com/a/27365647
score: 0
type: AnswerComment
has text: In both cases method3 from subclass will be called

http://stackoverflow.com/comment/43369693
comment on: http://stackoverflow.com/q/27464344
has text: @AasmundEldhuset Thank you for all the help! This is exactly what I needed to continue on!
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27421568
tagged with: http://stackoverflow.com/tag/csv
has title: BufferedWriter cannot restart
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43285622
has answer: http://stackoverflow.com/a/27421601
tagged with: java
has body: I am using the java bufferedwriter to write to a csv file. Everytime I run the program, the data is being written correctly to the file but the data from previous runs are still found in the file. I need the file to be empty each time before the bufferwriter starts again. I tried using the flush() method already. Anyone has some suggestions? The following is my code; if (!file.exists()) { file.createNewFile(); } FileWriter fw = new FileWriter(file.getAbsoluteFile(),true); BufferedWriter bw = new BufferedWriter(fw); bw.newLine(); bw.append(" " + epochs); bw.append(","); bw.append("badfact" + badfacts); bw.flush(); bw.close(); }
possible better answer: http://stackoverflow.com/a/27421680
has answer: http://stackoverflow.com/a/27421680
type: Question
has answer: http://stackoverflow.com/a/27421659
score: 0
has comment: http://stackoverflow.com/comment/43285953
accepted answer: http://stackoverflow.com/a/27421601
answer count: 3

http://stackoverflow.com/comment/43309254
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27433291
has text: If I'm understanding you correctly, other applications using your API are importing that package/class in hard code. The only way to ensure their code won't break is to ensure they can still import it. ClassLoaders won't help you, seeing how the package must physically exist publicly in order to import. This is why it's important to design API with scalability in mind from the start. There were 2 wrong moves made: renaming the package, then releasing before checking if it'll break legacy code. There's no way around this, unless you implement a system that changes the client's bytecode somehow

http://stackoverflow.com/comment/43361876
has text: My edit was before your additional information completely changed the question. You don't limit the size of the queue in your code. If you stream the data from the database using a cursor then you won't read the whole lot into memory at the same time.
score: 3
type: AnswerComment
comment on: http://stackoverflow.com/a/27462501
type: Comment

http://stackoverflow.com/comment/43349649
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27455691
has text: @PramodYadav I had already changed the variables to match my code. What exactly do you mean by removing the setOnCheckedChangeListener? Isn't it necessary to recognize the change.
score: 0

http://stackoverflow.com/q/27343448
type: AnsweredQuestion
tagged with: oop
has title: Java: Cannot access object's element
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27343631
type: Question
answer count: 2
possible better answer: http://stackoverflow.com/a/27343493
has answer: http://stackoverflow.com/a/27343493
accepted answer: http://stackoverflow.com/a/27343631
has body: This is a toy example. So, basically I created an ArrayClass object. I instantiate it in another class. But I cannot access its elements. I got this error: error: array required, but ArrayClass found What am I doing wrong here? import java.util.*; import java.io.*; import java.math.*; public class ArrayClass{ protected int[] input_array; protected int nElems; // multiple constructor public ArrayClass(){ // nothing here } public ArrayClass(int max){ input_array = new int [max]; nElems = 0; } public void insert(int value){ input_array[nElems++] = value; } } class ArrayApp{ public static void main(String[] args){ ArrayClass input_array = new ArrayClass(len); for(int i = 0; i &lt;= 10; i++){ System.out.println(input_array[i]); } }
favorite count: 0
upvote count: 2
has comment: http://stackoverflow.com/comment/43142279
has comment: http://stackoverflow.com/comment/43142324
downvote count: 1

http://stackoverflow.com/q/27448506
tagged with: android
has title: How do I make a alert message when a particular Android app starts opening
answer count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/3290936
tagged with: java
has body: How do I make my background process of my app make a alert message when a particular specified app with a package name started opening. I want my background process to fire a alert message when a some other apps gets open.
type: Question
has comment: http://stackoverflow.com/comment/47571045
has comment: http://stackoverflow.com/comment/43335860
score: 0
has comment: http://stackoverflow.com/comment/47570954

http://stackoverflow.com/q/27454696
has title: 400 bad request error in Spring
downvote count: 0
tagged with: java
tagged with: http://stackoverflow.com/tag/json
type: Question
score: 4
tagged with: rest
has body: I m getting this error any ideas what would cause it ? I m trying to send a DTO which has an List of objects which extends an abstract class.I thought that problem may accure maybe because of list in a DTO or because of sub classes from the abstract class ? @Autowired private RestClient restClient; @Override public ReceiptDto create_TicketIdentifier_For_Sale(TicketSaleDto tiDto) throws ServiceException { RestTemplate restTemplate = this.restClient.getRestTemplate(); String url = this.restClient.createServiceUrl("/ticketIdentifier/"); HttpHeaders headers = this.restClient.getHttpHeaders(); //headers.add("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE); HttpEntity<TicketSaleDto> entity = new HttpEntity<>(tiDto, headers); ReceiptDto ti = null; try { ParameterizedTypeReference<ReceiptDto> ref = new ParameterizedTypeReference<ReceiptDto>() {}; ResponseEntity<ReceiptDto> response = restTemplate.exchange(URI.create(url), HttpMethod.POST, entity, ref); ti = response.getBody(); // System.out.println(ti.getEntryDto().getReceiptDto().getCustomerDto().getLastname()); } catch (RestClientException e) { e.getStackTrace(); throw new ServiceException("Could not retrieve ticketIdentifiers: " + e.getMessage()); } return ti; 2014-12-13T02:21:34,867 [JavaFX Application Thread] DEBUG http.wire - http-outgoing-0 << "HTTP/1.1 400 Bad Request[\r][\n]" 2014-12-13T02:21:34,867 [JavaFX Application Thread] DEBUG http.wire - http-outgoing-0 << "Date: Sat, 13 Dec 2014 01:21:34 GMT[\r][\n]" 2014-12-13T02:21:34,867 [JavaFX Application Thread] DEBUG http.wire - http-outgoing-0 << "Content-Type: text/html; charset=ISO-8859-1[\r][\n]" 2014-12-13T02:21:34,867 [JavaFX Application Thread] DEBUG http.wire - http-outgoing-0 << "Cache-Control: must-revalidate,no-cache,no-store[\r][\n]" 2014-12-13T02:21:34,867 [JavaFX Application Thread] DEBUG http.wire - http-outgoing-0 << "Content-Length: 316[\r][\n]" 2014-12-13T02:21:34,868 [JavaFX Application Thread] DEBUG http.wire - http-outgoing-0 << "Serv…
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27473628
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43348561
upvote count: 4
tagged with: spring

http://stackoverflow.com/q/27325854
tagged with: http://stackoverflow.com/tag/csv
has body: I have a CSV file that I created. I am trying to pull the data and then run a check for certain data. CSV file contents. "12/05/14","Hay Square","10.00","10","","","" "12/05/14","Hay Round","75","1","","","" "12/05/14","Feed","12.50","10","","","" "12/05/14","Feet","10","","trusty","","" "12/05/14","Feed","4","5","","","" "12/05/14","Wormer","12.75","","trusty","","" "12/05/14","Feed","12","10","","","" "","Feed","","","","","" "12/05/14","Medicine","124.85","","sunny","","" "12/05/14","Feet","90","","speedy","","" I am using basic code and the print works fine to print what it finds but it simply will not compare VIA the if statement. I have searched everywhere and found nothing. Strange since I think this is commonly done. As you can see in the code I am simply looking for "Feed" and want to print found. This is just test code for a greater project so this is very unfinished. import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.Arrays; public class ReadCSV { public static void main(String[] args) { ReadCSV obj = new ReadCSV(); obj.run(); } public void run() { String csvFile = "c:/horse/horsespending.csv"; BufferedReader br = null; String line = ""; String cvsSplitBy = ","; try { br = new BufferedReader(new FileReader(csvFile)); while ((line = br.readLine()) != null) { // use comma as separator String[] country = line.split(cvsSplitBy); String test = country[1].toString(); String tester = "\"Feed\""; System.out.println("check " + country[1]); if(test == tester){ System.out.println("found"); } } } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { if (br != null) { try { br.close(); } catch (IOException e) { e.printStackTrace(); } } } System.out.println("Done"); } } OUTPUT: check "Purchase" check "Hay Square" check "Hay Round" check "Feed" check "Feet" check "Feed" check "Wormer" check "Feed" check "Feed" check "Medic…
tagged with: compare
tagged with: parsing
type: UnansweredQuestion
has title: Parse CSV pull data and compare but not working. Java
score: 0
has answer: http://stackoverflow.com/a/27325909
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27325967

http://stackoverflow.com/q/27377384
duplicate of: http://stackoverflow.com/q/1949066
has comment: http://stackoverflow.com/comment/43204367
tagged with: logging
has comment: http://stackoverflow.com/comment/43204327
has answer: http://stackoverflow.com/a/27377452
has comment: http://stackoverflow.com/comment/43204406
tagged with: java
type: Question
tagged with: logcat
linked to: http://stackoverflow.com/q/1949066
has comment: http://stackoverflow.com/comment/43204353
has body: i just have a crash on my app. but I don't know how to read my logcat. can someone guide me? 12-09 19:02:36.877: D/skia(11797): --- allocation failed for scaled bitmap 12-09 19:02:36.877: D/AndroidRuntime(11797): Shutting down VM 12-09 19:02:36.877: W/dalvikvm(11797): threadid=1: thread exiting with uncaught exception (group=0x417a5da0) 12-09 19:02:36.887: E/AndroidRuntime(11797): FATAL EXCEPTION: main 12-09 19:02:36.887: E/AndroidRuntime(11797): Process: com.example.baseapp, PID: 11797 12-09 19:02:36.887: E/AndroidRuntime(11797): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.baseapp/com.example.baseapp.Focusonautomotive}: android.view.InflateException: Binary XML file line #23: Error inflating class &lt;unknown&gt; 12-09 19:02:36.887: E/AndroidRuntime(11797): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2292) 12-09 19:02:36.887: E/AndroidRuntime(11797): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2350) 12-09 19:02:36.887: E/AndroidRuntime(11797): at android.app.ActivityThread.access$800(ActivityThread.java:163) 12-09 19:02:36.887: E/AndroidRuntime(11797): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1257) 12-09 19:02:36.887: E/AndroidRuntime(11797): at android.os.Handler.dispatchMessage(Handler.java:102) 12-09 19:02:36.887: E/AndroidRuntime(11797): at android.os.Looper.loop(Looper.java:157) 12-09 19:02:36.887: E/AndroidRuntime(11797): at android.app.ActivityThread.main(ActivityThread.java:5335) 12-09 19:02:36.887: E/AndroidRuntime(11797): at java.lang.reflect.Method.invokeNative(Native Method) 12-09 19:02:36.887: E/AndroidRuntime(11797): at java.lang.reflect.Method.invoke(Method.java:515) 12-09 19:02:36.887: E/AndroidRuntime(11797): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1265) 12-09 19:02:36.887: E/AndroidRuntime(11797): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1081) 12-09 19:02:36.887: E/AndroidRuntime…
has title: app crash after i select the 3rd function
has comment: http://stackoverflow.com/comment/43204459
score: 0
has comment: http://stackoverflow.com/comment/43233354
tagged with: android
answer count: 1
has comment: http://stackoverflow.com/comment/43205347
type: UnansweredQuestion

http://stackoverflow.com/q/27367835
tagged with: java
type: Question
score: 5
linked to: http://stackoverflow.com/q/24474986
upvote count: 5
downvote count: 0
has comment: http://stackoverflow.com/comment/43188202
tagged with: achievements
tagged with: android
has comment: http://stackoverflow.com/comment/43187851
has comment: http://stackoverflow.com/comment/43188223
answer count: 1
has title: java.lang.IllegalStateException: GoogleApiClient is not connected yet
has comment: http://stackoverflow.com/comment/43187953
favorite count: 0
has answer: http://stackoverflow.com/a/27570925
has body: I'm trying to add achievements to my game by using google play game services. The activity in my game that is responsible for giving the achievement already extends BaseGameActivity and it calls the beginUserInitiatedSignIn when it has to give the achievement, so the user must be signing in, but at the time I unlock the achievement for the user, I keep getting "java.lang.IllegalStateException: GoogleApiClient is not connected yet". Can anyone tell me what I am doing wrong? Here's the code responsible for unlocking the achievement(it's in the class that extends BaseGameActivity, from BaseGameUtils): private void darConquistaDerrubouArvore(int numeroDeAcertos) { // start the asynchronous sign in flow mSignInClicked = true; mGoogleApiClient.connect(); if(numeroDeAcertos &lt;= 40) { try { beginUserInitiatedSignIn(); Games.Achievements.unlock(gameHelper.getApiClient(), "CgkIs_27xcoSEAIQAQ"); Log.i("TelaModoCasual", "usuário não está logado"); this.onSignInFailed(); } catch(Exception exc) { exc.printStackTrace(); this.onSignInFailed(); } } }
type: UnansweredQuestion
tagged with: google-play

http://stackoverflow.com/comment/43094630
score: 0
has text: Use a `Map`. This format is not good for a POJO. These `"8028298d-ec50-4067-8286-feaa39bdba7b"` are your keys and the values are the object. That value object will be the object you have a POJO for. So it would map to `Map<String, POJO>`. There needs to be consistency with the object though. I just notice two of the same properties, that why I suggested this. But if you don't have any format, you are going to have a really tough time mapping the value object to a POJO
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27314742

http://stackoverflow.com/q/27341855
answer count: 0
tagged with: scala
has comment: http://stackoverflow.com/comment/43241182
type: Question
has comment: http://stackoverflow.com/comment/43142291
has body: I have the following java code: interface J { void f(int... a); void f(String... a); } How can it be overridden in scala? I'm getting an error double definition: method ... and ... have same type after erasure: (a: Seq)Unit with this code: class S extends J { def f(a: Int*) {} def f(a: String*) {} }
has title: scala/java incompatibility: overloaded methods with varargs
tagged with: java
score: 4
has comment: http://stackoverflow.com/comment/43140006
upvote count: 4
has comment: http://stackoverflow.com/comment/43238491
downvote count: 0
favorite count: 0
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/24132089
tagged with: type-erasure
has comment: http://stackoverflow.com/comment/43160954
tagged with: variadic-functions
duplicate of: http://stackoverflow.com/q/24132089

http://stackoverflow.com/q/27363908
upvote count: 1
has comment: http://stackoverflow.com/comment/43199926
tagged with: webdriver
type: Question
has answer: http://stackoverflow.com/a/27485237
has comment: http://stackoverflow.com/comment/43198518
has answer: http://stackoverflow.com/a/27375598
has comment: http://stackoverflow.com/comment/43200166
has comment: http://stackoverflow.com/comment/43180928
tagged with: cucumber
answer count: 2
has title: How to get the list of items from the p tags
accepted answer: http://stackoverflow.com/a/27485237
downvote count: 0
possible better answer: http://stackoverflow.com/a/27375598
favorite count: 0
has comment: http://stackoverflow.com/comment/43181431
has body: I am trying to write a test in cucumber jvm which grabs the customers address from the page and assert its is not null. Your details MR Test Test Selly Road London GBR TR02XZ I used xpath to find the first line of the address and the remaining p tags: private static final By CUSTOMER_ADDRESS = By.xpath("//*[@id='yourDetails']/div/p[position() >=2]"); This is what I wrote so far but for some reason even though in the xpath I have declared to grab all the p tags after the 2nd p tag my below test does not work: public List<WebElement> returnAllText(By element) { List<WebElement> all = driver.findElements(element); for (WebElement elements: all) { System.out.println(elements.getText()); } return all; } When the loop runs it finds each line of the address but then it is lost when the return statement is run. How do I catch/store each p tag value and then group it as one string value and assert it is not null I have debugged the code and the below is the results When I debug line and evaluate the expression: List<WebElement> all = driver.findElements(element) result = {java.util.ArrayList@4562} size = 4 [0] = {org.openqa.selenium.remote.RemoteWebElement@4564}"[[RemoteWebDriver: chrome on MAC (32479ef6b2783086b4c1d1ba0bbd1405)] -> xpath: //*[@id='yourDetails']/div/p[position() >=2]]" [1] = {org.openqa.selenium.remote.RemoteWebElement@4565}"[[RemoteWebDriver: chrome on MAC (32479ef6b2783086b4c1d1ba0bbd1405)] -> xpath: //*[@id='yourDetails']/div/p[position() >=2]]" [2] = {org.openqa.selenium.remote.RemoteWebElement@4566}"[[RemoteWebDriver: chrome on MAC (32479ef6b2783086b4c1d1ba0bbd1405)] -> xpath: //*[@id='yourDetails']/div/p[position() >=2]]" [3] = {org.openqa.selenium.remote.RemoteWebElement@4567}"[[RemoteWebDriver: chrome on MAC (32479ef6b2783086b4c1d1ba0bbd1405)] -> xpath: //*[@id='yourDetails']/div/p[position() >=2]]" Then I evaluate: for(WebElement elements: all) result = {java.util.ArrayList@4276} size = 4 [0] = {org.openqa.selenium.remote.RemoteWebElement@4288}"[[Re…
has comment: http://stackoverflow.com/comment/43179888
tagged with: selenium-webdriver
tagged with: xpath
type: AnsweredQuestion
score: 1
tagged with: java

http://stackoverflow.com/q/27382305
tagged with: java
downvote count: 3
upvote count: 1
type: Question
score: -2
tagged with: arrays
accepted answer: http://stackoverflow.com/a/27382356
has title: Adding several ArrayList elements into one ArrayList
tagged with: arraylist
answer count: 3
has answer: http://stackoverflow.com/a/27382394
linked to: http://stackoverflow.com/q/80476
favorite count: 0
possible better answer: http://stackoverflow.com/a/27382526
linked to: http://stackoverflow.com/q/189559
has comment: http://stackoverflow.com/comment/43213318
has answer: http://stackoverflow.com/a/27382526
tagged with: android
has body: I have several "ArrayList" Like this: ArrayList&lt;Integer&gt; list1; ArrayList&lt;Integer&gt; list2; ArrayList&lt;Integer&gt; list3; list1: [0,1,2] list2: [22,12,23,24,53] list3: [21,43,21,7] I want to put all elements of all lists into one ArrayList like sumList [0,1,2,22,12,23,24,53,21,43,21,7] How is that to be done? thx u
has answer: http://stackoverflow.com/a/27382356
duplicate of: http://stackoverflow.com/q/189559
type: AnsweredQuestion

http://stackoverflow.com/q/27459310
type: AnsweredQuestion
upvote count: 3
type: Question
has body: So I have a few .drlt files (normal txt files that serves me as templates for rule engine) and I need to read them and put in to some static string variable in bootstrap of application. I just cannot figure out where to put it in grails application and how to read them. I've tried put them to src/java and read them from src/grails, domain, service etc. None of that worked. The only thing that worked is to put it into grails-app/conf and read them like this: def classLoader = Thread.currentThread().contextClassLoader def fileReader = classLoader.getResourceAsStream('my-file.drlt').newReader() But I don't want to put my template files in config directory. I've read many posts and 'solutions' for this problem but non of them are good solutions. Is it really possible that this is unable to do nice in such a stable framework as Grails? Thanks for any help, Ivan
score: 3
tagged with: java
has answer: http://stackoverflow.com/a/27459460
tagged with: grails
tagged with: groovy
has title: Read file in grails
answer count: 1
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/27459460

http://stackoverflow.com/comment/43244590
score: 0
has text: No, I use Android Studio. But I created the HelloWorld.java example inside SublimeText with simple Copy/Paste and saving it C:\ServletDevel as it's mentioned in Tutorial.
comment on: http://stackoverflow.com/q/27399564
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43337592
comment on: http://stackoverflow.com/q/27443157
type: QuestionComment
has text: Just tried to compile the JGraphAdapterDemo.java with the jGrapT*.lib added in the eclipse properties. The error-message is "Rectangle2D cannot be resolved to a type".
score: 0
type: Comment

http://stackoverflow.com/a/27401222
type: Answer
has body: Yes, if you close the ObjectOutputStream, all pending write operations will be performed. That is because ObjectOutputStream calls innerStream.flush() wenn you call close() on it. And BufferedOutputStream also calls innerStream.flush() in its own flush method. All buffering stream classes I know do so.
upvote count: 1
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27400419
score: 1
accepted answer of: http://stackoverflow.com/q/27400419

http://stackoverflow.com/a/27341985
answers question: http://stackoverflow.com/q/27341953
accepted answer of: http://stackoverflow.com/q/27341953
score: 3
type: Answer
has comment: http://stackoverflow.com/comment/43139887
upvote count: 3
has body: You assign oldColor before you check the array bounds. You have to move it after the checks: if (x &lt; 0) return; if (y &lt; 0) return; if (x &gt;= pixels.length) return; if (y &gt;= pixels[x].length) return; // now it's safe to assign oldColor = pixels[x][y];
has comment: http://stackoverflow.com/comment/43141054
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43276963
comment on: http://stackoverflow.com/a/27416548
type: Comment
score: 0
type: AnswerComment
has text: It gives result as: TimeZone GMT+05:30 Timezon id :: Asia/Calcutta. I need to get IST not GMT

http://stackoverflow.com/q/27448779
tagged with: java
type: Question
upvote count: 0
downvote count: 5
has answer: http://stackoverflow.com/a/27448795
has title: missing return statement even method is having void return type
has body: am writing a java program as below. Void fun(int n){ for(int i=0;i&lt;=n;i++){ fun(n-i); } System.out.println(“well done”); } I am getting error, missing return statement. I not used int or string method. It is void method na. why it asking return type, please help for this problem.
answer count: 1
favorite count: 0
accepted answer: http://stackoverflow.com/a/27448795
has comment: http://stackoverflow.com/comment/43336354
type: AnsweredQuestion
score: -5

http://stackoverflow.com/a/27326648
answers question: http://stackoverflow.com/q/27325024
has body: Thanks for the extensive analysis. To be honest, the APPEND mode is a relatively recent addition to the outbound adapter and has not been optimized. I suspect the cost is simply because the stream is closed on each write (using FileCopy.copy()) which flushes to disk. We should definitely consider an option to keep the BufferedOutputStream open. It's a little tricky because the adapter supports writing to a different file for each message. I presume your use case is you always write to the same file, or some timestamp-based file name. We could provide some optimization to keep the file open until a request for a different file comes in, or even keep several file buffers open. At some, point, though, we would want to flush the buffer(s) if no new messages arrive after some time elapses. This adds some complexity (but not a lot). Of course, the downside is that there is a risk of data loss in the event of a power failure when you have data buffered in memory. This is a classic tradeoff - performance Vs. reliability; right now this adapter errs towards the latter. As always, feel free to open up a JIRA issue and we'll take a look.
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43171279
type: Answer
score: 2
accepted answer of: http://stackoverflow.com/q/27325024
upvote count: 2

http://stackoverflow.com/q/27333292
type: Question
has title: Send SimpleAdapter or ArrayList<Object> with Intent
has comment: http://stackoverflow.com/comment/43124338
tagged with: java
score: 0
answer count: 2
has comment: http://stackoverflow.com/comment/43124154
possible better answer: http://stackoverflow.com/a/27333509
tagged with: simpleadapter
tagged with: arraylist
has answer: http://stackoverflow.com/a/27333509
has body: I have codes like this. This is the first class which is the source one. List&lt;HashMap&lt;String, Object&gt;&gt; sonucList = new ArrayList&lt;HashMap&lt;String,Object&gt;&gt;(); HashMap&lt;String, Object&gt; searchHM = new HashMap&lt;String, Object&gt;(); searchHM.put("Name", eslenenName); searchHM.put("image", R.drawable.appicon); sonucList.add(searchHM); String[] from = { "Name","image"}; int[] to = { R.id.name,R.id.imageView1}; SimpleAdapter adapterSearch = new SimpleAdapter(getBaseContext(), sonucList, R.layout.list, from, to); The code is like this. I am creating a HashMap, putting some values more in my original code. I am adding these hashmaps to ArrayList with a for loop and creating a SimpleAdapter with this list. What I have to do is that, send this ArrayList or SimpleAdapter to a new class. I want to create a same listview with this adapter in another page. I tried with intent.putExtra() but putExtra doesn't accept Object it said. What can I do? Thanks.
tagged with: android
has answer: http://stackoverflow.com/a/27333655
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27333655
tagged with: android-intent

postfix-operator
tags question: http://stackoverflow.com/q/27441142
tag name: postfix-operator
type: Tag

http://stackoverflow.com/a/27357547
has body: If the myThread.join() call is interrupted, the thread is not joined. myThread will keep running, unaware of the fact that the thread that called joined has been interrupted. I have not seen this pattern myself, and I'd say it's a terrible pattern. You should never ignore an InterruptedException this way. See this post for a description on how to properly handle InterruptedExceptions.
downvote count: 0
answers question: http://stackoverflow.com/q/27357495
type: Answer
upvote count: 1
score: 1

junit
type: Tag
tags question: http://stackoverflow.com/q/27394473
tags question: http://stackoverflow.com/q/27344122
tags question: http://stackoverflow.com/q/27447557
tags question: http://stackoverflow.com/q/27365832
tags question: http://stackoverflow.com/q/27373605
tags question: http://stackoverflow.com/q/27325221
tags question: http://stackoverflow.com/q/27420675
tags question: http://stackoverflow.com/q/27411798
tags question: http://stackoverflow.com/q/27352503
tags question: http://stackoverflow.com/q/27424337
tags question: http://stackoverflow.com/q/27421784
tags question: http://stackoverflow.com/q/27354441
tags question: http://stackoverflow.com/q/27372656
tag name: junit
tags question: http://stackoverflow.com/q/27361486
tags question: http://stackoverflow.com/q/27322150
tags question: http://stackoverflow.com/q/27391055
tags question: http://stackoverflow.com/q/27314083
tags question: http://stackoverflow.com/q/27359845
tags question: http://stackoverflow.com/q/27412634
tags question: http://stackoverflow.com/q/27385308
tags question: http://stackoverflow.com/q/27395114
tags question: http://stackoverflow.com/q/27352137
tags question: http://stackoverflow.com/q/27323510
tags question: http://stackoverflow.com/q/27363310
tags question: http://stackoverflow.com/q/27348625
tags question: http://stackoverflow.com/q/27332524
tags question: http://stackoverflow.com/q/27421417
tags question: http://stackoverflow.com/q/27408974
tags question: http://stackoverflow.com/q/27445342
tags question: http://stackoverflow.com/q/27325382
tags question: http://stackoverflow.com/q/27326570
tags question: http://stackoverflow.com/q/27433916
tags question: http://stackoverflow.com/q/27462966
tags question: http://stackoverflow.com/q/27350353
tags question: http://stackoverflow.com/q/27446540
tags question: http://stackoverflow.com/q/27381326
tags question: http://stackoverflow.com/q/27443560
tags question: http://stackoverflow.com/q/27373264
tags question: http://stackoverflow.com/q/27446136

http://stackoverflow.com/a/27349506
has comment: http://stackoverflow.com/comment/43153643
has comment: http://stackoverflow.com/comment/43153745
has comment: http://stackoverflow.com/comment/43153710
answers question: http://stackoverflow.com/q/27349493
has comment: http://stackoverflow.com/comment/43153657
score: 0
has body: You are Accessing non-static method in a static method. see your public int setUnits(int newValue); this not static method . you cannot access it in a static method like your main public static void main(String[] args); you can access it through creating a new instance of that class This one may/should fix your problem. Create a new instance of that class on your main method :) Bicycle bike = new Bicycle(); bike.setUnits(someValue); //this is your setUnits method. or make your setUnit a static method. public static int setUnits(int someValue); by declaring any method or instance variable a static it means it is a class level or owned by that class. try to look at this. or this one :)
has comment: http://stackoverflow.com/comment/43153675
type: Answer
has comment: http://stackoverflow.com/comment/43153606
has comment: http://stackoverflow.com/comment/43153619

http://stackoverflow.com/q/27466476
duplicate of: http://stackoverflow.com/q/513832
favorite count: 0
score: -1
has body: I have an arrayList in a class and a getter for it. I need to make a method that returns an arrayList filled with all the files from the first arrayList that have the same name as the String arg. This is what I've come up with. ArrayList&lt;File&gt; dirs = new ArrayList&lt;File&gt;(); // filled with files public ArrayList&lt;File&gt; getDirectoriesNamed(String fileName) { ArrayList&lt;File&gt; files = new ArrayList&lt;File&gt;(); for (File file : dirs) { if (file.getName() == fileName) //problem is here files.add(file); } return files; } however when I try this, I get an empty arrayList. and I figured out that the reason is because of the if Statement... is there any reason why that shouldn't work that I'm not seeing?
type: UnansweredQuestion
has title: File.getName() not comparing properly to a String
has answer: http://stackoverflow.com/a/27466484
downvote count: 1
has comment: http://stackoverflow.com/comment/43369114
tagged with: if-statement
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27466495
answer count: 2
upvote count: 0
tagged with: arraylist
linked to: http://stackoverflow.com/q/513832
tagged with: string

http://stackoverflow.com/comment/43310249
has text: I've set the max width a box can have to 250 and the max height to 200.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27434612
score: 0

http://stackoverflow.com/q/27455691
tagged with: android
downvote count: 2
has comment: http://stackoverflow.com/comment/43349161
score: -2
has comment: http://stackoverflow.com/comment/43349849
tagged with: checkboxpreference
has comment: http://stackoverflow.com/comment/43352007
tagged with: java
tagged with: android-preferences
has title: Android, changing EditText based off of checkBoxPreference
has answer: http://stackoverflow.com/a/27455713
type: Question
upvote count: 0
has comment: http://stackoverflow.com/comment/43349679
has body: I am trying to add a basic setting to my app. I would like to change the hint of an EditText in one of my activities if the checkBox is unchecked. preferences.xml <?xml version="1.0" encoding="utf-8"?> SettingsActivity.java: package com.supermath.jacobgb24.supermath; import android.content.SharedPreferences; import android.os.Bundle; import android.preference.PreferenceActivity; import android.preference.PreferenceFragment; import android.preference.PreferenceManager; import static com.supermath.jacobgb24.supermath.R.xml.preferences; public class SettingsActivity extends PreferenceActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); addPreferencesFromResource(preferences); } } Code that I am trying to add changes to: public class Kinematics extends ActionBarActivity { static EditText tval, aval, vval, xval; static double a, t, x, v; static DecimalFormat fmt = new DecimalFormat("###,###.###"); public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.klayout); CheckBox cb1 = (CheckBox) findViewById(R.id.Check1); tval = (EditText) findViewById(R.id.time); aval = (EditText) findViewById(R.id.accel); vval = (EditText) findViewById(R.id.velocity); xval = (EditText) findViewById(R.id.xpos); cb1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton checkbox, boolean isChecked) { if (isChecked) { tval.setHint("YAY"); } else { tval.setHint("UNYAY"); } } }); } Solved Since I was using preferences I needed the following code: PreferenceManager.setDefaultValues(this, R.xml.preferences, true); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); boolean disp = prefs.getBoolean("PREF_SHOW_UNITS", true); if(disp) tval.setHint("t(s)"); tval.setHint("t(s)"); else if(!disp) tval.setHint("UNYAY");
answer count: 2
has comment: http://stackoverflow.com/comment/43349608
has comment: http://stackoverflow.com/comment/43349721
favorite count: 0
has comment: http://stackoverflow.com/comment/43349649
has comment: http://stackoverflow.com/comment/43349782
has comment: http://stackoverflow.com/comment/43349367
has answer: http://stackoverflow.com/a/27455769
type: UnansweredQuestion

http://stackoverflow.com/q/27405988
tagged with: weblogic
has comment: http://stackoverflow.com/comment/43263666
possible better answer: http://stackoverflow.com/a/35051932
has answer: http://stackoverflow.com/a/35051932
has comment: http://stackoverflow.com/comment/43265707
favorite count: 0
has comment: http://stackoverflow.com/comment/43266044
has body: I was remote debugging with Eclipse on my Ubuntu VM fine to a remote WebLogic application, then it stopped working. I have debug turned on in the remote server. From my VM I'm able to telnet into the remote debugging port. I've tried restarting Eclipse and setting the network connection to Direct. It just keeps timing out. Failed to connect to remote VM. Connection timed out. org.eclipse.jdi.TimeoutException In .log: !MESSAGE Failed to connect to remote VM. Connection timed out. !STACK 0 org.eclipse.jdi.TimeoutException at org.eclipse.jdi.internal.connect.SocketTransportService.attach(SocketTransportService.java:162) at org.eclipse.jdi.internal.connect.SocketTransportImpl.attach(SocketTransportImpl.java:45) at org.eclipse.jdi.internal.connect.SocketAttachingConnectorImpl.attach(SocketAttachingConnectorImpl.java:134) at org.eclipse.jdt.internal.launching.SocketAttachConnector.connect(SocketAttachConnector.java:141) at org.eclipse.jdt.internal.launching.JavaRemoteApplicationLaunchConfigurationDelegate.launch(JavaRemoteApplicationLaunchConfigurationDelegate.java:84) at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:885) at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:739) at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1039) at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1256) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
has comment: http://stackoverflow.com/comment/43261312
upvote count: 11
has answer: http://stackoverflow.com/a/74486133
has comment: http://stackoverflow.com/comment/43263802
has answer: http://stackoverflow.com/a/27412825
answer count: 5
tagged with: remote-debugging
linked to: http://stackoverflow.com/q/13960258
has comment: http://stackoverflow.com/comment/43264746
downvote count: 1
has comment: http://stackoverflow.com/comment/43266500
has comment: http://stackoverflow.com/comment/43266226
has answer: http://stackoverflow.com/a/67702240
has comment: http://stackoverflow.com/comment/43265511
accepted answer: http://stackoverflow.com/a/27412825
type: AnsweredQuestion
tagged with: java
score: 10
tagged with: eclipse
has answer: http://stackoverflow.com/a/33030618
type: Question
has title: Remote Debugging: Failed to connect to remote VM. Connection timed out
has comment: http://stackoverflow.com/comment/43263545

http://stackoverflow.com/comment/69407493
comment on: http://stackoverflow.com/a/27369159
type: Comment
has text: I agree, it's a very specific use case, but fortunately it's the most common one, too. There are many more simple apps with a single launcher/menu activity than more complex flows. Correction: this do have a *similar* effect as `finishAndRemoveTask`, not the *same one*, of course (and, as you can see, no other suggestions have been made, so it's the best we have for now). The rest of your analysis is mistaken: many activities can be in stack and even many instances of them, thanks to the FLAG_ACTIVITY_CLEAR_TOP flag. Anyway and most important: this is just a workaround for legacy devices.
score: 0
type: AnswerComment

date
tags question: http://stackoverflow.com/q/27407692
tags question: http://stackoverflow.com/q/27320200
tag name: date
tags question: http://stackoverflow.com/q/27470724
tags question: http://stackoverflow.com/q/27471328
tags question: http://stackoverflow.com/q/27324881
tags question: http://stackoverflow.com/q/27330338
tags question: http://stackoverflow.com/q/27344009
tags question: http://stackoverflow.com/q/27461443
tags question: http://stackoverflow.com/q/27468866
tags question: http://stackoverflow.com/q/27462841
tags question: http://stackoverflow.com/q/27409051
type: Tag
tags question: http://stackoverflow.com/q/27474626
tags question: http://stackoverflow.com/q/27387071
tags question: http://stackoverflow.com/q/27446761
tags question: http://stackoverflow.com/q/27427530
tags question: http://stackoverflow.com/q/27355552
tags question: http://stackoverflow.com/q/27441382
tags question: http://stackoverflow.com/q/27422520
tags question: http://stackoverflow.com/q/27447357
tags question: http://stackoverflow.com/q/27371909
tags question: http://stackoverflow.com/q/27375489
tags question: http://stackoverflow.com/q/27384910
tags question: http://stackoverflow.com/q/27367465
tags question: http://stackoverflow.com/q/27439760

http://stackoverflow.com/a/27450041
has comment: http://stackoverflow.com/comment/43352111
has comment: http://stackoverflow.com/comment/43346312
has comment: http://stackoverflow.com/comment/43340704
upvote count: 1
has comment: http://stackoverflow.com/comment/43346385
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27448512
answers question: http://stackoverflow.com/q/27448512
has body: You didn't understand how camera behaves. It doesn't matter if screen is 320x480 or 1080*1920 for camera. Camera uses own coordinate system. For example we have 1920*1080 screen. We DON'T wanna use pixels because it's bad practice. What we really want is to have own coordinate system of our world. If you have world 16*9 m then you can calculate that 1 m = 120 pixels. But your friend can have 800*450 screen and for him 1 m = 50 pixels. That's why we hardcode camera's width and height. But there is another problem here, the ratio. We considered that our ratio is 16/9 but some devices can have 4/3 ratio. Supporting a lot of ratios is very complex theme so i don't wanna mention it here. Screenshots on different ratios of my game If you want i can share with you my code. But note it isn't perfect and it's not complete game. And as you can see from screenshots i didn't hardcode height, only width. So i have empty space up and down.
type: Answer
has comment: http://stackoverflow.com/comment/43341694
has comment: http://stackoverflow.com/comment/43340536
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43352066

rounding
tags question: http://stackoverflow.com/q/27442112
tags question: http://stackoverflow.com/q/27450766
tag name: rounding
type: Tag

connection
tags question: http://stackoverflow.com/q/27384509
type: Tag
tags question: http://stackoverflow.com/q/27408305
tags question: http://stackoverflow.com/q/27330929
tags question: http://stackoverflow.com/q/27467901
tag name: connection
tags question: http://stackoverflow.com/q/27455679
tags question: http://stackoverflow.com/q/27419103

http://stackoverflow.com/comment/43117520
comment on: http://stackoverflow.com/a/27329413
score: 0
type: AnswerComment
has text: my data set is like the one iv pasted above
type: Comment

http://stackoverflow.com/q/27452742
has comment: http://stackoverflow.com/comment/43348866
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27453214
has title: How to get a Timer to work in it's own class for a simple game
has body: So I wanted to write the basics for a 2D game so I could look back at later if I forget and so I could create one without having to look over the same tutorials over and over again. Since the first game I made was a snake game almost a year ago(I've asked for help with this before), I looked back on it to find quite the mess! I only used one class for everything and I neglected to use comments to tell myself what each part of the code is doing what. I was using the tutorial from: http://www.java-gaming.org/index.php?topic=25802.0, but they use bufferStrategy, which I haven't used before, and Key Event / Key Adapter,which I was told to use ActionListener for the Snake Game instead. I know the main classes that I would be changing are ButtonHandler, Draw, and Player. I've already edited a few things: added limits to how far the square can go (so it doesn't go off screen) and a Variables class so that the other classes inherit it so I can change the size of the screen and square easily. I've tried coping and pasting the Timer into it's own class, but since I have very little knowledge of how to use a Timer, it doesn't work (obviously). My questions are: Can bufferStrategy work with Timer? Could I put a Timer with ActionListener in it's own class? Can bufferStrategy work like a Timer? Oh, and on top of that, what's the best way to make a start screen and inventory screen? How does it fit in with the main screen or should I just make a separate screen that pops up for both (if that is easier)? Edit: Alright, sorry, I was out watching a play. Here's the Draw class from the tutorial plus some edits for the variables. I was wondering which class the Timer would go into. Since the bufferStrategy was done in the Draw class, would the Timer be there as well? This also includes my unfinished version of a start screen. Draw class import java.awt.Canvas; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Graphics; import java.awt.image.B…
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/27453214
tagged with: timer
type: AnsweredQuestion

http://stackoverflow.com/comment/43153523
score: 0
type: Comment
type: QuestionComment
has text: What is the error you're getting?
comment on: http://stackoverflow.com/q/27349493

http://stackoverflow.com/q/27473727
tagged with: byte
type: Question
has body: i have just started playing around with java nio packages an am at a bit of a loss i have a client Socket s=new Socket(ip,port); OutputStream out=new OutputStream(); PrintStream ps=new PrintStream(s.getOutputStream()); String t=""hiya"; ps.print(t); ps.flush(); InputSTreamReader in=new InputSTreamReader(s.getInputSTream); BufferReader b=nwe BufferedReader(in); System.out.println(b.readLine());//prints echo response from server and on the server side this.selkey = selkey; this.chan = (SocketChannel) chan.configureBlocking(false); // asynchronous/non-blocking buf = ByteBuffer.allocateDirect(64); // 64 byte capacity void read() { try { int amount_read = -1; try { amount_read = chan.read((ByteBuffer) buf.clear()); } catch (Throwable t) { } if (amount_read == -1) disconnect();//deelts client on exit if (amount_read &lt; 1) return; // if zero System.out.println("sending back " + buf.position() + " bytes"); // turn this bus right around and send it back! buf.flip(); chan.write(buf);//sending data 2 client } catch (Throwable t) { disconnect(); t.printStackTrace(); } } what this does i send string t to the server into bytebuffer and echos it back which all works fine but hoiw would i print the string on the server side for example in read method buf.flip() System.out.write(buff);//which just prints what looks to be chinese
accepted answer: http://stackoverflow.com/a/27473909
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27473805
tagged with: server
has title: how to print string from bytebuffer
tagged with: java
possible better answer: http://stackoverflow.com/a/27473805
tagged with: nio
has answer: http://stackoverflow.com/a/27473909
type: AnsweredQuestion
tagged with: buffer

http://stackoverflow.com/q/27361410
tagged with: maven
has comment: http://stackoverflow.com/comment/43191324
tagged with: spring
has comment: http://stackoverflow.com/comment/43191171
tagged with: java
has comment: http://stackoverflow.com/comment/43292773
upvote count: 1
has comment: http://stackoverflow.com/comment/43178987
answer count: 0
has title: Deploy webapp on embedded tomcat7 with maven ?
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43175108
has body: I am trying to deploy my spring-based web app on embedded tomcat7 server using maven. Below is the maven configuration for tomcat7 maven plugin : org.apache.tomcat.maven tomcat7-maven-plugin 2.2 9090 / <addContextWarDependencies>true</addContextWarDependencies> When I access http://localhost:9090 , the app is not completly deployed (I only see the app title in the header). For starting up the embedded server and deploy the app , I used mvn clean install tomcat7:run What is the correct maven configuration to achieve this ? (if there is one)
has comment: http://stackoverflow.com/comment/43175745
downvote count: 0
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43240280
type: Question

http://stackoverflow.com/comment/43166617
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27356139
has text: But why you are not doing 1 li with 1 cell comparison?
score: 0

http://stackoverflow.com/comment/43352018
type: Comment
has text: http://itpeoplealwayswelcome.blogspot.in/2013/09/robot-programming-in-java.html
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27457369

http://stackoverflow.com/q/27334957
has comment: http://stackoverflow.com/comment/43127098
tagged with: java
type: Question
score: 0
has comment: http://stackoverflow.com/comment/43127074
answer count: 1
tagged with: arrays
tagged with: sorting
has title: How do i sort 2 parallel arrays
has comment: http://stackoverflow.com/comment/43126904
has body: I have 2 arrays, 1 1dimensional and another 2dimensional that i have to sort. The problem is that I don't know how to sort them in parallel. I already sorted the 1d array according to alphabetical order but I want to sort the 2d array accordingly. So I need to send these two arrays to a sort function that will return the two arrays sorted in ascending order while the elements in the 1d array "arr1" keep their corresponding elements in the 2d array "arr2". What I have so far: import java.io.*; import java.util.Scanner; import java.util.Arrays; public class JAVAhw15 { public static void main(String args[]) throws IOException { //required for input BufferedReader usrInput = new BufferedReader( new InputStreamReader(System.in)); Scanner user_input = new Scanner( System.in ); int row = 10; int col = 3; int size = 10; //Declare &amp; Initialize int arr2[][] = new int[row][]; String arr1[] = new String[size]; //construct 2d arr for(int i=0; i&lt;row; i++) { arr2[i] = new int[col]; } //Filling 1d array arr1 System.out.println("Enter 10 names please: "); for(int i=0; i&lt;size; i++) { arr1[i] = user_input.next(); } //Filling 2d array arr2 System.out.println("Enter 3 telephone numbers for each name entered"); for(int i=0; i&lt;row; i++) { for(int j=0; j&lt;col; j++) { System.out.println(arr1[i]+"'s Tel "+j+" is: "); arr2[i][j] = Integer.parseInt(usrInput.readLine()); } } System.out.println("After sort :"); String merged[] = new String[arr1.length]; for (int i=0; i&lt; arr1.length; i++) { merged[i] = arr1[i]+"=="+arr2[i]; } Arrays.sort(merged); for(int i = 0; i &lt; merged.length; i++) { System.out.println( (i+1) + ". "+ merged[i].split("==")[0] + "\t\t" + merged[i].split("==")[1]); } } }
has comment: http://stackoverflow.com/comment/43127023
has comment: http://stackoverflow.com/comment/43127233
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27335007

http://stackoverflow.com/a/27475293
type: Answer
has body: You could combine a buildpack that builds your frontend with your play buildpack using heroku-buildpack-multi: $ heroku config:add BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-multi.git From here you will need to create a .buildpacks file which contains the buildpacks you wish to run when you deploy: $ cat .buildpacks https://github.com/djng/heroku-buildpack-webapp-client.git https://github.com/heroku/heroku-buildpack-play I created the heroku-buildpack-webapp-client that supports grunt, bower and compass. Maybe you can use this one. The idea is that your repository contains a client folder containing your frontend and a gruntfile for your build process. The gruntfile should build your frontend into a client/dist folder.
accepted answer of: http://stackoverflow.com/q/27471035
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27471035

http://stackoverflow.com/comment/43119996
score: 2
comment on: http://stackoverflow.com/q/27331042
has text: use a collection. a list if you don't care about duplicates, or a set, if you do.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43352718
score: 0
has text: Then I suggest you take a look at the various loggers offered by `ant`, or create a custom one.
type: QuestionComment
comment on: http://stackoverflow.com/q/27434679
type: Comment

http://stackoverflow.com/q/27453577
has title: Error: constructor AverageFINAL in class AverageFINAL cannot be applied to given types;
type: Question
answer count: 2
tagged with: arrays
score: 0
has body: Objective: Create an AverageDriver class. This class only contains the main method. The main method should declare and instantiate an Average object. The Average object information should then be printed to the console. I'm having trouble with the creating the object part of the last code. I tried following along with my textbook but I'm still getting an error message. import java.util.Scanner; /** * The Average class calculates the average of the test * scores entered and puts the scores into descending order. */ public class AverageFINAL { private int[] data; public int calculateMean() { int total = 0; int mean; for (int index = 0; index &lt; data.length; index++) total += data[index]; mean = total / data.length; return mean; } public int selectionSort() { int startScan, index, minIndex, minValue; for (startScan = 0; startScan &lt; (data.length-1); startScan++) { minIndex = startScan; minValue = data[startScan]; for(index = startScan + 1; index &lt; data.length; index++) { if (data[index] &lt; minValue) { minValue = data[index]; minIndex = index; } } data[minIndex] = data [startScan]; data [startScan] = minValue; } return data[startScan]; } } import java.util.Scanner; public class AverageDriver { public static int main(String[] args) { int[] data = new int[5]; AverageFINAL object = new AverageFINAL(data); getValues(data); System.out.println("The test scores you entered, in descending order, are:"); System.out.println(object.selectionSort()); System.out.println("The average is" + object.calculateMean() +"."); } private static int getValues(int[] data) { Scanner keyboard = new Scanner(System.in); for (int index = 0; index &lt; data.length; index++) { System.out.println("Enter score #" + (index + 1) + ": "); data[index] = keyboard.nextInt(); } keyboard.close(); } } The error message I'm getting is: 1 error found: File: C:\Users\bryan\Downloads\AverageDriver.java [line: 9] Error: constructor AverageFINAL in class AverageFINAL cannot be applied to given types; required…
has answer: http://stackoverflow.com/a/27453593
has answer: http://stackoverflow.com/a/27453599
accepted answer: http://stackoverflow.com/a/27453593
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27453599
tagged with: java

http://stackoverflow.com/q/27347940
has answer: http://stackoverflow.com/a/27348404
tagged with: java
accepted answer: http://stackoverflow.com/a/27348050
type: Question
has title: Insert into sorted linked list
has body: I'm attempting to implement a sorted linked list with insertion, deletion, and check if integer exists methods and I'm currently having trouble understanding why my insertion method isn't working quite right. It inserts integers into the linked list but they are sorted backwards, I've tried moving around the conditionals but it doesn't work the way it should. void insert(int x){ LinkedList newLink = new LinkedList(x); if (front == null) { front = newLink; } else if (x &gt; front.x){ newLink.next = front; front = newLink; } else { LinkedList current = front.next; LinkedList before = front; while (current != null){ if (x &lt; front.x) { before = current; current = current.next; } newLink.next = before.next; before.next = newLink; } } }
has comment: http://stackoverflow.com/comment/43150647
score: 0
possible better answer: http://stackoverflow.com/a/27347994
has answer: http://stackoverflow.com/a/27347994
has answer: http://stackoverflow.com/a/27348050
has answer: http://stackoverflow.com/a/27348066
answer count: 4
type: AnsweredQuestion

http://stackoverflow.com/comment/65119835
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/34299835
has text: Why failed? what's the problem?
score: 0

http://stackoverflow.com/a/27457942
accepted answer of: http://stackoverflow.com/q/27457820
type: AcceptedAnswer
score: 4
type: Answer
upvote count: 4
has body: This code (specifically, it's called a match arm) has three relevant parts: c, if valid_identifier_char(c) and the block { selector.tag_name ... } The c is the pattern: that is, it tells the compiler what values to match against, and how to destructure them. All the previous arms used literal patterns, so they simply match against the specific character and don't capture anything. This pattern has a variable binding c, which means it will match anything, and whatever it matches should be bound to a variable c. As an aside: you can have patterns like: Some(x), which indicate that the arm should match an Option whose value is a Some, and that the contents of that Some should be bound to a variable x. The if ... is known as a condition guard. All that does is place an additional restriction on the arm. It makes it so that, irrespective of the pattern and the value being matched, the arm as a whole cannot match unless the condition evaluates to true. So, whilst the pattern c will match any value, the arm as a whole will not match unless valid_identifier_char(c) also evaluates to true. Finally, the block is simply the code that will be executed if the arm matches. I'm not big on Java, but I believe the code to be roughly equivalent to: // Actually should be "unsigned long", but Java. long _temp = this.next_char(); switch _temp { case 35: // First branch... break; case 46: // Second branch... break; case 42: // Third branch... break; default: long c = _temp; if valid_identifier_char(c) { // Fourth branch... } else { // Final branch... } break; } In general, however, match expressions don't always map nicely to a switch, especially if they do complex destructuring.
downvote count: 0
answers question: http://stackoverflow.com/q/27457820

http://stackoverflow.com/a/31202548
score: 0
has body: As of GWT 2.7.0, this isn't possible. You might want to follow this GWT bug. The -XmethodNameDisplayMode Full only applies to the browser's dev tools. So if you set this parameter and set a breakpoint in the source code, the method names of the call stack will be displayed correctly in dev tools. This doesn't affect the call stack produced by log output (which is what you posted in your question).
type: Answer
answers question: http://stackoverflow.com/q/27320573

http://stackoverflow.com/comment/43124154
has text: Not sure, but doesn't `intent.putExtra()` require a `Serializable`? In that case, making `SimpleAdapter` `implements Serializable` might already help.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27333292

http://stackoverflow.com/comment/43126426
type: QuestionComment
comment on: http://stackoverflow.com/q/27334637
has text: Ah! You guys are awesome...I also had to change the /* to just a /
type: Comment
score: 0

http://stackoverflow.com/comment/43136286
type: QuestionComment
has text: I want to code it this way, is it possible. jlabel.settext(" " + "text here" + " ") it will only display the image.
comment on: http://stackoverflow.com/q/27336547
score: 0
type: Comment

http://stackoverflow.com/q/27433261
has answer: http://stackoverflow.com/a/27437145
has body: I want to store a descriptor matrix generated by a random OpenCV descriptor extractor as a database entity. Assuming desc is the descriptor Matrix String s = (desc.reshape(1,1)).dump; To get the matrix back from the database, I did Mat desc = new Mat(numberOfRows * numberOfCols * numberOfChannels, 1, type); /* I stored number of rows and number of cols and type of the matrix separately and pass them to the function that returns the matrix */ String ss[] = s.substring(1, s.length -1).split(", "); int[] temp = new int[sss.length ]; for(int i = 0; i &lt; sss.length; i++) temp [i] = Integer.parseInt(sss[i]); MatOfInt int_values = new MatOfInt(temp); int_values.convertTo(desc, type); desc = fingerprint.desc(numberOfChannels, numberOfRows); This works fine but takes a lot of time, especially the .split method and the loop involving parseInt due to the large number of elements in the matrix (about 100k in my case). My question is: is there a better way to do this? my second question is, come on, assigning a 100K long string array and parsing it (given the fact that the strings are actually 2-3 characters at most) shouldn't really take 2 seconds, is it because Android/Java is slow
answer count: 2
tagged with: matrix
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/27437145
tagged with: android
score: 2
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43317003
upvote count: 2
tagged with: java
tagged with: feature-descriptor
linked to: http://stackoverflow.com/q/26815528
has title: Best way to convert an opencv matrix to string for storage in database in Android (Java)
type: Question
tagged with: opencv
possible better answer: http://stackoverflow.com/a/27453101
has answer: http://stackoverflow.com/a/27453101

http://stackoverflow.com/comment/43146617
comment on: http://stackoverflow.com/q/27345657
score: 0
type: Comment
type: QuestionComment
has text: if that doesnt solve your problem, try removing `import com.example.firstapp.R;` from your imports

http://stackoverflow.com/comment/43261841
has text: @MadProgrammer Unfortunately that did not fix the issue.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27391555

http://stackoverflow.com/a/27770287
downvote count: 1
has comment: http://stackoverflow.com/comment/44064200
score: -1
answers question: http://stackoverflow.com/q/27327931
upvote count: 0
has body: I had the same error and i ended up solving it by doing these steps (on linux) : You need to find which keystore java is using and import in that the base64 cert of the website you are trying to access to: for example on ubuntu, all java certificates are in /etc/ssl/certs/java/cacerts with default password being "changeit". to import the cert i had to use keytool in this way: keytool -importcert -trustcacerts -alias myalias -file path_to_cert_file -keystore /etc/ssl/certs/java/cacerts and use changeit as password when asked; i don't know where java keystore (usually named cacerts) is located on OsX. Of course you also need to export https://dl-ssl.google.com cert from a browser.
type: Answer

http://stackoverflow.com/a/27407092
has comment: http://stackoverflow.com/comment/43260153
accepted answer of: http://stackoverflow.com/q/27406960
downvote count: 0
has body: Your exception is ClassCastException: net.sf.ehcache.Element cannot be cast to net.sf.ehcache.Element This is an indication of a bigger problem. You most probably have 2 ehcace core or related jars in classpath. Catching the exception is not a solution. The exception should not happen in the first place.
answers question: http://stackoverflow.com/q/27406960
type: AcceptedAnswer
upvote count: 2
type: Answer
score: 2

jquery
tags question: http://stackoverflow.com/q/27331978
tags question: http://stackoverflow.com/q/27399612
tags question: http://stackoverflow.com/q/27318070
tags question: http://stackoverflow.com/q/27411774
type: Tag
tags question: http://stackoverflow.com/q/27379404
tags question: http://stackoverflow.com/q/27446335
tags question: http://stackoverflow.com/q/27444614
tags question: http://stackoverflow.com/q/27333173
tags question: http://stackoverflow.com/q/27395598
tags question: http://stackoverflow.com/q/27455597
tags question: http://stackoverflow.com/q/27376681
tags question: http://stackoverflow.com/q/27373313
tags question: http://stackoverflow.com/q/27445435
tags question: http://stackoverflow.com/q/27439463
tags question: http://stackoverflow.com/q/27375193
tags question: http://stackoverflow.com/q/27437768
tags question: http://stackoverflow.com/q/27366384
tags question: http://stackoverflow.com/q/27468716
tag name: jquery
tags question: http://stackoverflow.com/q/27398768
tags question: http://stackoverflow.com/q/27457663
tags question: http://stackoverflow.com/q/27315006
tags question: http://stackoverflow.com/q/27374454

http://stackoverflow.com/q/27347799
tagged with: spring
has comment: http://stackoverflow.com/comment/43453631
score: 2
type: AnsweredQuestion
tagged with: java
tagged with: mysql
accepted answer: http://stackoverflow.com/a/27348015
type: Question
has title: Spring + JPA: object does not get fetched from the database
tagged with: eclipselink
tagged with: jpa
downvote count: 0
answer count: 1
favorite count: 0
has body: I am implementing an online shop. I have the following code for saving an order: @Service @Transactional public class OrderServiceImpl extends GenericServiceImpl&lt;Order, Integer&gt; implements OrderService { @Inject private ItemRepository itemRepository; @Override public void saveOrder(Order order) { this.updateItemsAccordingToOrderedQuantities(order); repository.save(order); } private void updateItemsAccordingToOrderedQuantities(Order order) { List&lt;OrderedItem&gt; orderedItems = order.getOrderedItems(); for (OrderedItem orderedItem : orderedItems) { // fetch from database Item item = itemRepository.findOne(orderedItem.getItem().getId()); item.reduceWeightInColdStoreBy(orderedItem.getWeight()); itemRepository.update(item); } } } Before actually saving the order I update the "weight" property of each item (some quantity gets sold with this order, so there is less left). OrderedItem objects hold the reference to Item, but I want to fetch the fresh Item from the database (to additionally check there is enough on sale, in case Item table in database changed and UI didn't update before user submitted order). findOne method I am calling for this purpose is implemented as follows: @Repository public class GenericRepositoryImpl&lt;T, ID extends Serializable&gt; implements GenericRepository&lt;T, ID&gt; { @PersistenceContext EntityManager em; protected Class&lt;T&gt; entityClass; public GenericRepositoryImpl(Class&lt;T&gt; entityClass) { this.entityClass = entityClass; } @Override public T findOne(ID id) { return em.find(entityClass, id); } } After the call item is not null, but it is not fetched from the database: I have EclipseLink logging turned on, at "FINEST" level, and there is no SELECT query. I thought that it is because EclipseLink has this item in its persistence context, so it doesn't execute the query. So I've tried adding em.clear() before return in findOne method implementation, but it didn't help. How do I actually get the fresh item from the database? Th…
has answer: http://stackoverflow.com/a/27348015
upvote count: 2

http://stackoverflow.com/comment/43287236
type: Comment
has text: Learn about it. That's where the answer is hidden.
score: 0
comment on: http://stackoverflow.com/q/27422494
type: QuestionComment

http://stackoverflow.com/q/27403702
tagged with: java
has answer: http://stackoverflow.com/a/27414983
type: Question
answer count: 1
tagged with: libpqxx
tagged with: postgresql
score: 0
tagged with: libpq
tagged with: c++
type: UnansweredQuestion
has body: I'm using two tools here in university, wich both work with the same postgres database. The one written in Java uses the jdbc-driver and that works just fine. The second one written in C++ has some difficulties. It gives me following error Ident authentication failed for user "xyz" The connection string looks like this dbname=myDB user=xyz hostaddr=127.0.0.1 port=5432 connect_timeout=10 password=myPW I checked the values like 10 times and the are exactly the same in both applications. I thought it might be the pg_hba.cfg. So I tried a lot and finally got all doors open: # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all trust local all postgres ident local all all password # IPv4 local connections: host all all 192.168.185.0/24 trust host all postgres 127.0.0.1/32 ident host all all 127.0.0.1/32 trust # IPv6 local connections: host all all ::1/128 ident How can it be, that the C++ tool always tries to go with the indent authentification method despite a password is given. (Or is it the db..?) Are there any special cases in libpqxx I have to lookout for?
has title: postgres/libpqxx: Refuses authentication via password

http://stackoverflow.com/comment/43358569
has text: @courageous anonymous downvoter: "software tools commonly used by programmers;" http://stackoverflow.com/help/on-topic
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27460827
type: Comment

http://stackoverflow.com/comment/43349740
type: QuestionComment
comment on: http://stackoverflow.com/q/27455653
has text: Try it ...put your Drawable(Images) at a ArrayList and access it using Index number
score: 0
type: Comment

http://stackoverflow.com/q/27323398
tagged with: git
type: Question
accepted answer: http://stackoverflow.com/a/27323726
tagged with: java
tagged with: eclipse
score: 0
has title: Eclipse and Git - Repositories from GitHub not available from Import menu (Projects from Git are available)
answer count: 1
has body: I am trying to install doc4xj from Git per the instructions listed here --> http://www.docx4java.org/blog/2012/05/docx4j-from-github-in-eclipse/ I have installed Git in Eclipse (Kepler) from this update site: http://download.eclipse.org/egit/updates I am at the step where you select "Repositories from GitHub", but that option is not listed. The only option I have is "Projects from Git". I have installed version 3.5.2.201411120430-r. I have installed the following (everything available from http://download.eclipse.org/egit/updates) Eclipse Git Team Provider Eclipse Git Team Provider 3.5.2.201411120430-r Eclipse Git Team Provider - Source Code 3.5.2.201411120430-r Task focused interface for Eclipse Git Team Provider 3.5.2.201411120430-r JGit Co JGit mmand Line Interface for Java implementation of Git 3.5.2.201411120430-r Command Line Interface for Java implementation of Git - Source Code 3.5.2.201411120430-r Java implementation of Git 3.5.2.201411120430-r Java implementation of Git - optional Http support using Apache httpclient 3.5.2.201411120430-r Java implementation of Git - optional Java 7 libraries 3.5.2.201411120430-r Java implementation of Git - Source Code 3.5.2.201411120430-r I have not used Git before so I could be doing something obviously wrong. Thanks!
has answer: http://stackoverflow.com/a/27323726
tagged with: repository
type: AnsweredQuestion

http://stackoverflow.com/q/27345226
has comment: http://stackoverflow.com/comment/43145744
has answer: http://stackoverflow.com/a/27345273
type: UnansweredQuestion
upvote count: 1
tagged with: java
downvote count: 3
type: Question
score: -2
has comment: http://stackoverflow.com/comment/43145713
tagged with: arrays
has title: String into char on 2D array (java)
has answer: http://stackoverflow.com/a/27345573
answer count: 2
linked to: http://stackoverflow.com/q/434761
has comment: http://stackoverflow.com/comment/43145812
tagged with: string
has body: I am trying to fill a 2D char array with 5 words. Each string must be split into single characters and fill one row of the array. String str = "hello"; char[][] words = new char[10][5]; words[][] = str.toCharArray(); My error is at the 3rd line I don't know how to split the string "hello" into chars and fill only the 1st row of the 2-dimensional array
favorite count: 0
has comment: http://stackoverflow.com/comment/43146046

http://stackoverflow.com/q/27417037
tagged with: object
possible better answer: http://stackoverflow.com/a/27417085
tagged with: class
score: 0
has answer: http://stackoverflow.com/a/27417085
answer count: 3
has title: Why are two classes needed to create one object
favorite count: 0
has answer: http://stackoverflow.com/a/27417176
has answer: http://stackoverflow.com/a/27417051
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43277573
has body: I am new to java, when i studying this one http://docs.oracle.com/javase/tutorial/java/concepts/class.html, I have one doubt raised. that is. If we want create object need to create two classes or need to create one class? Because in this application, had created class Bicycle and class BicycleDemo . Can anyone guide me for this trivial question? Thanks in advance. Here is the code; class Bicycle { int cadence = 0; int speed = 0; int gear = 1; void changeCadence(int newValue) { cadence = newValue; } void changeGear(int newValue) { gear = newValue; } void speedUp(int increment) { speed = speed + increment; } void applyBrakes(int decrement) { speed = speed - decrement; } void printStates() { System.out.println("cadence:" + cadence + " speed:" + speed + " gear:" + gear); } } class BicyleDemo: class BicycleDemo { public static void main(String[] args) { // Create two different // Bicycle objects Bicycle bike1 = new Bicycle(); Bicycle bike2 = new Bicycle(); // Invoke methods on // those objects bike1.changeCadence(50); bike1.speedUp(10); bike1.changeGear(2); bike1.printStates(); bike2.changeCadence(50); bike2.speedUp(10); bike2.changeGear(2); bike2.changeCadence(40); bike2.speedUp(10); bike2.changeGear(3); bike2.printStates(); } }
tagged with: java
upvote count: 1
accepted answer: http://stackoverflow.com/a/27417051
downvote count: 1
type: Question

http://stackoverflow.com/q/27443510
type: Question
has answer: http://stackoverflow.com/a/27443543
has body: Can you tell me how to increase the size of the font using System.out.println in java.
has comment: http://stackoverflow.com/comment/88181090
tagged with: println
score: 2
downvote count: 0
has title: Change size of font System.out.println
answer count: 4
has answer: http://stackoverflow.com/a/27443526
favorite count: 0
upvote count: 2
type: UnansweredQuestion
tagged with: size
linked to: http://stackoverflow.com/q/439799
has comment: http://stackoverflow.com/comment/43326104
has answer: http://stackoverflow.com/a/39148988
tagged with: fonts
tagged with: java
has answer: http://stackoverflow.com/a/27443599

ksoap2
type: Tag
tags question: http://stackoverflow.com/q/27404406
tag name: ksoap2

http://stackoverflow.com/comment/43155776
score: 1
has text: then use/create another ArrayList for player handCard or another available collections.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27350590

http://stackoverflow.com/comment/49499973
has text: That isn't the same answer. if you look good it is another library.
type: Comment
comment on: http://stackoverflow.com/a/30721103
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43310040
comment on: http://stackoverflow.com/a/27433526
type: Comment
type: AnswerComment
has text: I can't get this to work. It's not adding attributes when doing submissions. Here is my question on that http://stackoverflow.com/questions/27434183/java-htmlunit-attributes-not-being-added-before-submitting-form
score: 0

http://stackoverflow.com/a/27331074
downvote count: 1
has comment: http://stackoverflow.com/comment/43120216
score: 3
upvote count: 4
has comment: http://stackoverflow.com/comment/43120136
has comment: http://stackoverflow.com/comment/43120863
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27330884
has comment: http://stackoverflow.com/comment/43120824
has comment: http://stackoverflow.com/comment/43120109
has body: You can't delete files anymore in Android 4.4.2. At least, not files that were created by other apps. This is a new (and dumb) restriction. What you have to do is Root your phone and then install an app like SDFix or something similar. That you way you gain full access to your SD Card again. That's currently the best way. Or you could try a "loophole", as in this post: How to delete a file from SD card?
accepted answer of: http://stackoverflow.com/q/27330884
type: Answer
has comment: http://stackoverflow.com/comment/43120037

http://stackoverflow.com/a/27469652
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/43374484
has body: Just make a thread that runs start then sleeps for record time then runs stop : final int time = second * 1000; Thread sound = new Thread(new Runnable() { @Override public void run() { start(view); try{ Thread.sleep(time); }catch(Exception e){} stop(); } }); sound.start(); or you can use CountDownLatch : CountDownLatch latch = new CountDownLatch(1); start(view); Thread stopping = new Thread(new Runnable() { @Override public void run() { try { latch.await(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } stop(view); } }); stopping.start(); and after the recording process finished: latch.countDown();
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43374560
answers question: http://stackoverflow.com/q/27469607
accepted answer of: http://stackoverflow.com/q/27469607
upvote count: 1

http://stackoverflow.com/a/27856622
type: Answer
upvote count: 9
score: 9
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27397419
answers question: http://stackoverflow.com/q/27397419
has body: A workaround for this problem is to wrap the standard CollectionDeserializer to return an empty collection for tokens containing whitespace and register the new Deserializer. I put the code into a Module so it can be registered easily: import java.io.IOException; import java.util.Collection; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.BeanDescription; import com.fasterxml.jackson.databind.BeanProperty; import com.fasterxml.jackson.databind.DeserializationConfig; import com.fasterxml.jackson.databind.DeserializationContext; import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.deser.BeanDeserializerModifier; import com.fasterxml.jackson.databind.deser.std.CollectionDeserializer; import com.fasterxml.jackson.databind.module.SimpleModule; import com.fasterxml.jackson.databind.type.CollectionType; public class XmlWhitespaceModule extends SimpleModule { private static class CustomizedCollectionDeserialiser extends CollectionDeserializer { public CustomizedCollectionDeserialiser(CollectionDeserializer src) { super(src); } private static final long serialVersionUID = 1L; @SuppressWarnings("unchecked") @Override public Collection&lt;Object&gt; deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { if (jp.getCurrentToken() == JsonToken.VALUE_STRING &amp;&amp; jp.getText().matches("^[\\r\\n\\t ]+$")) { return (Collection&lt;Object&gt;) _valueInstantiator.createUsingDefault(ctxt); } return super.deserialize(jp, ctxt); } @Override public CollectionDeserializer createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { return new CustomizedCollectionDeserialiser(super.createContextual(ctxt, property)); } } private static final long serialVersionUID = 1L;…

http://stackoverflow.com/comment/43092515
type: Comment
comment on: http://stackoverflow.com/a/27316159
type: AnswerComment
has text: Yes, still the same problem.
score: 0

http://stackoverflow.com/a/27459835
has comment: http://stackoverflow.com/comment/43356514
answers question: http://stackoverflow.com/q/27459797
type: Answer
accepted answer of: http://stackoverflow.com/q/27459797
has body: When you run an executable it is very common to need a shared library, whether you use Visual Studio .NET or Java or C++. When you compile a program for a specific platform, it usually only works on that platform or similar. If you want to run this program on Windows, you need to compile it for windows. BTW GCJ is pretty old and out of date. I suggest you use Java 7 or 8. This will avoid the need to install additional libraries and will run on Windows or Linux without re-compiling.
upvote count: 3
has comment: http://stackoverflow.com/comment/43356384
score: 3
has comment: http://stackoverflow.com/comment/43356547
has comment: http://stackoverflow.com/comment/43356637
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/116136455
has text: Not quite per the OP question. at @PostConstruct, this bean is constructed, like beans in this class scope is autowired, etc. but the application as a whole may not be ready, for instance, other beans may still in the process of injection or wiring.
type: Comment
comment on: http://stackoverflow.com/a/27406476
score: 1
type: AnswerComment

http://stackoverflow.com/a/27386086
type: Answer
answers question: http://stackoverflow.com/q/27383126
has body: How would I separate that one line into multiple lines as it should be so I can read each? I may be completely wrong about this, but it seems if your data seems to have newlines, they may actually be carriage returns. Check out String.split() Also check out the difference between \n and \r You can try something like String textStr[] = yourString.split("\\r?\\n"); Just as a side note, StringBuilder was built for this.
score: 0

http://stackoverflow.com/comment/43311457
type: QuestionComment
has text: @Carlos nah, that should not matter
comment on: http://stackoverflow.com/q/27435243
score: 0
type: Comment

http://stackoverflow.com/comment/43229297
type: QuestionComment
has text: The `WindowMenu` is been dynamically generated, this is not a particularly good solution. A better solution would be to link each `JCheckBoxMenuItem` with the `JInternalFrame` and monitor the state changes of the window directly, but that's me
score: 0
comment on: http://stackoverflow.com/q/27390150
type: Comment

http://stackoverflow.com/a/27440666
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27440408
has body: Answering your query to send emoticons : You have same set of smiley at all clients, i would say maintain an Enum for smileys, pass the identifier of the selected smiley instead of image and render accordingly.

http://stackoverflow.com/comment/43115164
type: QuestionComment
score: 1
has text: This question makes no sense to me.
comment on: http://stackoverflow.com/q/27328165
type: Comment

http://stackoverflow.com/q/27443992
type: Question
has answer: http://stackoverflow.com/a/27445197
downvote count: 0
answer count: 1
score: 6
favorite count: 0
has body: Does MySQL jdbc driver has built in support for database connection pools? (like Oracle has OracleDataSource class) I did a thorough search but couldn't find any. I know that I can use external libraries such as dbcp or boneCp and also that application servers such as tomcat and jboss supports connection pools. But I would be interested to know if MySQL does have it's own implementation of connection pools. Thank in advance.
tagged with: jdbc
upvote count: 6
accepted answer: http://stackoverflow.com/a/27445197
has title: MySQL implementation of connection pools
type: AnsweredQuestion
tagged with: java
tagged with: mysql

http://stackoverflow.com/comment/43156678
score: 0
comment on: http://stackoverflow.com/q/27328745
type: Comment
type: QuestionComment
has text: no because if I proceed with that I am not able to get position and other properties of each and every character in .html but if I go in this way i get all properties of every character

http://stackoverflow.com/comment/138667045
comment on: http://stackoverflow.com/a/27379155
type: AnswerComment
score: 0
has text: Correction: "length in bytes SHOULD be the same". Check the source code: https://github.com/apache/commons-io/blob/master/src/main/java/org/apache/commons/io/FileUtils.java#L417
type: Comment

http://stackoverflow.com/q/27337906
has comment: http://stackoverflow.com/comment/43132540
tagged with: oop
score: 0
answer count: 1
has body: I'm trying to create a class from a UML diagram and the interface description is confusing me as I'm not sure how to declare the last two methods for the Engine interface. I know that the first two are methods so they will be declared like void stop(); and void start(); But how do I declare the other methods in the interface? This is how I've declared the class, I'm wondering if this is correct? public interface Engine { void stop(); void start(); void throttle(int power); int getSpeed(); } This is the UML description of the interface:
tagged with: interface
has answer: http://stackoverflow.com/a/27337973
accepted answer: http://stackoverflow.com/a/27337973
has comment: http://stackoverflow.com/comment/43132522
type: AnsweredQuestion
tagged with: java
has title: Difference between throttle(int power) and getSpeed():int in a UML diagram?
has comment: http://stackoverflow.com/comment/43132477
type: Question

http://stackoverflow.com/comment/43103994
has text: Related question: http://stackoverflow.com/questions/26368748/declare-local-jar-file-as-a-transitive-dependency-of-a-library-project
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27319423

http://stackoverflow.com/comment/43105808
has text: Yes, the heap can be larger than physical memory. Not that I think it would be a good idea ... but it is possible
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27323215

http://stackoverflow.com/comment/43199442
type: Comment
comment on: http://stackoverflow.com/a/27371089
score: 0
type: AnswerComment
has text: @imallett In what situation would overloading the unary `+` be a good idea? Can anyone think of one?

http://stackoverflow.com/comment/43384128
has text: Reimeus: That worked perfectly. Simple replacement. Thank you.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27474738
type: Comment

http://stackoverflow.com/a/27422855
has comment: http://stackoverflow.com/comment/43288257
answers question: http://stackoverflow.com/q/27422788
has comment: http://stackoverflow.com/comment/43288568
has comment: http://stackoverflow.com/comment/43288393
has body: You are not checking the actual record, try this: ResultSet rs= s.executeQuery(query); f = rs.next();// true, if record exist else false In your case, your verifying whether rs object is equal to "" blank string or not and that wrong your suppose to verify the data. EDIT The above changes are for authenticate(), replace the below code with above said code ResultSet rs= s.executeQuery(query); if (rs.first()){ f= true; } P.S. use PreparedStatement in-case of runtime parameters for sql queries.
has comment: http://stackoverflow.com/comment/43288478
score: 0
has comment: http://stackoverflow.com/comment/43287955
has comment: http://stackoverflow.com/comment/43288877
has comment: http://stackoverflow.com/comment/43288960
type: Answer
has comment: http://stackoverflow.com/comment/43289031

http://stackoverflow.com/comment/43275372
type: Comment
type: QuestionComment
score: 3
has text: You create customized list view am right.Use `simple adapter` , `base adapter` or customized `array adapter` to achieve this.
comment on: http://stackoverflow.com/q/27415664

http://stackoverflow.com/comment/43102031
score: 0
type: QuestionComment
type: Comment
has text: @EJP Constructor ?????
comment on: http://stackoverflow.com/q/27320717

http://stackoverflow.com/comment/43088579
has text: Check sql that it produce
comment on: http://stackoverflow.com/q/27313949
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43177896
has text: you realize that using a `PreparedStatement` here is not doing anything since you are dynamically building the statement and it is completely susceptible to sql injection attacks still! If that is all that method is doing, then just **don't use it**.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27362563
score: 0

http://stackoverflow.com/comment/43335118
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27375790
type: AnswerComment
has text: Just so that other users know please include the link to your Liferay post as well in the question and vice-versa in the liferay forum. This helps the community to know whether it is answered somewhere or not. Will save valuable time of the community. Thanks. https://www.liferay.com/community/forums/-/message_boards/message/46355079

http://stackoverflow.com/a/32367717
score: 0
answers question: http://stackoverflow.com/q/27320120
has body: I was also having that issue. But with me, deleting bin folder and then clean and build project solved the issue. Actually duplicates files were in bin/res folder.
type: Answer

http://stackoverflow.com/comment/43274334
has text: I cannot use an ArrayList for this code. That would be a lot simpler of course, but it will not be accepted. I am very lost about adding another student to the array
type: Comment
comment on: http://stackoverflow.com/a/27415148
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43159687
has text: `List<ArmouredFightingVehicle> tanks = new ArrayList<ArmouredFightingVehicle>();` - You will need to import `java.util.*;` And then you will be able to add any type of tank and iterate through them using an advanced for loop
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27343914
type: Comment

http://stackoverflow.com/q/27445163
has title: Uploading profile photo to IBM Connections profile via Domino Agent
has comment: http://stackoverflow.com/comment/43340914
has body: I am trying to update profile images from a Domino Java agent using the Connections Java API. I have followed this guide and used this sample from greenhouse for inspiration. Although I don't get any exceptions, the images are not updated. Updating the telephone number works. Strange thing is, updating the jobtitle is also not working. What I am doing is: Create a basic endpoint ConnectionsBasicEndpoint endpoint = new ConnectionsBasicEndpoint(); endpoint.setUser("MY_USERNAME"); endpoint.setPassword("MY_PASSWORD"); endpoint.setUrl("MY_COMPANY_CONNECTIONS_URL"); endpoint.setForceTrustSSLCertificate(true); Get my Profile via the ProfileService and update the fields ProfileService profileService = new ProfileService(endpoint); Profile profile = profileService.getProfile(id); profile.setTelephoneNumber("123-123-123"); // this works profile.setJobTitle("my title"); //this does not work And to upload an image String id = profileService.getMyUserId(); profileService.updateProfilePhoto(file, id); //file is a java.io.File Has anybody experienced a similar issue? I also tried it with a user with administration rights, but that made no difference. I am working on IBM Domino 9.0.1, IBM Connections 5.0 CR1 and I am using the latest Social Business Toolkit from openntf.
score: 1
tagged with: java
tagged with: lotus-domino
type: Question
has comment: http://stackoverflow.com/comment/43330968
upvote count: 1
tagged with: ibm-connections
favorite count: 0
has comment: http://stackoverflow.com/comment/43331689
tagged with: ibm-sbt
has comment: http://stackoverflow.com/comment/43331212
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/44676653
type: UnansweredQuestion

http://stackoverflow.com/a/27488505
type: Answer
upvote count: 4
has body: I'm not aware of any shortcut to ease Java's reflection API. But you can always benefit from Groovy's terseness: import java.lang.reflection.* import java.lang.annotation.* @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.METHOD) @interface A {} class Annotated { @A def a() { "a" } @A def b() { "b" } def c() { "c" } } ann = new Annotated() methods = ann.class.methods.findAll { it.getAnnotation(A) } assert methods.size() == 2 assert methods.collect { it.invoke(ann) } == ["a", "b"]
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27469305
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27469305
score: 4

http://stackoverflow.com/q/27403127
score: 1
has comment: http://stackoverflow.com/comment/43250820
accepted answer: http://stackoverflow.com/a/27403879
favorite count: 0
type: Question
has title: Http doPost() does not work
has comment: http://stackoverflow.com/comment/43251826
has comment: http://stackoverflow.com/comment/43252145
tagged with: java
has comment: http://stackoverflow.com/comment/43251846
has comment: http://stackoverflow.com/comment/43250923
upvote count: 1
answer count: 1
has body: I am trying a simple login servlet with http doPost(). The Login.html is: Username :- Password :- My servlet code is: Server.java: public void doPost(HttpServletRequest req,HttpServletResponse res)throws IOException,ServletException { try { res.setContentType("text/html"); String un=req.getParameter("usnm"); String pw=req.getParameter("pswd"); if(un.equals("abc") && pw.equals("123")) res.sendRedirect("welcome.html"); else res.sendRedirect("nologin.html"); } catch(Exception e) { System.out.println(e.getMessage()); } } If login is successful then welcome.html is to be shown or else nologin.html. I added this to my web.xml: z Server z /P3 When I try to execute the Login.html after 'Login' click, I get error: can't find the file at /C:/Users/OWNER/Desktop/apache-tomcat-7.0.37/webapps/vaishnavee/P3. Please suggest some solution to make this work.
has answer: http://stackoverflow.com/a/27403879
tagged with: servlets
has comment: http://stackoverflow.com/comment/43250978
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43251706
downvote count: 0

http://stackoverflow.com/comment/43269878
type: QuestionComment
comment on: http://stackoverflow.com/q/27412096
has text: Make sure you UI is initialized and displayed within the context of the EDT, see [Initial Threads](http://docs.oracle.com/javase/tutorial/uiswing/concurrency/initial.html) for more details
score: 0
type: Comment

http://stackoverflow.com/comment/43093959
type: Comment
comment on: http://stackoverflow.com/q/27317055
has text: Can you describe which part of the algorithm you assume is not working adequately? It would help us to narrow down the scope which we should inspect.
score: 0
type: QuestionComment

http://stackoverflow.com/comment/43093883
type: QuestionComment
comment on: http://stackoverflow.com/q/27314412
has text: But it is able to create the file though. Doing some testing, I tried creating files instead of just appending, and it is creating new files without any problem. I'll edit the post to tell this
score: 0
type: Comment

http://stackoverflow.com/a/27459953
has comment: http://stackoverflow.com/comment/43356911
has comment: http://stackoverflow.com/comment/43356793
downvote count: 0
has comment: http://stackoverflow.com/comment/43356496
has comment: http://stackoverflow.com/comment/43356672
answers question: http://stackoverflow.com/q/27459780
type: Answer
has comment: http://stackoverflow.com/comment/43356574
has body: I am not sure why your code works at all. You should not be able to cast Object to 'double' because they are incompatible types. Also casting type int to double are incompatible types. Your first block of code: double a=1.5; int b=(int)a; System.out.println(b); will print "1". You will lose the decimals. If you want to just print the number before the decimal point then you can format your double when you print and you won't need to cast to type int. But the reason the other don't work is because you are trying to cast to an incompatible type. It is strange that you say the last two blocks of code Object a=1.5; double b=(double)a; int c=(int)b; System.out.println(c); Object a=1.5; int b=(int)(double)a; System.out.println(b); These should not work because of incompatible types.
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43356581
has comment: http://stackoverflow.com/comment/43356642

http://stackoverflow.com/q/27345241
tagged with: maven
score: 11
accepted answer: http://stackoverflow.com/a/27359107
upvote count: 11
type: AnsweredQuestion
tagged with: java
type: Question
tagged with: intellij-idea
answer count: 3
has answer: http://stackoverflow.com/a/27346110
downvote count: 0
has body: I am trying to use checkstyles google_checks.xml with maven-checkstyle-plugin. If I use the google_checks.xml with the latest checkstyle intelliJ plugin everything is correct but when I try configurating it via maven-checkstyle plugin I get this error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.13:check (default-cli) on project XX_XX_XX: Failed during checkstyle configuration: cannot initialize module TreeWalker - Unable to instantiate AvoidEscapedUnicodeCharacters: Unable to instantiate AvoidEscapedUnicodeCharactersCheck My pom.xml looks like this: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> [...] <checkstyle.file.path>develop/checkstyle/google_checks.xml</checkstyle.file.path> [...] [...] org.apache.maven.plugins maven-checkstyle-plugin 2.13 ${checkstyle.file.path} false org.apache.maven.plugins maven-checkstyle-plugin 2.9.1 ${checkstyle.file.path} false Do you guys have some suggestions about what could be wrong?
favorite count: 0
has answer: http://stackoverflow.com/a/27359107
tagged with: checkstyle
possible better answer: http://stackoverflow.com/a/27346110
has title: Error using checkstyle/google_checks.xml with maven-checkstyle-plugin
has answer: http://stackoverflow.com/a/27644568

http://stackoverflow.com/comment/43248120
score: 0
type: Comment
has text: 53 / 2 = 26, (int) 26.5 == 26. "integer" or the French "entier" means whole number, and you are right: only whole numbers can be stored.
comment on: http://stackoverflow.com/a/27401595
type: AnswerComment

http://stackoverflow.com/q/27413940
has comment: http://stackoverflow.com/comment/43272424
tagged with: java
has comment: http://stackoverflow.com/comment/43272004
has comment: http://stackoverflow.com/comment/43272162
has comment: http://stackoverflow.com/comment/43272129
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27414293
has comment: http://stackoverflow.com/comment/43272074
has comment: http://stackoverflow.com/comment/43272481
upvote count: 0
tagged with: writefile
has comment: http://stackoverflow.com/comment/43272500
score: -1
has comment: http://stackoverflow.com/comment/43271965
has comment: http://stackoverflow.com/comment/43272207
tagged with: arraylist
has comment: http://stackoverflow.com/comment/43272427
has comment: http://stackoverflow.com/comment/43272170
answer count: 1
accepted answer: http://stackoverflow.com/a/27414293
favorite count: 0
has comment: http://stackoverflow.com/comment/43272338
has comment: http://stackoverflow.com/comment/43272441
has title: writeFile() method doesn't write all lines to text file [JAVA]
has body: I am trying to write the contents of an arraylist to a text file. I am partially able to do this with my newbie coding skills, however at the moment it only writes the first line out of 48 lines to the text file. I would assume that this might be due to the fact that i do not have a loop anywhere in my code however, i am not entirely sure whether id need a while loop, or for loop and where exactly i would need to put it? Could this perhaps be also due to my readFile method using String(readAllBytes(get(filename))) as opposed to reading in line by line? public static void main(String... p) throws IOException { List&lt;SensorInfo&gt; readings = new ArrayList&lt;&gt;(); String filedata = readFile("client-temp.txt"); SensorInfo info = new SensorInfo(filedata); readings.add(info); String data = createStringFromInfo(readings); System.out.println("Lines: " + readings.size()); writeFile("datastore.txt", data); } } writeFile public static void writeFile(String filename, String content) { try { Files.write(get(filename), content.getBytes()); } catch (IOException e) { System.out.println("Error wiring file: " + e); } } createStringFromInfo public static String createStringFromInfo(List&lt;SensorInfo&gt; infoList) { String data = ""; for (SensorInfo info : infoList) { data += info.asData(); } return data; } SensorInfo http://pastebin.com/9DDDGzwV
has comment: http://stackoverflow.com/comment/43272091
type: AnsweredQuestion

http://stackoverflow.com/q/27334099
has comment: http://stackoverflow.com/comment/43125489
type: Question
tagged with: encoding
tagged with: androidhttpclient
tagged with: base64
has answer: http://stackoverflow.com/a/27334205
answer count: 1
has body: I need to send larger video files (and other files) to server with base64 encode. I get out of memory exception, because I want to store the file in the memory (in byte[]) then encode it to string with Base64.encodeToString. But how can I encode the file and send it out on-the-air and/or using less memory? Or how can I do this better? To the request I using now MultipartEntityBuilder after I build it, I send it out to the server with post method and with the file I need to send other data too. So I need to send both in one request and the server only accepts files with base64 encoded. OR Because I using Drupal's REST module to create content from posts, it's another solution for me, if I can send normal post with a normal form. (like the browser does) The problem is, I can't find, just only one solution. When you call the &lt;endpoint&gt;/file url and you pass four things, these are: array("filesize" =&gt; 1029, // file size "filename" =&gt; "something.mp4", //file name "uid" =&gt; 1, // user id, who upload the file "file" =&gt; "base64 encoded file string") After this request I get an fid, which is the uploaded file's id. I need to send this with the real content, when I create node. If I can send the file with normal post mode (without encode) like the browser does at form send, it would be better.
tagged with: android
accepted answer: http://stackoverflow.com/a/27334205
type: AnsweredQuestion
has title: Post base64 encoded video to server, OutOfMemoryError
has comment: http://stackoverflow.com/comment/43125440
score: 0
tagged with: java

http://stackoverflow.com/comment/43296794
comment on: http://stackoverflow.com/a/27426309
type: Comment
has text: @JoopEggen Yeah, well, since I realized that it wouldn't really show much of an improvement I didn't see a point in keeping it. - Trying to solve set operations via some numeric representation is, of course, quite unnecessary.
score: 0
type: AnswerComment

http://stackoverflow.com/q/27321862
has body: We have recently started a project to store a load of data on a Hadoop / HBase cluster. I have followed the tutorial in the Apache 'Quick Start' guide, and have got a small standalone HBase instance running successfully on one of our servers. I am able to use HBase shell to create tables, put data, get, scan etc - looks good! Now my problem: our servers where HBase will be installed are all linux, but all the developers in my company use Windows machines - it would be nice if we didn't have to make everyone in the company install Cygwin just to use the Java API. Currently, when I try to connect running from inside Eclipse with the Java API, I get the following error: ERROR 2014-12-05 17:13:05,910 [TESTING] {main} Shell - Failed to locate the winutils binary in the hadoop binary path java.io.IOException: Could not locate executable null\bin\winutils.exe in the Hadoop binaries. Followed eventually by: org.apache.hadoop.hbase.client.NoServerForRegionException: Unable to find region for row1 after 0 tries. My question is: is it possible to use the Java API for HBase on Windows, connecting to a server running on Linux, without installing Cygwin, Hadoop and HBase on every developer's machine? Alternatively, would another package such as Kundera be able to connect without Cygwin? If not, how does the REST API compare in performance to the native Java API? I could always write my own wrapper for that and distribute it to our developers (although no doubt something like that may already exist). Any help on this would be much appreciated as I'm having trouble finding a definitive answer on Google!
type: Question
tagged with: java
score: 4
tagged with: hadoop
downvote count: 0
has title: HBase Java API client on Windows without Cygwin?
favorite count: 0
tagged with: windows
upvote count: 4
answer count: 0
tagged with: hbase
type: UnansweredQuestion

http://stackoverflow.com/comment/43181736
type: QuestionComment
has text: @ArjunPatel Is O(logn) too large? What is your usecase?
score: 0
comment on: http://stackoverflow.com/q/27364907
type: Comment

http://stackoverflow.com/comment/43233924
type: Comment
has text: even when I converted s.length to s.lenght() ,and I add to my code. my code gives me **Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous tree type: <any> at Test.encode(Test.java:19) at Test.main(Test.java:13) Java Result: 1**
score: 1
comment on: http://stackoverflow.com/a/27393237
type: AnswerComment

http://stackoverflow.com/q/27410216
tagged with: jsonschema
upvote count: 24
type: Question
accepted answer: http://stackoverflow.com/a/27410298
downvote count: 0
tagged with: inheritance
tagged with: binding
answer count: 3
has comment: http://stackoverflow.com/comment/79990861
favorite count: 0
has answer: http://stackoverflow.com/a/61141458
has answer: http://stackoverflow.com/a/27410298
possible better answer: http://stackoverflow.com/a/45388533
has answer: http://stackoverflow.com/a/45388533
type: AnsweredQuestion
has title: JSon schema and Inheritance
has body: I have searched on json schema with java bindings with inheritance and all searches led me to the usage of "allOf". Using allOf would potentially solve my problem, but I am wondering if there is a construct in json schema that I can use which will generate my java code with real java inheritance "B extends A" - rather than inlining all properties from A inside B ? I am wondering if this is even supported / doable or I am just dreaming. If not supported, I would be curious to know the reason.
tagged with: java
tagged with: http://stackoverflow.com/tag/json
score: 24

http://stackoverflow.com/q/27318330
favorite count: 0
tagged with: soap
tagged with: web-services
score: 2
type: AnsweredQuestion
downvote count: 0
tagged with: java
tagged with: http
type: Question
has body: Hope you can help me here. I need to get authentication from a request to a WebService and then act according to the validation of this credentials. Now I am achieving it with get(MessageContext.HTTP_REQUEST_HEADERS);. Do you know a way of using the Soap Header instead of Http Header ? Hope you do!
has title: WebService Authentication with Soap Header
upvote count: 2
has answer: http://stackoverflow.com/a/29243193
accepted answer: http://stackoverflow.com/a/29243193
answer count: 1

onclicklistener
tag name: onclicklistener
tags question: http://stackoverflow.com/q/27350614
tags question: http://stackoverflow.com/q/27431434
type: Tag

http://stackoverflow.com/q/27393599
has comment: http://stackoverflow.com/comment/43275345
answer count: 2
downvote count: 0
linked to: http://stackoverflow.com/q/26718216
favorite count: 0
linked to: http://stackoverflow.com/q/20426734
has comment: http://stackoverflow.com/comment/43277652
has answer: http://stackoverflow.com/a/27394913
tagged with: spring
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/75863022
upvote count: 2
has body: I am using Spring with Hibernate in my project. I want to get users by a particular role using Hibernate criteria. My User model is connected with Role model using @ManyToMany annotation: @ManyToMany(fetch = FetchType.EAGER) @Fetch(FetchMode.SELECT) @JoinTable( name = "user_role", joinColumns = {@JoinColumn(name = "user_id")}, inverseJoinColumns = @JoinColumn(name = "role_id") ) public Set&lt;Role&gt; getRoles() { return roles; } and here is my criteria in my UserDaoHibernate: public List&lt;User&gt; getUsersByRole(List&lt;Role&gt; roles) { List users = getSession().createCriteria(User.class) .add(Restrictions.in("roles", roles)).list(); return users; } I am getting DataIntegrityViolationException when executing this criteria. Am i missing something or is there any correct way of getting users by their roles?
has answer: http://stackoverflow.com/a/75863022
linked to: http://stackoverflow.com/q/4032434
accepted answer: http://stackoverflow.com/a/27394913
type: Question
tagged with: spring-mvc
has title: How to get users by their roles using hibernate criteria in Spring
linked to: http://stackoverflow.com/q/15510748
has comment: http://stackoverflow.com/comment/43235174
tagged with: java
tagged with: hibernate

http://stackoverflow.com/comment/43125876
score: 0
type: AnswerComment
has text: Did you try the snippet I posted above?
type: Comment
comment on: http://stackoverflow.com/a/27334405

http://stackoverflow.com/a/27406595
answers question: http://stackoverflow.com/q/27406357
score: 0
type: AcceptedAnswer
has body: In Spring Security 3.2.5 SecurityContextHolder is in org.springframework.security.core.context
type: Answer
accepted answer of: http://stackoverflow.com/q/27406357

http://stackoverflow.com/q/27419671
has body: i'm getting an Mapper class not found error when executing the program using run as hadoop in eclipse but when i execute by creating jar its working correctly I have check that all the classes present in classpath. I need to connect this MapReduce program from eclipse its self to back-end process.. This is my code public class DBDriver extends Configured implements Tool { public int run(String[] args) throws Exception { // TODO Auto-generated method stub //Configuration conf = new Configuration(); String dbName = "bigdata"; String tableName = "cpr_transaction"; Job job = Job.getInstance(getConf()); HCatInputFormat.setInput(job, dbName, tableName); job.setJarByClass(DBDriver.class); //job.setJar("/home/murali/workspace/hadoop/DBReader/target/DBReader-0.0.1-SNAPSHOT.jar"); job.setMapperClass(DBMapper.class); job.setReducerClass(DBReducer.class); job.setInputFormatClass(HCatInputFormat.class); job.setMapOutputKeyClass(Text.class); job.setMapOutputValueClass(Text.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(DoubleWritable.class); FileOutputFormat.setOutputPath(job, new Path("/user/murali/output/HiveIO")); return(job.waitForCompletion(true)? 0:1); } public static void main(String[] args) throws Exception { int exitStatus = ToolRunner.run(new DBDriver(), args); System.exit(exitStatus); } public static class DBMapper extends Mapper&lt;Writable, HCatRecord, Text, Text&gt; { String amount; String outlet; public void map(Writable key, HCatRecord value, Mapper&lt;Writable, HCatRecord, Text, Text&gt;.Context context) throws IOException, InterruptedException { amount = (String) value.get(8); outlet = (String) value.get(3); context.write(new Text(outlet), new Text(amount)); } } public class DBReducer extends Reducer&lt;Text, Text, Text, DoubleWritable&gt; { public void reduce(Text key, Iterable&lt;Text&gt; values, Reducer&lt;Text, Text, Text, DoubleWritable&gt;.Context context) throws IOException, InterruptedException { double totalAmount = 0.0; for (Text te…
has title: Hadoop MapReduce Program Connecting to database
tagged with: mapreduce
tagged with: hadoop
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43283455
has answer: http://stackoverflow.com/a/27420411
has comment: http://stackoverflow.com/comment/43285788
type: UnansweredQuestion
tagged with: java
type: Question
tagged with: hive

http://stackoverflow.com/comment/43297518
type: Comment
has text: i've been able to create the login/signup page and even allowed the administrator to add users but i started working on the delete user activity and im lost
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27426036

http://stackoverflow.com/q/27371983
tagged with: jpa
answer count: 1
has comment: http://stackoverflow.com/comment/43201390
score: 0
tagged with: oracle-database
type: UnansweredQuestion
type: Question
tagged with: java
has title: Temp space behaviour when oracle query called form Java Persistence
has comment: http://stackoverflow.com/comment/43207001
has comment: http://stackoverflow.com/comment/43206315
has body: The problem is when i run query from Pl/sql developer its giving result, But when i am running query from my java application it will give following error. 08:46:49,106 WARN [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (SimpleAsyncTaskExecutor-3) SQL Error: 1652, SQLState: 72000 08:46:49,107 ERROR [org.hibernate.engine.jdbc.spi.SqlExceptionHelper] (SimpleAsyncTaskExecutor-3) ORA-01652: unable to extend temp segment by 128 in tablespace TEMP So Is there any behavior change for allocating temp memory when i called from the java application. Thanks
has answer: http://stackoverflow.com/a/27374993

http://stackoverflow.com/comment/43229534
score: 0
type: Comment
type: QuestionComment
has text: @CandiedOrange: I guess I don't know what you mean by "paired down into sets." The 2d array cannot have duplicates in rows, but the rows CAN contain only one kind of integer, for instance, row A could be all 2's, and row B could be all 3's and they would be considered disjoint.
comment on: http://stackoverflow.com/q/27389263

http://stackoverflow.com/comment/43292233
has text: @kazik1616: Yes looks like that. Thanks for the info. I'll check and let you know
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27353060

http://stackoverflow.com/a/27466860
has comment: http://stackoverflow.com/comment/43370101
downvote count: 1
has comment: http://stackoverflow.com/comment/43369943
has comment: http://stackoverflow.com/comment/43370084
has comment: http://stackoverflow.com/comment/43371669
type: Answer
answers question: http://stackoverflow.com/q/27466774
has comment: http://stackoverflow.com/comment/43370105
has body: Do not catch RuntimeExceptions and Errors, catch other exceptions or add throws to method declaration
has comment: http://stackoverflow.com/comment/43372528
upvote count: 0
has comment: http://stackoverflow.com/comment/43370206
score: -1
has comment: http://stackoverflow.com/comment/43370168

http://stackoverflow.com/a/78645410
has body: To implement nginx-like functionality in spring boot, you can refer to the following code, which is my final solution. this is without context-path @Configuration public class UiConfiguration implements WebMvcConfigurer { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/**") .addResourceLocations("classpath:/static/", "classpath:/templates/") // To solve the 404 problem of browser refresh // Customize the ClassPathResource implementation class to force the use of the **index.html** resource when the address requested by the front-end does not match the corresponding path // you can check the implementation from {@link ResourceHttpRequestHandler#resolveResourceLocations} .addResourceLocations(new ClassPathResource("/static/index.html") { @Override public Resource createRelative(String relativePath) { return this; } }); } } if you have context-path for you html, you can change it accordingly. @Configuration public class UiConfiguration implements WebMvcConfigurer { @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/admin-ui/**", "/admin-ui/", "/admin-ui") .addResourceLocations("classpath:/admin-ui/") .addResourceLocations(new ClassPathResource("/admin-ui/index.html") { @Override public Resource createRelative(String relativePath) { return this; } }) ; } }
answers question: http://stackoverflow.com/q/27381781
score: 0
type: Answer

http://stackoverflow.com/a/27448184
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27447230
type: Answer
upvote count: 3
has comment: http://stackoverflow.com/comment/76142870
has body: Postgresql now delivers an OSGi compatible driver. It can be downloaded from maven central: mvn:org.postgresql/postgresql/9.4-1203-jdbc41 In Apache karaf it can be installed with feature:install pax-jdbc-postgresql The bundle offers a DataSourceFactory as an OSGi. This can be used to create a DataSource programmatically. Use service:list to see the properties of this DataSourceFactory. Alternatively you can use pax-jdbc-config to create a DataSource from a config using pax-jdbc-config. Use osgi.jdbc.driver.class=org.postgresql.Driver to identify the Postgresql driver in the config. If the config can be processed correctly there will be a service of type DataSource that you can refer to in your code. I got a complete example using derby and hibernate that should be quite easy to adapt to postgresql.
score: 3
answers question: http://stackoverflow.com/q/27447230
type: AcceptedAnswer

http://stackoverflow.com/q/27437940
upvote count: 4
has answer: http://stackoverflow.com/a/27437981
answer count: 4
type: AnsweredQuestion
tagged with: treeset
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/27438064
possible better answer: http://stackoverflow.com/a/27438008
type: Question
tagged with: hashmap
has answer: http://stackoverflow.com/a/27438008
score: 4
has body: I have a HashMap where key is a character and value is some user-defined object. I am adding same objects in the TreeSet. The number of entries in HashMap and TreeSet are equal. Later on I want to retrieve a object from HashMap using user supplied character input. Upon retrieving object from HashMap, I want to delete the same object from the TreeSet. However, the TreeSet.remove() doesn't identify the object. import java.util.TreeSet; import java.util.HashMap; public class Trial { char c; int count; HashMap&lt;Character, Trial&gt; map; TreeSet &lt;Trial&gt; set; public Trial(char c, int count) { this.c = c; this.count = count; map = new HashMap&lt;Character, Trial&gt;(); set = new TreeSet&lt;Trial&gt;(new New_Comparison()); } public static void main(String[] args) { // TODO Auto-generated method stub Trial root = new Trial('0', 0); int i; for(i = 0; i &lt; 26; i++) //add all characters a-z with count 0-25 resp. in root { char ch = (char)('a' + i); Trial t = new Trial(ch, i); root.map.put(ch, t); root.set.add(t); } System.out.println(root.set.size()); //size = 26 Trial t = root.map.get('c'); if(t == null) return; root.set.remove(t); System.out.println(root.set.size()); //size remains the same, expecting 25 } } Comparator class: import java.util.Comparator; public class New_Comparison implements Comparator &lt;Trial&gt;{ public int compare(Trial n1, Trial n2) { if(n1.c &lt;= n2.c) return 1; return -1; } } Output : 26 26 Please help. If the object is either String or Integer, TreeSet.remove() works perfectly. But doesn't work for user-defined objects.
accepted answer: http://stackoverflow.com/a/27437981
favorite count: 0
has answer: http://stackoverflow.com/a/27438039
has title: Using HashMap Value to remove object from TreeSet

http://stackoverflow.com/q/27344504
has answer: http://stackoverflow.com/a/27346260
type: AnsweredQuestion
score: 3
downvote count: 0
has body: I had following jsp page and that jsp compiles as expected &lt;%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%&gt; &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt; &lt;%@ taglib prefix="sprSec" uri="http://www.springframework.org/security/tags"%&gt; &lt;c:if test="${sessionScope.userName!=null}"&gt; ... &lt;/c:if&gt; In login controller method I have following row: session.setAttribute("userName", name); I thought that better to rewrite it using spring security tags &lt;%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%&gt; &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt; &lt;%@ taglib prefix="sprSec" uri="http://www.springframework.org/security/tags"%&gt; &lt;sprSec:authorize access="isAuthenticated()"&gt; ... &lt;/sprSec:authorize&gt; And now I have following error when try to acces to page: org.apache.jasper.JasperException: org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/*/*****.jsp at line 5 2: &lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%&gt; 3: &lt;%@ taglib prefix="sprSec" uri="http://www.springframework.org/security/tags"%&gt; 4: 5: &lt;sprSec:authorize access="isAuthenticated()"&gt; 6: 7: &lt;c:set var="profileUrl" value="#" scope="request" /&gt; 8: &lt;sprSec:authorize ifAllGranted="ROLE_USER"&gt; .... root cause javax.servlet.ServletException: javax.servlet.jsp.JspException: java.io.IOException: No visible WebSecurityExpressionHandler instance could be found in the application context. There must be at least one in order to support expressions in JSP 'authorize' tags. ..........
tagged with: java
type: Question
linked to: http://stackoverflow.com/q/11594104
has title: Spring security. authorize doesn't work on jsp
answer count: 1
tagged with: jsp
tagged with: spring-security
accepted answer: http://stackoverflow.com/a/27346260
upvote count: 3
favorite count: 0

http://stackoverflow.com/q/27349957
possible better answer: http://stackoverflow.com/a/36565693
answer count: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27351019
accepted answer: http://stackoverflow.com/a/27351019
tagged with: java-io
favorite count: 0
has answer: http://stackoverflow.com/a/36565693
type: AnsweredQuestion
tagged with: java-stream
upvote count: 1
tagged with: java-8
type: Question
score: 1
has body: Is there a straight forward way of using java.io.ObjectInputStream with java.util.stream.Stream? It seems that java.io.BufferedReader.lines is provided to convert a buffered reader into a Stream but there doesn't seem to be an equivalent for Object's. Has anyone have good solution for this conversion?
tagged with: java
has title: How to Convert java.io.ObjectInputStream to java.util.stream.Stream?
tagged with: inputstream

http://stackoverflow.com/comment/43278300
score: 0
type: Comment
has text: Just added some reference code. I am assuming you are using at least java 1.7 otherwise the try-with-resources construction wont work. Let me know...
type: AnswerComment
comment on: http://stackoverflow.com/a/27414293

http://stackoverflow.com/comment/43135851
comment on: http://stackoverflow.com/a/27339643
has text: Thanks but now it won't print the line if its an invalid number. It just ends the loop
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43287885
type: Comment
score: 1
has text: ok, but when I run ThreadsUtility.getAllRunninthreads(); method it ives me all the threads available but the one I stared? is it because the thread is terminated when it finishes its work?
type: AnswerComment
comment on: http://stackoverflow.com/a/27422612

http://stackoverflow.com/q/27383851
downvote count: 0
has answer: http://stackoverflow.com/a/31210307
has answer: http://stackoverflow.com/a/27385301
has title: Is setting eclipse java compiler compliance level 1.6 same as compile using JDK 1.6?
accepted answer: http://stackoverflow.com/a/31210307
tagged with: javac
answer count: 4
favorite count: 0
has answer: http://stackoverflow.com/a/27386423
upvote count: 2
has body: I'm trying to consume a third-party API, where I get support for the third party API upto JDK 1.6. I have other few projects which are built using JDK 1.7 and as part of the product I'm also packaging JRE 1.7. if compiler compliance level is set to JDK 1.6, compile &amp; run using JDK 1.7 libraries produce same result as of compile &amp; run using JDK 1.6? Would it be safe to claim support from third-party vendor when compiler compliance level is set to JDK 1.6. Update: I presumed that setting compiler level in eclipse is same as setting -source &amp; -target options of javac. I'm not sure if compiling using JDK 1.7 setting source &amp; target to 6/1.6 is same as compiling in jdk1.6.
has answer: http://stackoverflow.com/a/27383926
score: 2
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27383926
tagged with: java
tagged with: eclipse
type: Question

http://stackoverflow.com/q/27454020
has body: I need to group all objects of a certain type. For example I have a class: class A { public A() { //... } } and in the main method: class B { public static void main(String[] args) { A a1 = new A(); A a2 = new A(); A a3 = new A(); } } Is there a way to act with objects A as if it were an array, without that I create it? It can be as stupid question, but I wanted to remove my doubts.
has comment: http://stackoverflow.com/comment/43346228
favorite count: 0
possible better answer: http://stackoverflow.com/a/27454148
has title: Object as array
has answer: http://stackoverflow.com/a/27454148
accepted answer: http://stackoverflow.com/a/27454077
upvote count: 1
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43346276
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43346209
type: Question
answer count: 2
tagged with: arrays
downvote count: 0
has comment: http://stackoverflow.com/comment/43346351
has answer: http://stackoverflow.com/a/27454077

http://stackoverflow.com/a/30594064
score: 12
has body: I built a solution combining a horizontal viewpager (the parent) with vertical viewpagers (each child). I overrode the following methods on vertical viewpager: public boolean onInterceptTouchEvent(MotionEvent ev) public boolean onTouchEvent(MotionEvent ev) When the user triggers those events on each child, they pass it to the parent. Then, if the event is vertical, the child processes it, otherwise, if the event is horizontal, the parent processes it. Take a look to my DoubleViewPager library, where I implemented this strategy.
has comment: http://stackoverflow.com/comment/69396931
downvote count: 0
has comment: http://stackoverflow.com/comment/69447562
has comment: http://stackoverflow.com/comment/69380322
type: Answer
has comment: http://stackoverflow.com/comment/55113832
answers question: http://stackoverflow.com/q/27468986
has comment: http://stackoverflow.com/comment/54984098
has comment: http://stackoverflow.com/comment/55374071
upvote count: 12
has comment: http://stackoverflow.com/comment/54906566

http://stackoverflow.com/a/27315899
has comment: http://stackoverflow.com/comment/43093058
has body: I found it! it is here [[\'] this [[ should be [ But I have no Idea why the online regex testers have accepted it.
score: 0
accepted answer of: http://stackoverflow.com/q/27315742
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27315742
type: Answer

http://stackoverflow.com/comment/43284397
has text: but you know i don't run client side, at first i run server side, at the begging of the execution i get this error, i want to say it should not be wrong port number. because the problem is from server side...
comment on: http://stackoverflow.com/a/27420366
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43203384
type: Comment
has text: please see comments from Deinum; which I included in my answer
type: AnswerComment
comment on: http://stackoverflow.com/a/27375038
score: 0

http://stackoverflow.com/comment/43299834
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27428575
has text: First of all your code doesn't make sense. `@ContextConfiguration` is for testing, the same goes for `@TransactionConfiguration` for a normal bean this doesn't do anything. I also wonder why the `testAddNewDevices` should do anything because there is no annotations nor is it a Spring unit test. So I'm not sure what you are trying to do but what you posted here is confusing at best.

http://stackoverflow.com/a/27336799
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43130381
type: Answer
score: 2
has comment: http://stackoverflow.com/comment/43130713
has comment: http://stackoverflow.com/comment/43132203
upvote count: 2
answers question: http://stackoverflow.com/q/27336644
accepted answer of: http://stackoverflow.com/q/27336644
has body: This is how to get the background Color of the JPanel that was clicked on via a mouse handler (assuming the mouse event handler is attached to the JPanel you want to get the Color of): private void mouseClicked(java.awt.event.MouseEvent evt) { JPanel panel = (JPanel)evt.getSource(); Color c = panel.getBackground(); System.out.println("color: " + c.toString()); } Explanation: In the mouseClicked method the MouseEvent argument evt is an Object which contains a reference to the "source" of the mouse event (ie. the Object that had the click event handler attached to it). If you know you've only added the event handler to JPanel objects, then you can safely cast the result of getSource() to a JPanel instance as is done in the example code. Then you can perform operations on the JPanel source of the click event such as getBackground().

http://stackoverflow.com/a/27431908
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27430662
upvote count: 1
has body: There is no point of using Filter if you want to read all the files from the directory. Filter is primarily designed to apply some filter criteria and read a subset of files. Both of them may not have any real difference in over all performance. If you looking to improve performance, you can try couple different approaches. Multi-threading Depending on how many files exists in the directory and how powerful your CPU is, you can apply multi threading to process more than one file at a time Queuing Right now you are reading and writing to another file synchronously. You can queue content of the file using Queue and create asynchronous writer. You can combine both of these approaches as well to improve performance further.
accepted answer of: http://stackoverflow.com/q/27430662
has comment: http://stackoverflow.com/comment/43319295
has comment: http://stackoverflow.com/comment/43331765
type: Answer
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43363116

http://stackoverflow.com/comment/44033728
has text: If you want to suggest somethign post comment
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27813278
type: Comment

http://stackoverflow.com/q/27459237
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/27465655
has body: I created a Java program that takes the user's choice and creates an int array of that size. Then the array is sorted and displayed and a number is asked to search in the array. I'm trying to use the bubble sort technique, however, the result always turns out to be a descending array rather than an ascending one. import java.util.*; class mt { int i,M=0; public void main() { Scanner sc=new Scanner(System.in); System.out.println("enter the size of array"); int sizeOfArray=sc.nextInt(); int arr[]= new int [sizeOfArray]; int temp; System.out.println("enter the numbers"); for (i=0; i&lt;sizeOfArray; i++) { arr[i]=sc.nextInt(); } System.out.println("the sorted array is below :"); for ( i=0; i&lt;sizeOfArray-1; i++){ for (int j=0; j&lt;sizeOfArray-2; j++) { if (arr[j]&gt;arr[j+1]) { temp=arr[j]; arr[j]=arr[j+1]; arr[j+1]=temp; } } } for (i=0; i&lt;sizeOfArray; i++) { System.out.print(arr[i]+" "); } System.out.println(); System.out.println("enter number to search"); int srch=sc.nextInt(); for (i=0; i&lt;sizeOfArray; i++) { if (arr[i]==srch) { System.out.println("found at "+i); M++; break; } else if (M==0&amp;&amp;i==sizeOfArray-1) { System.out.println("number not found"); } } } }
type: Question
upvote count: 2
answer count: 2
downvote count: 0
tagged with: sorting
favorite count: 0
has title: Unable to get a sorted array in ascending manner
has answer: http://stackoverflow.com/a/27465655
has answer: http://stackoverflow.com/a/27459281
accepted answer: http://stackoverflow.com/a/27459281
score: 2
has comment: http://stackoverflow.com/comment/43355272
has comment: http://stackoverflow.com/comment/43355270

http://stackoverflow.com/a/27369774
upvote count: 1
has body: Edit the android studio's Info.plist file in the package so that it uses 1.7 or whatever JVMVersion you have installed. Changing the JVMVersion to 1.6+ instead of 1.6* as hasternet answered above should work too. The above works but is not recommended see RC3 Release Notes As of RC 3, we have a better mechanism for customizing properties for the launchers on all three platforms. You should not edit any files in the IDE installation directory. Instead, you can customize the attributes by creating your own .properties or .vmoptions files in the following directories. (This has been possible on some platforms before, but it required you to copy and change the entire contents of the files. With the latest changes these properties are now additive instead such that you can set just the attributes you care about, and the rest will use the defaults from the IDE installation). see Android Studio failed to load JVM on Mac OSX (Mavericks)
downvote count: 0
type: Answer
score: 1
answers question: http://stackoverflow.com/q/27369269
has comment: http://stackoverflow.com/comment/43192592

http://stackoverflow.com/comment/43258452
has text: @zhang_rick You can use method charAt() to read one letter/digit at a time
comment on: http://stackoverflow.com/q/27406804
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27337619
score: 0
has comment: http://stackoverflow.com/comment/43132290
type: Answer
has comment: http://stackoverflow.com/comment/43131890
has comment: http://stackoverflow.com/comment/43131973
has comment: http://stackoverflow.com/comment/43138411
has body: As stated in the other question, you already have servlet-api in the project, no need to add javax.servlet:servlet-api:2.5 to your project definition. Therefore, you shall be able to access HttpServletRequest. However, as mentioned in the other question, you have version 3.0.1 of servlet-api, which does not include the getRemoteAddr() method, if that is what you wanted to use.
answers question: http://stackoverflow.com/q/27337404

http://stackoverflow.com/comment/43242747
comment on: http://stackoverflow.com/q/27398533
score: 0
has text: in your xml file you have two servlet but one servlet mapping and the url-pattern and the servlet-name all are confusing.
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27444365
has body: That's because you are creating an Alpha object try creating a AlphaSub object: AlphaSub alphaSub = new AlphaSub(); String name = alphaSub.name; marking a variable protected does allows it to get accessed outside the package but only through the subclass's object and not the parentClass's object
accepted answer of: http://stackoverflow.com/q/27444331
score: 1
answers question: http://stackoverflow.com/q/27444331
upvote count: 1
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/43107405
score: 0
type: Comment
has text: Usually dont do the whiskey thing while coding but its Friday night here
type: AnswerComment
comment on: http://stackoverflow.com/a/27323579

http://stackoverflow.com/a/27474193
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43382821
has comment: http://stackoverflow.com/comment/43383014
has body: Your test size is simply to small. You need to repeat your experiment a number of times and with a lot of different sizes so you can make a plot of different time consumption plots. The reason: on a physical processor, a machine uses cache: a fast memory so the processor is optimally used. It takes sometime before a program is fully loaded into the cache. This means that the first time you run a program, it takes more time because part of the time is wasted on loading the program. This is called a cold start. The second time, one can benefit from the work earlier performed by the previous run. This is called a hot start. Furthermore running times tend to depend on external factors as well. Say you run the program, but at the same time something happens on the network or you insert a USB device. In that case the operating system will suspend execution, and first do some bookkeeping for the event. Bookkeeping can run into milliseconds and thus have a significant impact on a single run. Furthermore you need to try different arrays. Sorted arrays are typically sorted faster than unsorted arrays. This is because many merge implementations use swapping (to boost performance) and thus perform less swaps. To conculde: you should use different arrays, different sizes, and repeat the experiment often enough to average out aspects like caching. Given you did this, you can determine the running time as follows. Since the time complexity is O(n log n), this means the function takes the form: a*n log n+b*n+c*log n+d You can plug this formula into a Vandermonde matrix for the Least squares method: [ 1 log(n_1) n_1 n_1*log(n_1) ] [ t_1 ] [ 1 log(n_2) n_2 n_1*log(n_2) ] [ d ] [ t_2 ] [ 1 log(n_3) n_3 n_1*log(n_3) ] [ c ] [ t_3 ] [ 1 log(n_4) n_4 n_1*log(n_4) ] x [ b ] = [ t_4 ] [ 1 log(n_5) n_5 n_1*log(n_5) ] [ a ] [ t_5 ] [ 1 ... ... ... ] [ ... ] [ 1 log(n_m) n_m n_1*log(n_m) ] [ t_m ] Or in matrix notation: X * w = t With n_i the array size for experiment i and t_i the time it to…
has comment: http://stackoverflow.com/comment/43383175
answers question: http://stackoverflow.com/q/27474055

http://stackoverflow.com/q/27416695
type: Question
has answer: http://stackoverflow.com/a/27416777
accepted answer: http://stackoverflow.com/a/27416777
tagged with: java
score: 0
tagged with: arrays
answer count: 1
tagged with: spinner
tagged with: android-relativelayout
tagged with: android
type: AnsweredQuestion
has body: hi i am trying to create spinner at run time my code is, RelativeLayout layout = (RelativeLayout) findViewById(R.id.linearLayout1); final Spinner[] Sp = new Spinner[10]; Sp[count] = new Spinner(this); RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams( (int) LayoutParams.WRAP_CONTENT, (int) LayoutParams.WRAP_CONTENT); param.leftMargin = 25; param.topMargin = 50; Sp[count].setPadding(5, 23, 5, 5); Sp[count].setLayoutParams(param); layout.addView(Sp[count]); i have String[] data how to add its value in spinner dropdown ? Hopes for your suggestion Thanks
has title: How to add array in Spinner that is generating at run time Java

http://stackoverflow.com/comment/43324611
comment on: http://stackoverflow.com/a/27442455
type: Comment
score: 1
has text: If OP ever concludes that, he'll find that no shared-state model can improve his performance.
type: AnswerComment

http://stackoverflow.com/comment/43126932
comment on: http://stackoverflow.com/a/27330391
has text: thanks :) it solved the issue. Am using STS 3.6.2 RELEASE, so am suppose to use jars with 3.2.3 RELEASE
type: AnswerComment
score: 0
type: Comment

jpcap
tags question: http://stackoverflow.com/q/27353784
type: Tag
tag name: jpcap

http://stackoverflow.com/q/27436062
upvote count: 1
answer count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43313147
favorite count: 0
has answer: http://stackoverflow.com/a/27436280
type: UnansweredQuestion
tagged with: java
type: Question
has title: How to count the digits in a String
tagged with: arrays
score: 0
has body: The code is close to correct, but I cannot see how I can move from System.out.println to a toString() method here, what am I missing? import java.util.Scanner; class Histogram { private int[] numCount; int size=0; public Histogram(String line) { setList(line); } public void setList(String line) { numCount = new int[20]; for(int i=0;i&lt;10;i++) numCount[i]=0; Scanner chopper = new Scanner (line); while (chopper.hasNextInt()) { int num = chopper.nextInt(); numCount[num]++; } for(int i=0;i&lt;10;i++) System.out.println(i+"::"+numCount[i]); System.out.println(); System.out.println(); } }

http://stackoverflow.com/comment/43133414
type: QuestionComment
has text: What do you mean? I tried to upload small image but the size of it even matter?
comment on: http://stackoverflow.com/q/27337996
score: 0
type: Comment

http://stackoverflow.com/q/27313964
has answer: http://stackoverflow.com/a/27314925
has title: Flush Mode hibernate utility
type: AnsweredQuestion
score: 0
tagged with: java
tagged with: hibernate
possible better answer: http://stackoverflow.com/a/27314925
has body: I try to understand the difference between different hibernate FlushMode. For this, I created a small example of insertion. session.beginTransaction(); session.setFlushMode(FlushMode.AUTO);// I tried ALWAYS AND MANUAL for (int i = 1; i &lt; 4; i++) { Stock stock = new Stock(); stock.setStockId(i); stock.setStockCode("code-"+i); stock.setStockName("name-"+i); session.save(stock); System.out.println("entity saved"); } session.getTransaction().commit(); The problem I always have the same behavior as if the flushMode is set to COMMIT. entity saved entity saved entity saved insert into stock (STOCK_CODE, STOCK_NAME, STOCK_ID) values (?, ?, ?) insert into stock (STOCK_CODE, STOCK_NAME, STOCK_ID) values (?, ?, ?) insert into stock (STOCK_CODE, STOCK_NAME, STOCK_ID) values (?, ?, ?) while I was expecting to have entity saved insert into stock (STOCK_CODE, STOCK_NAME, STOCK_ID) values (?, ?, ?) entity saved insert into stock (STOCK_CODE, STOCK_NAME, STOCK_ID) values (?, ?, ?) entity saved insert into stock (STOCK_CODE, STOCK_NAME, STOCK_ID) values (?, ?, ?) Anyone have an explanation why I have always the same result?
has answer: http://stackoverflow.com/a/27398016
type: Question
has answer: http://stackoverflow.com/a/27315160
accepted answer: http://stackoverflow.com/a/27398016
answer count: 4
has answer: http://stackoverflow.com/a/27316217

http://stackoverflow.com/comment/43192611
has text: @HotLicks I'm afraid your right :(
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27370423

http://stackoverflow.com/q/27384222
possible better answer: http://stackoverflow.com/a/27386247
has answer: http://stackoverflow.com/a/27385376
answer count: 2
downvote count: 0
favorite count: 0
has title: GregorianCalendar: Jumping from tuesday to sunday
has body: I have a GregorianCalendar instance for Tuesday September 2nd. The valñue is checked in milliseconds and is OK. I want another calendar which is the next Sunday (7th) at 23:59:59. So: GregorianCalendar currentCalendar = MyClock.INSTANCE.getCurrentCalendar(); GregorianCalendar nextSunday = (GregorianCalendar)currentCalendar.clone(); // GregorianCalendar uses Sunday as first day of week, so we must // advance one week int currentWeek = nextSunday.get(GregorianCalendar.WEEK_OF_YEAR); nextSunday.set(GregorianCalendar.WEEK_OF_YEAR, currentWeek + this.THIS_WEEK); nextSunday.set(GregorianCalendar.DAY_OF_WEEK, GregorianCalendar.SUNDAY); nextSunday.set(GregorianCalendar.HOUR_OF_DAY, 23); nextSunday.set(GregorianCalendar.MINUTE, 59); nextSunday.set(GregorianCalendar.SECOND, 59); nextSunday.set(GregorianCalendar.MILLISECOND, 0); So, since sunday is day number 1 of the week for the GregorianCalendar, and I am at week of year number 36, I add one week and then set the day to sunday. The real problems comes now: when I execute in my development machine, with OpenJDK 1.7.0_55, it works perfectly. If I go to my test machine with OpenJDK 1.7.0_51, it does it all wrong: Adds one week until tuesday 9th, and then goes to sunday 14th instead of sunday 7th. I don't know if I am doing it right or wrong: what is really killing me is that the result depends on the machine, and I haven't found any difference at GregorianCalendar at those OpenJDK versions. Any explanation for this behaviour? PD: Please stick to GregorianCalendar. I know is a bit shitty, but I don't want to use Joda Calendar or any other at current stage of development. EDIT: I found method setWeekDate(year, week_of_year, day_of_week). One would think that setting year, week and day of week into the same method will grant it will succeed. It does not: still going from 2nd to 14th. What monkey wrote this?
accepted answer: http://stackoverflow.com/a/27385376
type: AnsweredQuestion
upvote count: 3
tagged with: java
tagged with: calendar
has comment: http://stackoverflow.com/comment/84258322
has comment: http://stackoverflow.com/comment/43219188
type: Question
score: 3
has answer: http://stackoverflow.com/a/27386247
tagged with: gregorian-calendar

http://stackoverflow.com/q/27351858
tagged with: android
upvote count: 1
has comment: http://stackoverflow.com/comment/43157687
score: 0
tagged with: java
downvote count: 1
has comment: http://stackoverflow.com/comment/43159241
answer count: 0
type: UnansweredQuestion
has title: android studio Not run in windows 8
has body: I tried to install Android Studio, but I'm getting this error when I try to start it: Error:Unable to start the daemon process. This problem might be caused by incorrect configuration of the daemon. For example, an unrecognized jvm option is used. Please refer to the user guide chapter on the daemon at http://gradle.org/docs/2.1/userguide/gradle_daemon.html Please read below process output to find out more: ----------------------- Error: Could not find or load main class D:.gradle-2.2.1 Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
favorite count: 0
type: Question

http://stackoverflow.com/comment/43427706
score: 0
has text: @nolan6000 what all does that entail?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27351640

http://stackoverflow.com/q/27420819
type: UnansweredQuestion
tagged with: java
type: Question
score: 0
answer count: 1
has body: select NEXTVAL('schedule_report_user_link_sequence') INSERT INTO schedule_report_user_link( id, schedule_report_detail_id, to_user_id) VALUES (#{id}, #{scheduleReportDetail.id}, #{user.id}) ; Here I am using for each loop to multiple insert. I need to know if selectKey generate new id for each insert? Is there any better approach?
tagged with: mybatis
has title: will <selectKey> generate new id for each insert in MyBatis?
tagged with: postgresql
has answer: http://stackoverflow.com/a/27421033
tagged with: spring

http://stackoverflow.com/q/27390944
accepted answer: http://stackoverflow.com/a/27402499
type: Question
has title: Jetty How to Create Custom WebSocket
answer count: 2
score: 5
upvote count: 5
downvote count: 0
tagged with: websocket
linked to: http://stackoverflow.com/q/15646213
possible better answer: http://stackoverflow.com/a/27391029
has answer: http://stackoverflow.com/a/27391029
favorite count: 0
tagged with: jetty
has answer: http://stackoverflow.com/a/27402499
type: AnsweredQuestion
has body: Looking around online, I have found that the way to create a socket is to create a class with the @WebSocket annotation and use the desirable annotated methods for events. In order for this socket to be used, a socket handler is used like so: import org.eclipse.jetty.websocket.server.WebSocketHandler; import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory; import rsvp.RSVPSocket; public class RSVPWebSocketHandler extends WebSocketHandler { @Override public void configure ( WebSocketServletFactory factory ) { factory.register( MySocket.class ); } } My question is: if "MySocket" class has a constructor that has parameters, how can I make the factory invoke that one correctly?
tagged with: java

http://stackoverflow.com/comment/43366792
comment on: http://stackoverflow.com/q/27465295
type: Comment
type: QuestionComment
score: 0
has text: what language are you using?

http://stackoverflow.com/a/27441989
has body: Ok FilenameFilter is a abstract class, with the abstract method accept(). You have to implement this and all other stuff (e.g. comparing each filename), will done by FilenameFilter. You have to implement it after new because for creating a new Filter Java has to know in wich way you want FilenameFilter to work. It's a basic idea of java to make some method abstract and you have to implement it on the way to say what you want to do in your special case. I hope it makes it a little bit more clear!
type: Answer
has comment: http://stackoverflow.com/comment/43323451
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27441877
score: 2
has comment: http://stackoverflow.com/comment/43323428
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27441877

apache
tag name: apache
tags question: http://stackoverflow.com/q/27361101
tags question: http://stackoverflow.com/q/27413645
tags question: http://stackoverflow.com/q/27419717
tags question: http://stackoverflow.com/q/27344534
tags question: http://stackoverflow.com/q/27421862
tags question: http://stackoverflow.com/q/27385479
tags question: http://stackoverflow.com/q/27466934
tags question: http://stackoverflow.com/q/27401694
tags question: http://stackoverflow.com/q/27472708
tags question: http://stackoverflow.com/q/27350088
tags question: http://stackoverflow.com/q/27321465
tags question: http://stackoverflow.com/q/27467555
tags question: http://stackoverflow.com/q/27427423
tags question: http://stackoverflow.com/q/27437780
type: Tag
tags question: http://stackoverflow.com/q/27457605
tags question: http://stackoverflow.com/q/27404709
tags question: http://stackoverflow.com/q/27353493
tags question: http://stackoverflow.com/q/27345439
tags question: http://stackoverflow.com/q/27396477

http://stackoverflow.com/comment/43093753
type: AnswerComment
comment on: http://stackoverflow.com/a/27316217
score: 0
type: Comment
has text: When hibernate needs to make a flush?

http://stackoverflow.com/comment/43101547
score: 0
type: QuestionComment
type: Comment
has text: If you use `List<String> toAdd = new ArrayList<String>();` you get `[s0, s1, s2]` as expected.
comment on: http://stackoverflow.com/q/27320945

http://stackoverflow.com/comment/43238800
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27396074
score: 0
has text: I'm receiving from a function a grouplayout every time that I called, and then I have to draw all the elements received from that function into a JPanel. I saved the group layouts received into uniquechart[].

http://stackoverflow.com/a/27316715
type: Answer
answers question: http://stackoverflow.com/q/27316185
downvote count: 0
score: 1
upvote count: 1
has body: String inTime = "09:30:00"; String outTime = "15:30:00"; SimpleDateFormat df = new SimpleDateFormat("HH:mm:ss"); Date dateIn = df.parse(inTime); Date dateOut = df.parse(outTime); long dateInMill = dateIn.getTime(); long dateOutMill = dateOut.getTime(); long dateMiddleMill = dateInMill + ((dateOutMill - dateInMill) / 2); Date dateMiddle = new Date(dateMiddleMill); System.out.println(df.format(dateMiddle));

http://stackoverflow.com/comment/43129932
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27336136
has text: I quite agree. Let's take your example with a HashMap putting entries for a key thats hashCode() returns 1. When we perform a lookup we're essentially iterating over a linked list, so we'll get a O(n/2) lookup. If instead of being implemented as linked list, the bucket was implemented as a binary search tree, we'd get a O(log n) lookup. The downside is that a linked list has a O(1) insert whereas a BST has a O(log n) insert, so when putting a collided key in, the insertion time would be higher (it would still be constant for non collided keys).
type: Comment

http://stackoverflow.com/comment/43352955
score: 0
type: Comment
has text: its an input from user and yes @Mehdi, each line contains similar input
type: QuestionComment
comment on: http://stackoverflow.com/q/27457846

http://stackoverflow.com/comment/45304187
comment on: http://stackoverflow.com/a/27555628
type: Comment
has text: the new API's dependencies are hard to work over in eclipse were as Google has announced their official IDE as ANDROID STUDIO. After installing our new IDE all the dependency problem were solved regarding app.compact v7 and API 19, 20 and 21. Even our new IDE is literally awesome and it includes a lot of new features. So guys don't wait to get your new IDE. just download as early as possible.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43188340
type: QuestionComment
comment on: http://stackoverflow.com/q/27368069
has text: Does this help? http://www.vogella.com/tutorials/SWT/article.html#swt_table
score: 0
type: Comment

http://stackoverflow.com/comment/43095533
type: Comment
has text: I'm sorry to frequently asked questions, but when I go to the JRE where you said, I have no option to choose jdk, only more jre version....
comment on: http://stackoverflow.com/a/27317345
score: 0
type: AnswerComment

http://stackoverflow.com/q/27340012
tagged with: comparable
score: 0
answer count: 1
tagged with: generics
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27349944
accepted answer: http://stackoverflow.com/a/27349944
tagged with: java
has body: I tried to cast String to T type, but it says "Inconvertible types; cannot cast 'java.lang.String' to 'T'. However, when I remove "&lt; T >" from &lt; T extends Comparable&lt; T > >, and fix that to &lt; T extends Comparable >, it is okay. What is the difference? Below is the code: public class Graph&lt;T extends Comparable&lt;T&gt;&gt; { public void createGraph(Scanner in) { String line; String[] elements; while (in.hasNextLine()) { line = in.nextLine(); elements = line.split("\\s+"); insertVertex((T)elements[0]); // &lt;&lt; This is the part }
type: Question
has title: difference between < extends Comparable > and < extends Comparable < T > >?

http://stackoverflow.com/a/27367613
has comment: http://stackoverflow.com/comment/43187633
type: Answer
accepted answer of: http://stackoverflow.com/q/27367362
has comment: http://stackoverflow.com/comment/49367999
has comment: http://stackoverflow.com/comment/43187721
has comment: http://stackoverflow.com/comment/43187514
has comment: http://stackoverflow.com/comment/49369938
has comment: http://stackoverflow.com/comment/43187704
has comment: http://stackoverflow.com/comment/43187738
has comment: http://stackoverflow.com/comment/49379066
has comment: http://stackoverflow.com/comment/43187666
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has body: I met this problem before, that because you use the newest Parse api. There are just a few changes you need to make. First, to fix the error directly caused by issuing the push from the Parse backend you need to declare a notification icon for the Parse push in your Manifest. &lt;meta-data android:name="com.parse.push.notification_icon" android:resource="@drawable/ic_launcher"/&gt; use before the closing application-Tag. Issuing another push from the backend now will give you a push notification as you expect. So far so good. Clicking the push will result in an app crash again. To fix this you need to remove the now deprecated call PushService.setDefaultPushCallback(...) and add your own Receiver class. I did this in the *.util package just as the following: public class Receiver extends ParsePushBroadcastReceiver { @Override public void onPushOpen(Context context, Intent intent) { Intent i = new Intent(context, MainActivity.class); i.putExtras(intent.getExtras()); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(i); } } Next, change the default Parse receiver to the one just created: - Go to your Manifest file. &lt;receiver android:name="your.package.name.utils.Receiver" android:exported="false" &gt; &lt;intent-filter&gt; &lt;action android:name="com.parse.push.intent.RECEIVE" /&gt; &lt;action android:name="com.parse.push.intent.DELETE" /&gt; &lt;action android:name="com.parse.push.intent.OPEN" /&gt; &lt;/intent-filter&gt; &lt;/receiver&gt;
answers question: http://stackoverflow.com/q/27367362

http://stackoverflow.com/comment/43190313
score: 2
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27369287
has text: Why exactly do you think that _should_ work? What are you using for a learning resource? How does it describe `scopes`?

http://stackoverflow.com/q/27337559
has comment: http://stackoverflow.com/comment/43132308
tagged with: user-interface
has body: I am working on a semester project that I have and I was wondering if it was possible to store 3-4 JPanels instead one single "main" JPanel. The reason for me asking this is because I a trying to make a GUI checkbook program and my checkbook has 7 buttons that should open a new window once I click on it. To switch between each window I'm going to have to use the CardLayout, but my understand of the CardLayout is that I can only assign one single JPanel to that card so I can't assign multiple JPanels to a single Card layout so when the user clicks on a different card 3-4 different JPanels appear. The reason that I am asking this is because I asked for help earlier and received help for creating my first window in this project, it produces the output I want PERFECTLY, but uses more than 1 JPanel in doing so. Since this prevents me from continuing on to the other steps of my 7 GUI Windows, I am stuck. Here is the code: import java.awt.*; import javax.swing.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class checkbook extends JPanel implements ActionListener { private static final String title = "Use The Buttons Below To Manage Transactions"; private static final String[] bottomButtons = { "Create a New Account", "Load a Trans from a File", "Add New Transactions", "Search Transactions", "Sort Transactions", "View/Delete Transactions", "Backup Transaction", "Exit" }; static JButton Button[] = new JButton[8]; static ActionListener AL = new checkbook(); public checkbook() { JLabel titleLabel = new JLabel(title, SwingConstants.CENTER); titleLabel.setFont(titleLabel.getFont().deriveFont(Font.BOLD, 18)); JPanel titlePanel = new JPanel(); titlePanel.add(titleLabel); // put it in a JPanel so it will expand to fill BoxLayout JTextField textfield = new JTextField(); JPanel accountBalancePanel = new JPanel(); accountBalancePanel.add(new JLabel("Account Name:")); accountBalancePanel.add(new JTextField(10)); accountBalancePanel.add(Box.createHori…
type: Question
has comment: http://stackoverflow.com/comment/43131720
has comment: http://stackoverflow.com/comment/43131766
tagged with: swing
has comment: http://stackoverflow.com/comment/43132284
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43131818
has comment: http://stackoverflow.com/comment/43132168
tagged with: cardlayout
has comment: http://stackoverflow.com/comment/43132374
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43131937
has title: Java GUI - Possible to store JPanels inside a single main JPanel?

http://stackoverflow.com/a/27447344
has comment: http://stackoverflow.com/comment/43353586
has body: Is this what you're looking for? myParseObject.getJSONObject(myKey).toString(); ParseObject getJSONObject method JSONObject toString method
has comment: http://stackoverflow.com/comment/43337968
has comment: http://stackoverflow.com/comment/43410130
type: Answer
answers question: http://stackoverflow.com/q/27447166
has comment: http://stackoverflow.com/comment/43356904
score: 0
has comment: http://stackoverflow.com/comment/43337870

http://stackoverflow.com/a/27441682
score: 7
answers question: http://stackoverflow.com/q/27440721
type: AcceptedAnswer
has body: Okay, I solved the issue by adding : cardview:cardUseCompatPadding="true" You can read about it here - https://developer.android.com/reference/android/support/v7/widget/CardView.html#attr_android.support.v7.cardview:cardUseCompatPadding
upvote count: 7
type: Answer
has comment: http://stackoverflow.com/comment/48793902
accepted answer of: http://stackoverflow.com/q/27440721
downvote count: 0

http://stackoverflow.com/a/27372102
type: Answer
has body: After read the document of jcc, I solved this by myself. This problem is the same as this one. My solution is: Add some code to this file pylucene/java/org/apache/pylucene/search/similarities/PythonDefaultSimilarity.java: import org.apache.lucene.util.BytesRef; public native float scorePayload(int docId, int start, int end, BytesRef payload);
score: 0
answers question: http://stackoverflow.com/q/27359013
accepted answer of: http://stackoverflow.com/q/27359013
type: AcceptedAnswer

http://stackoverflow.com/comment/43193375
has text: My professor recommended it because this is how it works: it checks the first two (if n is 2) so "to you" and then if the third is "me" then itll add "(to, you) | (me | 1)", then the next check will dequeue "to" and enqueue "me" and check "you me" and whatever is right after "me"
type: Comment
comment on: http://stackoverflow.com/a/27370626
score: 0
type: AnswerComment

http://stackoverflow.com/q/27382619
upvote count: 1
has title: mark() method of StringReader
tagged with: stringreader
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27382956
downvote count: 0
score: 1
favorite count: 0
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27382886
has body: My question pertains to the mark() method of Java's StringReader. Here is my scenario: StringReader reader = new StringReader("Test123"); reader.mark(0); boolean bool = doSomething(reader)//reads from reader with calls to mark() inside if (bool == false) { reader.reset(); } doSomethingElse(reader); I want to recover my reader back to its original state if doSomething() returns false. Because reset() will only reset the reader back to the previously-called mark, and there are marks called from within the doSomething() method, it doesn't refer to the mark called one line before entering the doSomething() method. Is there a possible workaround to this? I appreciate the help!
tagged with: java

http://stackoverflow.com/q/27457235
has title: How to add a border to a rectangle in Java using setBorder and JFrame
type: Question
answer count: 2
downvote count: 0
tagged with: border
possible better answer: http://stackoverflow.com/a/27457434
has answer: http://stackoverflow.com/a/27457434
accepted answer: http://stackoverflow.com/a/27457312
favorite count: 0
upvote count: 2
tagged with: jframe
tagged with: swing
has body: I am trying to add a border to a Rectangle element and for some reason it will not work, is it not compatible with JFrame? I can set my entire JFrame to having a border, but it can't find setBorder with my rectangles. Here is my code: package trivia; import java.awt.Color; import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Rectangle; import javax.swing.BorderFactory; import javax.swing.JFrame; import javax.swing.border.Border; @SuppressWarnings("serial") public class Main extends JFrame{ boolean mainMenu = true; static Color tan = Color.decode("#F4EBC3"); static Color darkGreen = Color.decode("#668284"); static Color buttonColor = Color.decode("#A2896B"); Rectangle header = new Rectangle(0, 0, 500, 100); Rectangle body = new Rectangle(0, 100, 500, 400); Rectangle start = new Rectangle(150, 150, 200, 40); public Main() { setTitle("Trivia Game!"); setSize(500, 500); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); } @Override public void paint(Graphics g) { Dimension d = this.getSize(); Border blackline; blackline = BorderFactory.createLineBorder(Color.black); if(mainMenu = true){ g.setColor(darkGreen); g.fillRect(header.x, header.y, header.width, header.height); g.setFont(new Font("Courier", Font.BOLD, 24)); g.setColor(Color.BLACK); drawCenteredString("Trivia Game!", d.width, 125, g); g.setColor(tan); g.fillRect(body.x, body.y, body.width, body.height); g.setColor(buttonColor); g.fillRect(start.x, start.y, start.width, start.height); } } public void drawCenteredString(String s, int w, int h, Graphics g) { FontMetrics fm = g.getFontMetrics(); int x = (w - fm.stringWidth(s)) / 2; int y = (fm.getAscent() + (h- (fm.getAscent() + fm.getDescent())) / 2); g.drawString(s, x, y); } public static void main(String[] args) { @SuppressWarnings("unused") Main m = new Main(); } } And when I add this in my paint function: start.setBorder(blackline); It gives me the erro…
score: 2
type: AnsweredQuestion
tagged with: rectangles
tagged with: java
has answer: http://stackoverflow.com/a/27457312

http://stackoverflow.com/a/27441197
has body: Java doesn't have an unary "decrement by two" operator, so you'll have to split it to two lines: tos -= 2; return stck[tos + 2]; Or use a temp value for readability: tos -= 2; int returnIndex = tos + 2; return stck[returnIndex];
downvote count: 0
score: 2
has comment: http://stackoverflow.com/comment/43321994
upvote count: 2
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43321945
accepted answer of: http://stackoverflow.com/q/27441142
answers question: http://stackoverflow.com/q/27441142
type: Answer

http://stackoverflow.com/q/27382032
upvote count: 1
has title: How to force to open JNLP File in Java 1.5.0_14 JRE instead of JRE 1.7
accepted answer: http://stackoverflow.com/a/44900014
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27382171
tagged with: java
has answer: http://stackoverflow.com/a/27382171
type: Question
has body: I have Java 5-based Java Web Start application which I need to open on a Windows PC. PC has JRE 1.7 installed, with JRE 1.5.0_14 copied manually to the another drive (d:). The problem is that whenever I want to open the JW Start application, it opens using Java 7. Even if I use the javaws executable from JRE 1.5.0_14, somehow some properties still refer to JRE 7 files. How can I force JRE 1.5.0_14 to run just for this application? Thanks in advance &amp; Best Regards. Edit 1: By the way, I forgot to mention that I need to use java 1.7 for my another app. in order to use e-sign app. Edit 2: The JNLP file has alredy this code inside &lt;j2se java-vm-args="-XX:MaxPermSize=128m -Xmx512m" version="1.5"/&gt;
has answer: http://stackoverflow.com/a/44900014
answer count: 3
tagged with: jnlp
tagged with: windows
downvote count: 0
score: 1
has answer: http://stackoverflow.com/a/27382769
favorite count: 0

http://stackoverflow.com/q/27359494
accepted answer: http://stackoverflow.com/a/27359564
possible better answer: http://stackoverflow.com/a/27359652
score: 2
type: AnsweredQuestion
tagged with: java
type: Question
has body: I'm rather new to all this, so please bear with me. what I want to do: interchange the position of two squares on the screen as soon as the user touches the screen. what I've done so far: in my layout xml, I've used a frame layout end defined the two squares: &lt;FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/frame1" android:layout_width="260dp" android:layout_height="540dp" android:layout_gravity="center_horizontal" &gt; &lt;EditText android:id="@+id/square1" android:enabled="false" android:layout_width="50dp" android:layout_height="50dp" android:background="@drawable/textlines" android:clickable="false" android:gravity="center" android:inputType="none" android:text="@string/C1" android:textSize="25sp" /&gt; &lt;EditText android:id="@+id/square2" android:enabled="false" android:layout_width="50dp" android:layout_height="50dp" android:background="@drawable/textlines" android:clickable="false" android:gravity="center" android:inputType="none" android:text="@string/C2" android:textSize="25sp" /&gt; Then in Java, I've done the following: public class Activity1 extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout1); EditText square1 = (EditText) findViewById(R.id.square1); int cc1x = 210; int cc1y = 410; square1.setX(cc1x); square1.setY(cc1y); EditText square2 = (EditText) findViewById(R.id.square2); int cc2x = 310; int cc2y = 410; square2.setX(cc2x); square2.setY(cc2y); int ccdumx = 410; int ccdumy = 410; } In order to get the initial screen - so far so good. The two variables ccdumx and ccdumy are just there for an intermediate storage of one of the two squares when interchanging them So now I add an event listener to detect a screen touch, followed by the changing of the coordinate variables: @Override public boolean onTouchEvent(MotionEvent event) { ccdumx = cc1x; ccdumy = cc1y; cc1x = cc2x; cc1y = cc2y; cc2x = ccdumx; cc2…
has answer: http://stackoverflow.com/a/27359652
has title: About variables and screen touch events
answer count: 2
downvote count: 0
favorite count: 0
upvote count: 2
tagged with: android
has answer: http://stackoverflow.com/a/27359564

ant
tags question: http://stackoverflow.com/q/27435387
tags question: http://stackoverflow.com/q/27470890
tags question: http://stackoverflow.com/q/27434679
tags question: http://stackoverflow.com/q/27409768
tags question: http://stackoverflow.com/q/27420554
type: Tag
tags question: http://stackoverflow.com/q/27343442
tags question: http://stackoverflow.com/q/27373902
tags question: http://stackoverflow.com/q/27410718
tags question: http://stackoverflow.com/q/27351956
tag name: ant
tags question: http://stackoverflow.com/q/27412336
tags question: http://stackoverflow.com/q/27452200
tags question: http://stackoverflow.com/q/27319332
tags question: http://stackoverflow.com/q/27402734
tags question: http://stackoverflow.com/q/27421784
tags question: http://stackoverflow.com/q/27395408
tags question: http://stackoverflow.com/q/27458951

http://stackoverflow.com/q/27388538
downvote count: 0
has answer: http://stackoverflow.com/a/27388539
has comment: http://stackoverflow.com/comment/43228811
tagged with: java
type: Question
tagged with: spelling
score: 5
has body: I added Nodeclipse "Enide Studio 2014" plugins to the same Workspace as my Java projects (I usually don't do that). My Node Perspective worked great, I created a new Node project and it all worked great. Then I went back to my Java Perspective and noticed that all of my Java projects had spell check enabled - the annotations "sp" were on the left margin for mundane names for variables all over the place. I made sure spell check was disabled globally (Window - Preferences - General - Editors - Text Editors - Spelling). Not enabled. But still there in all my Java projects. How to turn (back) off without uninstalling Nodeclipse?
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43225260
answer count: 3
favorite count: 0
possible better answer: http://stackoverflow.com/a/27401892
upvote count: 5
has answer: http://stackoverflow.com/a/27392475
has title: Installed Nodeclipse on Eclipse Kepler, cannot turn off Java spell check
accepted answer: http://stackoverflow.com/a/27392475
has answer: http://stackoverflow.com/a/27401892
tagged with: nodeclipse
type: AnsweredQuestion

http://stackoverflow.com/q/27458104
has comment: http://stackoverflow.com/comment/43353232
has body: Okay, so don't ask why, but I'm trying to make a universal public static void main() method. I've already tried to use these two methods; public class Foo { public static void main(String[] args){ try { this.getClass().newInstance().check(); } catch(Exception e) { e.printStackTrace(); } } public void check() { System.out.println("Check succesful"); } } The error I get is that this "Cannot be used in a static context" Okay, so I know I can't use this in a static context, but what I want to know is how I can replace it, without using Foo.check() If possible, how should I do this? If not, I'd like to know why.
downvote count: 1
has answer: http://stackoverflow.com/a/27458136
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27458152
linked to: http://stackoverflow.com/q/8275499
possible better answer: http://stackoverflow.com/a/27458136
has answer: http://stackoverflow.com/a/27458193
type: Question
has comment: http://stackoverflow.com/comment/43353270
has title: Universal main method with this.getClass().newInstance()
has comment: http://stackoverflow.com/comment/43353223
accepted answer: http://stackoverflow.com/a/27458193
tagged with: this
has comment: http://stackoverflow.com/comment/43353227
has comment: http://stackoverflow.com/comment/43353219
favorite count: 0
has comment: http://stackoverflow.com/comment/43353276
has answer: http://stackoverflow.com/a/27458190
tagged with: static
answer count: 5
linked to: http://stackoverflow.com/q/936684
has comment: http://stackoverflow.com/comment/43353253
has comment: http://stackoverflow.com/comment/43353209
has answer: http://stackoverflow.com/a/27458134
upvote count: 2
score: 1
linked to: http://stackoverflow.com/q/3903537

http://stackoverflow.com/q/27343560
type: Question
has title: Netbeans "Import Classes" Error Message
has answer: http://stackoverflow.com/a/27502309
score: 0
tagged with: java
answer count: 3
upvote count: 1
has comment: http://stackoverflow.com/comment/43434913
downvote count: 1
has body: When I copy codes from one file and paste it to another, a message dialogue opens as "Import Classes" says, "Pasted code refers to the following not imported elements, resolve imports to include them?" After "OK" then IDE gives message, as in following images (since one does not need to import java.lang classes), and, IDE otherwise compiles and runs correctly with no problem. Environment : NetBeans IDE 8.0 running Java programs on Windows 8.1, Java (JRE, JDK) 8.xx
accepted answer: http://stackoverflow.com/a/27502309
possible better answer: http://stackoverflow.com/a/27345031
has answer: http://stackoverflow.com/a/27345031
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43142555
favorite count: 0
has answer: http://stackoverflow.com/a/27343630
tagged with: netbeans

http://stackoverflow.com/q/27460053
has comment: http://stackoverflow.com/comment/43357001
type: Question
has title: Eclipse-What is the root of a plugin project?
has comment: http://stackoverflow.com/comment/43357016
has body: I am currently using a third party plugin to develop an Entity-Relationship Diagram graphically. However, I am having some problems with classpaths. I am giving the path of a jar file to the plugin project. However, during runtime, the plugin is throwing a ClassDefNotFoundError. I think this is because the plugin cannot find the jar file. So, I intend to place the jar file in the plugin's root directory. However, I cannot find the root directory of the plugin. Where is the root directory of the plugin located?
has comment: http://stackoverflow.com/comment/43357036
score: 0
tagged with: eclipse-plugin
has comment: http://stackoverflow.com/comment/43356886
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43356881
has comment: http://stackoverflow.com/comment/43356853
answer count: 0
has comment: http://stackoverflow.com/comment/43356958
tagged with: java
has comment: http://stackoverflow.com/comment/43356804
tagged with: eclipse

http://stackoverflow.com/q/27414023
accepted answer: http://stackoverflow.com/a/27414190
has comment: http://stackoverflow.com/comment/43272164
favorite count: 0
has comment: http://stackoverflow.com/comment/43272198
has title: How to solve variable might not have been initialized error
tagged with: initializing
has comment: http://stackoverflow.com/comment/43272196
has comment: http://stackoverflow.com/comment/43272167
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27414083
has answer: http://stackoverflow.com/a/27414153
has answer: http://stackoverflow.com/a/27414083
downvote count: 3
type: Question
has answer: http://stackoverflow.com/a/27414190
tagged with: java
score: -3
has body: I started studying for an exam and doing some practice programs with methods, and my mind is coming to a blank currently. I would like to know how I can initialize n1, n2, n3, and n4. I set them to 0 but the return statement returned only 0s. public class LargestOfIntegers2 { public static int findLargest(int n1, int n2, int n3, int n4) { Scanner scan = new Scanner(System.in); System.out.print("Enter the first integer --&gt; "); n1 = scan.nextInt(); System.out.print("Enter the second integer --&gt; "); n2 = scan.nextInt(); System.out.print("Enter the third integer --&gt; "); n3 = scan.nextInt(); System.out.print("Enter the fourth integer --&gt; "); n4 = scan.nextInt(); if(n1&gt;n2 &amp;&amp; n1 &gt; n3 &amp;&amp; n1 &gt; n4) return n1; else if(n2 &gt; n1 &amp;&amp; n2 &gt; n3 &amp;&amp; n2 &gt; n4) return n2; else if(n3&gt;n1 &amp;&amp; n3&gt;n2 &amp;&amp; n3&gt;n4) return n3; else return n4; } public static void main(String[] args) { int n1, n2, n3, n4; findLargest(n1, n2, n3, n4); if(n1&gt;n2 &amp;&amp; n1 &gt; n3 &amp;&amp; n1 &gt; n4) System.out.println("Out of the numbers " + n1 + ", " + n2 + ", " + n3 + ", " + n4 + ", the largest integer is " + n1); else if(n2 &gt; n1 &amp;&amp; n2 &gt; n3 &amp;&amp; n2 &gt; n4) System.out.println("Out of the numbers " + n1 + ", " + n2 + ", " + n3 + ", " + n4 + ", the largest integer is " + n2); else if(n3&gt;n1 &amp;&amp; n3&gt;n2 &amp;&amp; n3&gt;n4) System.out.println("Out of the numbers " + n1 + ", " + n2 + ", " + n3 + ", " + n4 + ", the largest integer is " + n3); else System.out.println("Out of the numbers " + n1 + ", " + n2 + ", " + n3 + ", " + n4 + ", the largest integer is " + n4); } }
answer count: 3
has comment: http://stackoverflow.com/comment/43272149
upvote count: 0

http://stackoverflow.com/a/27445822
has comment: http://stackoverflow.com/comment/43330782
type: Answer
score: 0
has body: What you should do is change your logic a bit. You need to repeat two actions, entering a price and asking if the user wants to enter another price. Only one loop is required for this. do { System.out.println("Please enter a price: "); integer = input.nextInt(); count = count + 1; sum = sum + integer; System.out.println("Enter another price? "); addPrice = input.next(); } while (addPrice.equalsIgnoreCase("Y"));
has comment: http://stackoverflow.com/comment/43330863
answers question: http://stackoverflow.com/q/27445588
has comment: http://stackoverflow.com/comment/43330669

http://stackoverflow.com/comment/43252620
score: 3
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27403737
has text: Why don't you load the CSV stream from the classpath using Class.getResourceAsStream()?

http://stackoverflow.com/comment/43457675
comment on: http://stackoverflow.com/a/27465880
has text: so i just noticed something the "$" means it is a php variable. does anyone know how to get the value of a php variable using JWebUnit or a similar java library?
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/q/27385672
type: AnsweredQuestion
tagged with: java
tagged with: keylistener
type: Question
has answer: http://stackoverflow.com/a/27385903
has comment: http://stackoverflow.com/comment/43219897
answer count: 1
downvote count: 0
has body: I'm making a game in Java where I want to be able to walk up to an NPC and press space to talk to them. However, my KeyBoard class right now is geared toward the movement keys (wasd &amp; up down left right), where it's always recognizing the press to keep the player moving. How would I set it up so that the space bar would only be recognized once it's pressed and wouldn't be recognizable until the player released it and pressed it again? public class Keyboard implements KeyListener { private boolean[] keys = new boolean[120]; public boolean up, down, left, right, interact; public void update() { up = keys[KeyEvent.VK_UP] || keys[KeyEvent.VK_W]; down = keys[KeyEvent.VK_DOWN] || keys[KeyEvent.VK_S]; left = keys[KeyEvent.VK_LEFT] || keys[KeyEvent.VK_A]; right = keys[KeyEvent.VK_RIGHT] || keys[KeyEvent.VK_D]; interact = keys[KeyEvent.VK_SPACE]; } public void keyPressed(KeyEvent e) { keys[e.getKeyCode()] = true; } public void keyReleased(KeyEvent e) { keys[e.getKeyCode()] = false; } }
favorite count: 0
accepted answer: http://stackoverflow.com/a/27385903
score: 2
has title: Java: Recognizing keyPressed only once per press
upvote count: 2

http://stackoverflow.com/q/27354020
type: Question
has comment: http://stackoverflow.com/comment/43166261
has answer: http://stackoverflow.com/a/27467202
score: 0
has body: (JAVA FILE 1) public class CropActivity extends Activity implements OnTouchListener { public static final String RETURN_DATA = "return-data"; public static final String RETURN_DATA_AS_BITMAP = "data"; public static final String ACTION_INLINE_DATA = "inline-data"; private ImageView mImg; private ImageView mTemplateImg; // private static ProgressDialog mProgressDialog; private Matrix mMatrix = new Matrix(); private float mScaleFactor = 0.8f; private float mRotationDegrees = 0.f; private float mFocusX = 0.f; private float mFocusY = 0.f; private int mImageHeight, mImageWidth; private ScaleGestureDetector mScaleDetector; private MoveGestureDetector mMoveDetector; // Constants public static final int MEDIA_GALLERY = 1; public static final int TEMPLATE_SELECTION = 2; public static final int DISPLAY_IMAGE = 3; Bitmap profilePic; String userImageLink; int cropImageWidth; int cropImageHeight; int width, height, w1; @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.crop_activity_layout); Resources r = getResources(); DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); width = dm.widthPixels; height = dm.heightPixels; double fWidth = width * (0.70); Log.d("Width is:- ", "&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;" + fWidth); w1 = (int) Math.round(fWidth); Log.d("Width after roundin is:- ", "&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;" + width); cropImageWidth = (int) TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, w1, r.getDisplayMetrics()); // etc... cropImageHeight = (int) TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, w1, r.getDisplayMetrics()); int actionBarHeight = (int) TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, 40, r.getDisplayMetrics()); userImageLink = getIntent().getStringExtra("path"); mImg = (ImageView) findViewById(R.id.cp_img); mTemplateImg = (ImageView…
answer count: 1
has comment: http://stackoverflow.com/comment/43165656
favorite count: 0
has comment: http://stackoverflow.com/comment/43166135
has title: Error on cropping a custom shape image
tagged with: android
type: UnansweredQuestion
upvote count: 1
tagged with: bitmap
downvote count: 1
tagged with: java

http://stackoverflow.com/comment/110615567
comment on: http://stackoverflow.com/a/58137087
has text: in my case, it was working but when I changed from tomcat to Undertow suddenly stop working. now i need a way to forward / to my index.html
score: 0
type: Comment
type: AnswerComment

http://stackoverflow.com/q/27347715
answer count: 1
has comment: http://stackoverflow.com/comment/43150273
tagged with: arraylist
score: 0
has title: How to copy a bitmap arraylist and integerarraylist in java
accepted answer: http://stackoverflow.com/a/27347780
tagged with: android
has comment: http://stackoverflow.com/comment/43153951
has comment: http://stackoverflow.com/comment/43150433
has comment: http://stackoverflow.com/comment/43150303
type: AnsweredQuestion
has body: I am trying to save two arraylists one bitmaparraylist and one integerarraylist in java. So far i've tried this: ArrayList&lt;Integer&gt; ID = new ArrayList&lt;Integer&gt;(); ArrayList&lt;Integer&gt; IDshuffle; ArrayList&lt;Bitmap&gt; crops = new ArrayList&lt;Bitmap&gt;(); ArrayList&lt;Bitmap&gt; cropsshuffle; protected void onCreate(Bundle savedInstanceState) { . . . . ArrayList&lt;Integer&gt; IDshuffle = new ArrayList&lt;Integer&gt;(ID) ArrayList&lt;Bitmap&gt; cropsshuffle = new ArrayList&lt;Bitmap&gt;(crops); And ArrayList&lt;Integer&gt; ID = new ArrayList&lt;Integer&gt;(); ArrayList&lt;Integer&gt; IDshuffle; ArrayList&lt;Bitmap&gt; crops = new ArrayList&lt;Bitmap&gt;(); ArrayList&lt;Bitmap&gt; cropsshuffle; protected void onCreate(Bundle savedInstanceState) { . . . . IDshuffle = new ArrayList&lt;Integer&gt;(ID) cropsshuffle = new ArrayList&lt;Bitmap&gt;(crops); I tried the .clone() method as well, but i realized that that is not what i want after finding more information. Please help me :) Kees Anyone
tagged with: java
has comment: http://stackoverflow.com/comment/43153865
has answer: http://stackoverflow.com/a/27347780
type: Question
has comment: http://stackoverflow.com/comment/43163926

http://stackoverflow.com/q/27389263
tagged with: multidimensional-array
linked to: http://stackoverflow.com/q/1055243
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27390152
has title: Determine whether rows in 2D array are unique
answer count: 4
has answer: http://stackoverflow.com/a/27389642
has comment: http://stackoverflow.com/comment/43228932
score: 1
has comment: http://stackoverflow.com/comment/43226580
has comment: http://stackoverflow.com/comment/43229947
type: Question
has comment: http://stackoverflow.com/comment/43229841
tagged with: algorithm
tagged with: java
has comment: http://stackoverflow.com/comment/43229534
has comment: http://stackoverflow.com/comment/43226511
has answer: http://stackoverflow.com/a/27391953
has answer: http://stackoverflow.com/a/27389995
upvote count: 1
tagged with: arrays
has body: I'm trying to create an algorithm which determines whether or not all of the rows in a 2D array of integers are unique (i.e. disjoint). Currently, I have a brute force algorithm which checks each value in each row to each value in the other rows, but I'd like to speed this up. Is there some kind of divide and conquer method to handle this? I have found some semi-solutions for this in single arrays and lists, but not in 2d arrays.
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43226954

http://stackoverflow.com/comment/43276805
type: AnswerComment
has text: In your Data model you pass 4 values. do you want to set the double value on 2nd button?
type: Comment
comment on: http://stackoverflow.com/a/27401036
score: 0

http://stackoverflow.com/q/27436195
tagged with: java
has title: Working out an invariant for a binary search
tagged with: binary-search
answer count: 1
tagged with: invariants
has comment: http://stackoverflow.com/comment/43313245
score: 0
type: UnansweredQuestion
tagged with: loop-invariant
type: Question
has comment: http://stackoverflow.com/comment/43325817
has answer: http://stackoverflow.com/a/29750703
has body: I need hep working out what the invariant for this code would be. I think there can be multiple invariants but i don't really understand the topic and online resources i have found still dont really help. The code i made for the binary search is: public class BinarySearchSqrt { /** Integer square root * Calculates the integer part of the square root * of n, i.e. integer s such that * s*s &lt;= n and (s+1)*(s+1) &gt; n * requires n &gt;= 0 */ private static int iSqrt(int n) { int l = 0; int r = n; int m = ((l + r + 1) / 2); /* loop invariant * : * : */ while (Math.abs(l - m) &gt; 0) { m = ((l + r + 1) / 2); if ((m + 1) * (m + 1) &gt; n) { r = m - 1; } else if ((m * m) &lt; n) { l = m + 1; } } return m; } public static void main(String[] args) { System.out.println(iSqrt(15)); System.out.println(iSqrt(16)); } } This code uses binary search to find the square root of an integer, but if it is not a square number it should return the square root of the closest square number that is less than the integer. The code works but i just dot really get what to put as the invariant is and how it shows what the correct value to return is. Any clues/explanation would be great, thank you.

http://stackoverflow.com/comment/43097234
type: Comment
comment on: http://stackoverflow.com/a/27318742
score: 0
type: AnswerComment
has text: I'm using `ComboBoxCell` so this method has one extra parameter `public void setEditable(XElement parent, boolean editable)`. I'm a gxt noob so forgive for asking but how can I get the `XElement` parent? I'm using `GXT 3.1.0` btw

http://stackoverflow.com/q/27464344
has comment: http://stackoverflow.com/comment/43365087
answer count: 2
has body: So I started working on a project involving the game MasterMind. I am now completely lost and have no idea what to do next to complete the game. I do not want in run as an applet, just in the console area. BTW this is run on eclipse. I am also having a problem with my if statement. It tells me that the operands are incompatible. The error code is: Incompatible operand types Scanner and Int[]. package masterMind; import java.util.Scanner; public class MasterMind { public static void main(String[] args) { System.out.println("This is MasterMind, a logic game"); System.out.println("To win you must guess correctly where each number is(The Numbers Range from 1-4)"); System.out.println("You will be told if you get one correct"); System.out.println("You will only get 10 tries, then you lose"); System.out.println("Lets begin"); //Declare Array int [] answerArray; answerArray= new int [4]; //Initialize Array //Change these value to change the answers needed to win answerArray[0]=2; answerArray[1]=3; answerArray[2]=2; answerArray[3]=2; //Create Board System.out.println("__ __ __ __"); Scanner userGuess = new Scanner(System.in); int num = userGuess.nextInt(); boolean guessedAll = false; int guessedCount=0; int tryCounter=0; while(tryCounter&lt;9 || !guessedAll){ if (userGuess==answerArray) { } else { } //if number equals one of the numbers above then guessedCount++ ... //if guessedCount==4 then guessedAll=true tryCounter++; } } }
has answer: http://stackoverflow.com/a/27464531
has comment: http://stackoverflow.com/comment/43365017
has comment: http://stackoverflow.com/comment/43365025
has comment: http://stackoverflow.com/comment/43369693
has comment: http://stackoverflow.com/comment/43365077
has comment: http://stackoverflow.com/comment/43365711
has comment: http://stackoverflow.com/comment/43364996
has comment: http://stackoverflow.com/comment/43366851
has comment: http://stackoverflow.com/comment/43364898
has comment: http://stackoverflow.com/comment/43365155
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43366350
has title: MasterMind Game-Java
has comment: http://stackoverflow.com/comment/43364869
has comment: http://stackoverflow.com/comment/43367063
possible better answer: http://stackoverflow.com/a/27464531
type: Question
has comment: http://stackoverflow.com/comment/43365110
has comment: http://stackoverflow.com/comment/43367076
has answer: http://stackoverflow.com/a/27464505
accepted answer: http://stackoverflow.com/a/27464505
has comment: http://stackoverflow.com/comment/43365486
has comment: http://stackoverflow.com/comment/43365540
has comment: http://stackoverflow.com/comment/43364829
score: 0

http://stackoverflow.com/comment/43369483
comment on: http://stackoverflow.com/a/27466629
has text: Also, i done that, cast Passenger but it didn't work unfortunately
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43352186
score: 0
has text: but it have nothing to do with forge,i think i will not be able to write O letter in chat if i use this code
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27457369

http://stackoverflow.com/q/27447230
tagged with: java
tagged with: hibernate
type: Question
has body: I'm working on an OSGi application using Karaf. This application connects to a postgresql database using Hibernate 4.3. My application works when I use the hibernate default connection pool but JBoss advices not to use it on a prod system. So I'm trying to use a c3p0 connection pool. I use the following bundles: hibernate-jpa-2.1-api-1.0.0.Final hibernate-core-4.3.7.Final hibernate-entitymanager-4.3.7.Final hibernate-c3p0-4.3.7.Final hibernate-envers-4.3.7.Final hibernate-osgi-4.3.7.Final In order to use c3p0, I also add the requiered third party library: c3p0-0.9.2.1 wrapoption is set to "yes" as it's a simple jar file. All those bundles are correctly loaded by karaf. Now my problem is to add the PostgreSQL driver: I have postgresql-9.3-1102.jdbc41.jar, which is not a bundle (no manifest.mf file). I tried to: add it to the classpath wrap it using postgresql-9.3-1102.jdbc41.jar in bundles.xml wrap it throught eclipse using this tutorial make it into a fragment, hosted by my dao-layer bundle But nothing works. Each times c3p0 start the connexion pool and when it comes to find the right driver, it fails with this message: java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(DriverManager.java:278)[:1.7.0_67] at com.mchange.v2.c3p0.DriverManagerDataSource.driver(DriverManagerDataSource.java:240)[98:wrap_file_D_container_karaf_bundles_c3p0-0.9.2.1.jar:0] at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:146)[98:wrap_file_D_trunk_container_karaf_bundles_c3p0-0.9.2.1.jar:0] Looking for this kind of problem, I found there are 2 reasons this may append: the hibernate.connection.url may be wrong. But that's not my case. I checked it multiple times. The postgresql driver is not loaded Is there any magical trick to use c3p0 with hibernate on a OSGi environment?
answer count: 1
tagged with: c3p0
accepted answer: http://stackoverflow.com/a/27448184
favorite count: 0
tagged with: postgresql
tagged with: osgi
upvote count: 2
score: 1
has title: PostgreSQL connector on OSGi
downvote count: 1
has answer: http://stackoverflow.com/a/27448184
type: AnsweredQuestion

http://stackoverflow.com/comment/43310117
score: 0
has text: what are the min value and max value of width and higth?
comment on: http://stackoverflow.com/q/27434612
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43187107
score: 0
type: Comment
type: QuestionComment
has text: is the only reason for this abstract class so that it acts as a container for shared variables?
comment on: http://stackoverflow.com/q/27367524

http://stackoverflow.com/comment/43358228
type: Comment
type: QuestionComment
has text: @OlivierMeurice Its not answered there. I have a key which of type Category and not String ergo relationship annotations have to be added additionally which is were I m having trouble
comment on: http://stackoverflow.com/q/27459304
score: 1

http://stackoverflow.com/q/27376681
downvote count: 0
tagged with: jsp
tagged with: javascript
tagged with: jquery
has answer: http://stackoverflow.com/a/27383854
has answer: http://stackoverflow.com/a/27385563
answer count: 2
has comment: http://stackoverflow.com/comment/43203247
has comment: http://stackoverflow.com/comment/43203788
has comment: http://stackoverflow.com/comment/43205575
score: 1
favorite count: 0
has body: <form:form action="approveAccount.html" method="GET"> Following Accounts are Pending to approve <c:forEach items="${accountIdList}" var="val"> ${val} </c:forEach> </form:form> val is the value that is fetched from database, I want to add a submit button and want to use this fetched value to do some stuffs, how many value get fetched is dynamically decided, how todo that.. here in this scenario, I am getting account id which admin needs to approv, so by adding textbox, admin can assign the role to the this account and then submit the to the database and this all happen with that clk of button
has title: Adding button and textbox dynamically in jsp page
has comment: http://stackoverflow.com/comment/43216278
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43203338
upvote count: 1
has comment: http://stackoverflow.com/comment/43203121
tagged with: java
type: Question

http://stackoverflow.com/q/27394032
answer count: 1
downvote count: 0
favorite count: 0
has body: I was trying to check if it is possible to use MethodHandle::invoke or MethodHandle::invokeExact as method references for a functional interface that accepts a MethodHandle and returns a generified output. (I know that invoke and invokeExact are signature polymorphic, hence the metafactory call in InvokeExact. However, I wanted to know if the compiler is able to elide the things that I had to do to derive a suitable version of invoke/invokeExact.) invoke.InvokeExact0 package invoke; import java.lang.invoke.MethodHandle; import static java.lang.System.out; import static java.lang.invoke.LambdaMetafactory.metafactory; import static java.lang.invoke.MethodHandles.lookup; import static java.lang.invoke.MethodType.methodType; @FunctionalInterface public interface InvokeExact0&lt;OUTPUT&gt; { public OUTPUT invokeExact(MethodHandle methodHandle) throws Throwable; public static &lt;OUTPUT&gt; InvokeExact0&lt;OUTPUT&gt; new_(InvokeExact0&lt;OUTPUT&gt; invokeExact) { return invokeExact; } public static void main(String... arguments) throws Throwable { out.println( (InvokeExact0&lt;String&gt;) metafactory( lookup(), "invokeExact", methodType(InvokeExact0.class), methodType( Object.class, MethodHandle.class ), lookup().findVirtual( MethodHandle.class, "invokeExact", methodType(String.class) ), methodType( String.class, MethodHandle.class ) ) .getTarget() .invokeExact() ); out.println(InvokeExact0.new_(MethodHandle::invokeExact)); } } Result invoke.InvokeExact0$$Lambda$1/1878246837@5ca881b5 Exception in thread "main" java.lang.BootstrapMethodError: call site initialization exception at java.lang.invoke.CallSite.makeSite(CallSite.java:328) at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:296) at invoke.InvokeExact0.main(InvokeExact0.java:41) Caused by: java.lang.invoke.LambdaConversionException: Incorrect number of parameters for instance method invokeVirtual java.lang.invoke.MethodHandle.invokeExact:(MethodH andle)Object; 0 captured parameters, 1 fun…
accepted answer: http://stackoverflow.com/a/27398828
score: 5
tagged with: lambda
tagged with: java-8
type: AnsweredQuestion
tagged with: java
type: Question
has title: BootstrapMethodError caused by LambdaConversionException caused by using MethodHandle::invokeExact as a method reference
upvote count: 5
has answer: http://stackoverflow.com/a/27398828
tagged with: methodhandle
tagged with: invokedynamic

http://stackoverflow.com/comment/43231634
type: AnswerComment
type: Comment
has text: I set it like that and still got an error, however when I changed it to `PassEntries.setAdapter(Adapter)` it didn't give any errors.. Does that still work for what we are trying to do?
comment on: http://stackoverflow.com/a/27391922
score: 0

eclipse-rcp
tags question: http://stackoverflow.com/q/27440109
type: Tag
tags question: http://stackoverflow.com/q/27361828
tags question: http://stackoverflow.com/q/27404611
tags question: http://stackoverflow.com/q/27404824
tags question: http://stackoverflow.com/q/27382205
tags question: http://stackoverflow.com/q/27421499
tags question: http://stackoverflow.com/q/27381963
tags question: http://stackoverflow.com/q/27319330
tags question: http://stackoverflow.com/q/27396594
tag name: eclipse-rcp
tags question: http://stackoverflow.com/q/27380445

http://stackoverflow.com/q/27326953
answer count: 1
downvote count: 0
accepted answer: http://stackoverflow.com/a/27326992
favorite count: 0
linked to: http://stackoverflow.com/q/13025907
score: 1
upvote count: 1
has answer: http://stackoverflow.com/a/27326992
type: AnsweredQuestion
has body: public class ExampleServlet extends HttpServlet{ private Closure closure; @Override protected void doPost(final HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { // Do some stuff here... if (this.closure == null){ this.closure = new Closure(){ @Override public void someFunction(){ req.getRequestURI(); // Obviously do something with it... } } } // Later... this.closure.someFunction(); // &lt;&lt; Is this thread-save?? // More stuff here... } } In the example, I have no control over Closure! If I test this, it works fine. The question is: Does every request-thread get a new copy of the closure-field? Otherwise, when a new request comes in, the referenced req-field would change while the someFunction() is still executing. Or is this handled by declaring req as final?
tagged with: java
tagged with: closures
has comment: http://stackoverflow.com/comment/43112986
tagged with: servlets
type: Question
has title: Is this caching a closure thread save?

http://stackoverflow.com/q/27339234
has title: Unbound copy service for Android
tagged with: service
upvote count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27849372
tagged with: java
score: -1
type: Question
tagged with: android-service
answer count: 1
has body: Ok, so I'm working on an Android program that will list the things you copied in history. I used to have an activity do this, but I want it to work even when the activity is not running in the background, so I'm working on a service to get the data that the user copies, and call an activity method for it to be processed and listed in the app. Here is my service: public class Operation extends Service { private static int NOTIFY_ID = 1; ClipData.Item item; String newText; ClipboardManager clipboard; Context context = this; ArrayList&lt;String&gt; operationVals = new ArrayList&lt;String&gt;(); @Override public IBinder onBind(Intent arg0) { return null; } @Override public void onCreate() { NotificationCompat.Builder tasker = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.appicon) .setContentTitle("Copy Data Recorder") .setOngoing(true) .setContentText("Recording copied data"); Intent copyAction = new Intent(this, MainActivity.class); PendingIntent pendAction = PendingIntent.getActivity(this, 0, copyAction, 0); tasker.setContentIntent(pendAction); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(NOTIFY_ID, tasker.build()); } @Override public void onStart(Intent intent, int startId) {} @Override public void onDestroy() {} @Override public int onStartCommand(Intent intent, int flags, int startId){ clipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); clipboard.addPrimaryClipChangedListener(new OnPrimaryClipChangedListener() { public void onPrimaryClipChanged() { ClipData clip = clipboard.getPrimaryClip(); try { item = clip.getItemAt(0); } catch (Exception e) { } newText = item.coerceToText(context).toString(); operationVals.add(newText); try { MainActivity messager = new MainActivity(); messager.doIt(operationVals); } catch (Exception e) { System.out.println("Exception Error: " + e); } } }); return START_STICKY; } } Basically, every time, it's get…
favorite count: 0
tagged with: nullpointerexception
tagged with: android
downvote count: 1

http://stackoverflow.com/q/27345249
has comment: http://stackoverflow.com/comment/43175498
has comment: http://stackoverflow.com/comment/43145950
type: UnansweredQuestion
tagged with: android
has comment: http://stackoverflow.com/comment/43146039
answer count: 0
has title: Download, Save, And Retrieve Image Path in Android
tagged with: java
tagged with: android-intent
type: Question
has comment: http://stackoverflow.com/comment/43230602
has comment: http://stackoverflow.com/comment/43151012
has comment: http://stackoverflow.com/comment/43146166
has comment: http://stackoverflow.com/comment/43176009
score: 0
has body: i have a method where i download and save image from a given url, this method returns a File, then i use this File ( image ) to get it's path and use it to share this image. My Test results where like this: Samsung Note3 Neo 4.3: Worked Emulator 2.2: Worked Tablet 4.2: App crashes when method called Emulator 3.1: App crashes when method called My Method: private class getImgDownloadedPath extends AsyncTask&lt;Void, Void, File&gt; { private String urlImage; private String imageName; private Context context; private ProgressDialog dialog; short max=100; public getImgDownloadedPath(Context context,String urlImage,String imageName){ this.urlImage = urlImage; this.imageName = imageName; this.context = context; dialog = new ProgressDialog(context); dialog.setTitle("Share"); dialog.setMax(max); dialog.setCancelable(false); dialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); dialog.setMessage("Please Wait..."); } protected void onPreExecute() { // TODO Auto-generated method stub dialog.show(); } protected File doInBackground(Void... params) { String filepath = null; File fileToReturn = null; try { URL url = new URL(urlImage); HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection(); urlConnection.setRequestMethod("GET"); urlConnection.setDoOutput(true); urlConnection.connect(); String SDCardRoot = Environment.getExternalStorageDirectory().toString(); //.getAbsoluteFile(); new File(SDCardRoot + "/Pictures/Pubit").mkdirs(); String filename= imageName + ".png"; Log.i("Local filename:",""+filename); File file = new File(SDCardRoot + "/Pictures/myapp",filename); if(file.createNewFile()) { file.createNewFile(); } FileOutputStream fileOutput = new FileOutputStream(file); InputStream inputStream = urlConnection.getInputStream(); int totalSize = urlConnection.getContentLength(); int downloadedSize = 0; byte[] buffer = new byte[1024]; int bufferLength = 0; while ( (bufferLength = inputStream.read(buffer)) &gt; 0 ) { fileOutput.write(buffer, 0, bufferLength); down…
tagged with: android-asynctask
has comment: http://stackoverflow.com/comment/43145789

http://stackoverflow.com/a/27371338
answers question: http://stackoverflow.com/q/27364271
upvote count: 4
downvote count: 0
has body: Actually, there is a way to handle this by specifying "serialize-as-array" @JsonPropertyOrder({ machineInfo, userUploads }) @JsonFormat(shape=JsonFormat.Shape.ARRAY) public class ActivityUpload { @JsonProperty MachineInfo machineInfo; @JsonProperty List&lt;UserUpload&gt; userUploads; } and it should then match what you have.
type: Answer
score: 4

http://stackoverflow.com/q/27444565
answer count: 1
has answer: http://stackoverflow.com/a/27474157
type: UnansweredQuestion
score: 2
has body: I want to create a function in jmeter and need to call this function by using Function helper Dialog,and When I google regarding this ,I found one link http://www.javacodegeeks.com/2013/06/jmeter-custom-function-implementation.html but still the created function is not appeared in the dialog box. Is any one will help m regarding this ?? Thanks in advance.... And my Jmeter log for this is : 2014/12/18 10:48:00 INFO - jmeter.util.JMeterUtils: Setting Locale to en_US 2014/12/18 10:48:00 INFO - jmeter.JMeter: Loading user properties from: E:\apache-jmeter-2.12\apache-jmeter-2.12\bin\user.properties 2014/12/18 10:48:01 INFO - jmeter.JMeter: Loading system properties from: E:\apache-jmeter-2.12\apache-jmeter-2.12\bin\system.properties 2014/12/18 10:48:01 INFO - jmeter.JMeter: Copyright (c) 1998-2014 The Apache Software Foundation 2014/12/18 10:48:01 INFO - jmeter.JMeter: Version 2.12 r1636949 2014/12/18 10:48:01 INFO - jmeter.JMeter: java.version=1.7.0_51 2014/12/18 10:48:01 INFO - jmeter.JMeter: java.vm.name=Java HotSpot(TM) Client VM 2014/12/18 10:48:01 INFO - jmeter.JMeter: os.name=Windows XP 2014/12/18 10:48:01 INFO - jmeter.JMeter: os.arch=x86 2014/12/18 10:48:01 INFO - jmeter.JMeter: os.version=5.1 2014/12/18 10:48:01 INFO - jmeter.JMeter: file.encoding=Cp1252 2014/12/18 10:48:01 INFO - jmeter.JMeter: Default Locale=English (United States) 2014/12/18 10:48:01 INFO - jmeter.JMeter: JMeter Locale=English (United States) 2014/12/18 10:48:01 INFO - jmeter.JMeter: JMeterHome=E:\apache-jmeter-2.12\apache-jmeter-2.12 2014/12/18 10:48:01 INFO - jmeter.JMeter: user.dir =E:\apache-jmeter-2.12\apache-jmeter-2.12\bin 2014/12/18 10:48:01 INFO - jmeter.JMeter: PWD =E:\apache-jmeter-2.12\apache-jmeter-2.12\bin 2014/12/18 10:48:01 INFO - jmeter.JMeter: IP: 10.206.0.106 Name: himanshuj2 FullName: himanshuj2.newvisionsoftware.com 2014/12/18 10:48:01 INFO - jmeter.JMeter: Loaded icon properties from org/apache/jmeter/images/icon.properties 2014/12/18 10:48:03 INFO - jmeter.engine.util…
downvote count: 0
has title: How to Create User Defined function in jmeter
favorite count: 0
type: Question
tagged with: jmeter
upvote count: 2
tagged with: java

http://stackoverflow.com/comment/43136015
comment on: http://stackoverflow.com/a/27332325
has text: hi, thanks for helping. do you know how to set button on the left and image button on the right in table row ??
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27436303
has title: Problems Sorting a two column array and outputting value frequency in Java
type: Question
has answer: http://stackoverflow.com/a/27436599
tagged with: java
has comment: http://stackoverflow.com/comment/43314056
score: 0
tagged with: for-loop
answer count: 3
tagged with: arrays
tagged with: sorting
has comment: http://stackoverflow.com/comment/43379295
has comment: http://stackoverflow.com/comment/43313461
has body: Here is the problem I have, I spent a long time toying with for loops and arrays and temp variables, and now my output is just a couple numbers. /* Write a program that reads numbers from the keyboard into an array of type int[]. You may assume that there will be 50 or fewer entries in the array. Your program allows any number of numbers to be entered, up to 50. The output is to be a two-column list. The first column is a list of the distinct array elements; the second is the count of the number of occurrences of each element. The list should be sorted on entries in the first column, largest to smallest. For the array: -12, 3, -12, 4, 1, 1, -12, 1, -1, 1, 2, 3, 4, 2, 3, -12 the output should be: N Count 4 2 3 3 2 2 1 4 -1 1 -12 4 */ import java.util.Scanner; public class Project2C { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); int[][] twoColumn = new int[2][50]; int[] inputValues = new int[50]; int temp = 0; int valueFrequency = 0; int lastUsedSpace = 0; //gather user input to fill an array (up to 50 values); System.out.println("Input up to 50 values."); for (int i = 0; i &lt; 50; i++) { System.out.println("value #" + (i + 1) + ":"); inputValues[i] = keyboard.nextInt(); /*System.out.println("Press 0 to stop, or 1 to continue."); if (keyboard.nextInt() == 0) { break; } else if (keyboard.nextInt() == 1){ continue; } else if (keyboard.nextInt() != 0 &amp;&amp; keyboard.nextInt() != 1) { System.out.println("You must enter 0 or 1. Now you must re-enter the value."); i--; }*/ } // checking if each value occurs more than once, and assigning it a place // in the two column array if it is unique. for (int i = 0; i &lt; inputValues.length; i++) { for (int j = 0; j &lt; inputValues.length; j++) { if (i == 0 &amp;&amp; inputValues[i] != inputValues[j]) { twoColumn[0][lastUsedSpace] = inputValues[i]; } else if (i &gt; 0 &amp;&amp; inputValues[i] != inputValues[j]) { twoColumn[0][lastUsedSpace + 1] = inputValues[i]; } } } lastUsedSpace = -1;…
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27472414
has answer: http://stackoverflow.com/a/27437948

http://stackoverflow.com/a/27422741
has comment: http://stackoverflow.com/comment/43288042
accepted answer of: http://stackoverflow.com/q/27422646
has comment: http://stackoverflow.com/comment/43288788
type: Answer
answers question: http://stackoverflow.com/q/27422646
score: 3
upvote count: 3
has body: There is an extra closing bracket, also this line has to be inside a method or constructor: inside constructor cac.setLayout(new BoxLayout(cac, BoxLayout.PAGE_AXIS))); remove this------^
has comment: http://stackoverflow.com/comment/43287679
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43364535
score: 0
type: Comment
has text: Have you tried anything yourself?
comment on: http://stackoverflow.com/q/27464049
type: QuestionComment

http://stackoverflow.com/a/27332055
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27331979
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27331979
upvote count: 1
has body: items.length will always be the length of the entire array (100 in your case), nomatter how many items you have actually added. Try it like this: public void listAllItems(){ for (int i = 0; i &lt; numberOfItems; i++){ System.out.println(items[i].getTitle()); } } The problem in your case is not the getter itself but trying to call the getTitle() method on null.
has comment: http://stackoverflow.com/comment/43122193

http://stackoverflow.com/a/27453599
downvote count: 0
has body: You don't have any constructor defined in AverageFINAL. In that case, Java creates a default, no-arg constructor. It's as if this was defined: public AverageFINAL() {} However, you are attempting to pass an int[] in this line: AverageFINAL object = new AverageFINAL(data); If you want to pass the int[], then you must explicitly create a constructor that takes an int[] as its parameter, and presumably you want to assign that int[] to your instance variable data.
type: Answer
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27453577

midi
tags question: http://stackoverflow.com/q/27320101
type: Tag
tag name: midi

http://stackoverflow.com/comment/43283087
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27419491
has text: @ratchetfreak For that, the policy is "point at infinity"-> outside clip space -> remove during clipping. You are right, this is an error. Anyhow, you also MUST draw s.th. to even get to this clipping ;)

http://stackoverflow.com/comment/43120774
comment on: http://stackoverflow.com/q/27331435
type: QuestionComment
type: Comment
score: 1
has text: you can also use method name as `String _() { return "I've never been expected anyone would invoke me"; }`

http://stackoverflow.com/comment/43449012
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27485703
type: Comment
has text: Where it says before "As far as I have been able to reproduce the crash" I actually mean "As far as I have NOT been able to reproduce the crash", although I think it was clear due context.

http://stackoverflow.com/q/27381692
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27381808
type: Question
has title: How to make the player always point to the mouse
linked to: http://stackoverflow.com/q/1439022
score: 0
tagged with: java
answer count: 1
has body: Just for fun I thought I would create the game Asteroids. I'm a little bit stuck on the the fact I can't get the player to always look where the mouse is. Here is the player class below. public class Player extends GameObject { private int size; public Player(float x, float y, int width, int height) { super(x, y, width, height); size = width / 2 + height / 2; } public void update() { } public void render(Graphics g) { Point mouse = MouseInfo.getPointerInfo().getLocation(); int centerX = (int) (mouse.getX() - getX()); int centerY = (int) (mouse.getY() - getY()); double angle = Math.toDegrees(Math.atan2(centerY, centerX)); Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setColor(Color.white); g2d.rotate(angle, (int) getX() + getWidth() / 2, (int) getY() + getHeight() / 2); g2d.drawLine((int) getX() + getWidth() / 2, (int) getY(), (int) getX(), (int) getY() + getHeight()); g2d.drawLine((int) getX() + getWidth() / 2, (int) getY(), (int) getX() + getWidth(), (int) getY() + getHeight()); g2d.drawLine((int) getX(), (int) getY() + getHeight(), (int) getX() + getWidth() / 2, (int) getY() + getHeight() - size / 6); g2d.drawLine((int) getX() + getWidth(), (int) getY() + getHeight(), (int) getX() + getWidth() / 2, (int) getY() + getHeight() - size / 6); } public Rectangle getBounds() { return new Rectangle((int) getX(), (int) getY(), getWidth(), getHeight()); } public void setSize(int size) { this.size = size; } public int getSize() { return size; } } I guess it sort of works in the fact that if I move my mouse the player does rotate but it rotate pretty fast. So I ask am I doing anything wrong? Before you ask, I have looked it up on Google and found some question like this one but none have helped me.
has answer: http://stackoverflow.com/a/27381808

http://stackoverflow.com/q/27360091
linked to: http://stackoverflow.com/q/17874717
has title: I would like to create a text generator using JFrame just like in the picture inside :
tagged with: jframe
type: UnansweredQuestion
tagged with: swing
type: Question
has comment: http://stackoverflow.com/comment/43172308
has body: I'm starting to get familiar with Java and the JFrame package, but I'm not quite there. This is what I would like to get: As you can see, I'd like to have the possibility to fill boxes and then take what is in the boxes and make a pre-written sentence with it !
tagged with: java
has answer: http://stackoverflow.com/a/27360293
has comment: http://stackoverflow.com/comment/43190216
answer count: 2
linked to: http://stackoverflow.com/q/5621338
upvote count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/27363865
favorite count: 0
has comment: http://stackoverflow.com/comment/43194931
score: 0
has comment: http://stackoverflow.com/comment/43172539

http://stackoverflow.com/comment/55661174
score: 1
has text: If you get a "gradlew not recognize", simply append the "./" it will look like `./gradlew clean build`
comment on: http://stackoverflow.com/q/27407855
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27361148
type: Question
tagged with: google-cloud-messaging
has comment: http://stackoverflow.com/comment/43183323
tagged with: aes
has comment: http://stackoverflow.com/comment/43174783
has answer: http://stackoverflow.com/a/27366174
upvote count: 3
tagged with: java
has comment: http://stackoverflow.com/comment/43184307
answer count: 1
has comment: http://stackoverflow.com/comment/43184368
has body: We are planning to use "AES/GCM/NoPadding" in Java using BouncyCastle v1.51. Can someone shed some light on the ideal implementation / best practices with respect to the usage &amp; generation of additional authenticated data (AAD) &amp; authentication tag? At what point should AAD be used in the encryption process? As per documentation, the authentication tag is part of encrypted output. In what format is it appended to the encrypted output? How is the authentication tag processed during decryption? Following is the encryption code: private static byte[] encryptGCM(byte[] plaintext, byte[] randomKeyBytes, byte[] randomIvBytes) throws Exception{ SecretKey randomKey = new SecretKeySpec(randomKeyBytes, "AES"); Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding", new BouncyCastleProvider()); cipher.init(Cipher.ENCRYPT_MODE, randomKey, new IvParameterSpec( randomIvBytes)); //TODO: here IvParamSpec could also be gcmP = new GCMParameterSpec(12, keys, 32, 12); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); CipherOutputStream cipherOutputStream = new CipherOutputStream(byteArrayOutputStream, cipher); cipherOutputStream.write(plaintext); cipherOutputStream.close(); return byteArrayOutputStream.toByteArray();//this is the encrypted text }
has comment: http://stackoverflow.com/comment/43184305
has comment: http://stackoverflow.com/comment/43184028
has comment: http://stackoverflow.com/comment/43184631
accepted answer: http://stackoverflow.com/a/27366174
has title: Usage of additional authenticated data & authentication tag for AES-GCM using BouncyCastle
has comment: http://stackoverflow.com/comment/43184012
type: AnsweredQuestion
score: 3
downvote count: 0
favorite count: 0
tagged with: bouncycastle

http://stackoverflow.com/q/27441576
has comment: http://stackoverflow.com/comment/43323017
type: UnansweredQuestion
has title: Java one-time use wrapping class
answer count: 0
has comment: http://stackoverflow.com/comment/43322906
has comment: http://stackoverflow.com/comment/43322861
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has comment: http://stackoverflow.com/comment/43322803
type: Question
has body: I'm using Data Access Layer/Object (DAL/DAO) pattern, and I am constructing a Request object to be sent to the back-end (note: I have no control over the back-end's design). The Request object looks something like this: class DAORequest { private Integer field1; private String field2; private AttrList field3; ... private Long fieldn; } where AttrList class is: class AttrList { private List&lt;Attr&gt; attributes; // this is the only field of AttrList class } (On the side note: I'm conforming to a JSON-format request that looks like this: request { field1: value1, field2: value2, attrList: { attributes: [{}, {}, ..., {}] }, ... } the Java object will be converted to GSON/JSON request) I'm quite loathe to write another class (AttrList in my case) whose sole purpose is to wrap the actual content (and by consequence, would clutter my project space with un-reusable java files). Actually, there are many more RESTful endpoints in the back-end whose Requests are to be built this way. Is there anyway I can avoid writing AttrList and the like?
has comment: http://stackoverflow.com/comment/43322823
has comment: http://stackoverflow.com/comment/43323090
has comment: http://stackoverflow.com/comment/43323421
score: 0
has comment: http://stackoverflow.com/comment/43323228

http://stackoverflow.com/q/27375002
has comment: http://stackoverflow.com/comment/43201183
score: 0
accepted answer: http://stackoverflow.com/a/27375878
answer count: 1
has comment: http://stackoverflow.com/comment/43201307
has answer: http://stackoverflow.com/a/27375878
has title: VBox Dragging flickers
has comment: http://stackoverflow.com/comment/43200995
has body: I create a new Stage in the Code and it's needed, that the Stage is undecorated! In this case the new created Stage loses the Drag-Function. I created the following code, now i can drag the Stage. But the Stage is flickery, so it stays not at one place, it flickers in a radius of some pixels. How can I solve this problem? Thanks for your help. EXAMPLE - CODE: import javafx.application.Application; import javafx.beans.property.ObjectProperty; import javafx.beans.property.SimpleObjectProperty; import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.geometry.Point2D; import javafx.scene.Cursor; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.MenuBar; import javafx.scene.input.MouseEvent; import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; import javafx.scene.layout.Priority; import javafx.scene.layout.VBox; import javafx.stage.Stage; import javafx.stage.StageStyle; public class DragStuff extends Application { VBox mainContainer; Stage mainSt; @Override public void start(Stage mainStage) throws Exception { // TODO Auto-generated method stub mainStage.initStyle(StageStyle.UNDECORATED); mainSt = mainStage; mainContainer = new VBox(); mainContainer.setStyle("-fx-background-color:red"); Label headlineInformation = new Label("Testing"); headlineInformation.getStyleClass().addAll("popup-label-name"); headlineInformation.setMaxWidth(Double.MAX_VALUE); Button closeButton = new Button("X"); closeButton.setVisible(true); closeButton.getStyleClass() .addAll("popup-button", "popup-button-color"); HBox headContainer = new HBox(); HBox.setHgrow(headlineInformation, Priority.ALWAYS); headContainer.setPadding(new Insets(5, 5, 5, 5)); headContainer.getChildren().addAll(headlineInformation, closeButton); Pane pane = new Pane(); pane.getChildren() .addAll(new Label( "Text Stuff")); mainContainer.getChildren().addAll(headContainer, pane); Scene sc = new Scene(mainContainer); m…
has comment: http://stackoverflow.com/comment/43200863
type: AnsweredQuestion
tagged with: stage
tagged with: draggable
type: Question
tagged with: vbox
tagged with: java
tagged with: javafx

system-tray
tags question: http://stackoverflow.com/q/27442164
tag name: system-tray
type: Tag
tags question: http://stackoverflow.com/q/27337699

http://stackoverflow.com/comment/43555571
score: 0
type: AnswerComment
has text: (3) Please confirm, only because I can't quite decipher your answer to this above: I only need something like Bitronix/Atomikos/JBossTS **if** I'm using distributed transactions *outside* of a Java EE server (because Java EE servers have their own transaction managers), yes? **Furthermore**, if I do happen to need an "independent" transaction manager, such as Bitronix/Atomikos/JBossTS, then do I stand it up as its own server/VM, or is it just a lib that I pull into my project, like any other JAR? Thanks again - the bounty reward is coming soon!
type: Comment
comment on: http://stackoverflow.com/a/27561083

http://stackoverflow.com/a/27350095
has body: You could use Scanner from java.util, e.g. Scanner scanner = new Scanner(System.in); int a = scanner.nextInt(); int b = scanner.nextInt(); System.out.println(a + " " + b); Or BufferedReader from java.io: BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); int a = Integer.parseInt(reader.readLine()); int b = Integer.parseInt(reader.readLine()); System.out.println(a + " " + b); The previous snippet assumes each number is in a different line. BTW, it's a good idea to put these lines inside a try-catch block with IOException. EDIT: As @musical_coder mention, you can also use command line arguments, here is an example: int a = Integer.parseInt(args[0]); int b = Integer.parseInt(args[1]); System.out.println(a + " " + b); In this case you should run you program with: $ java Divisor &lt;first number&gt; &lt;second number&gt;
accepted answer of: http://stackoverflow.com/q/27350059
score: 1
answers question: http://stackoverflow.com/q/27350059
upvote count: 1
has comment: http://stackoverflow.com/comment/43154842
type: AcceptedAnswer
downvote count: 0
type: Answer

http://stackoverflow.com/comment/59771843
type: Comment
score: 25
has text: this does not work when you deploy application as war file to an external tomcat. It works only with embedded tomcat
comment on: http://stackoverflow.com/a/27405775
type: AnswerComment

http://stackoverflow.com/comment/43257684
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27405985
has text: Indeed I may revert back to using a timer for handling creature animation, I am just wanting creatures to be able to move independently an not need to rely on a loop or queue to decide when they move. The clipping suggestion I like though, I am just not sure how to do it - I have seen some do it by overriding update & paintcomponent but those methods don't have access to creature coordinates at the moment, so it wouldn't know what part of the JFrame to update.
score: 0

http://stackoverflow.com/comment/43223128
has text: Found [another hint](https://wiki.eclipse.org/Execution_Environments#Installing_Execution_Environment_Descriptions)
type: Comment
comment on: http://stackoverflow.com/q/27387066
type: QuestionComment
score: 0

http://stackoverflow.com/a/27360046
answers question: http://stackoverflow.com/q/27359782
has body: Add Button registerScreen = (Button) findViewById(R.id.btnLogin); Button loginScreen = (Button) findViewById (R.id.btnRegister); instead of Button registerScreen = (Button) findViewById(R.id.link_to_register); `Button loginScreen = (Button) findViewById (R.id.link_to_login);` you are casting the ID's of textViews instead of buttons. OR Change the ID name of buttons in main.xml ..
score: 0
accepted answer of: http://stackoverflow.com/q/27359782
has comment: http://stackoverflow.com/comment/43172276
type: Answer
upvote count: 1
downvote count: 1
has comment: http://stackoverflow.com/comment/43172715
has comment: http://stackoverflow.com/comment/43172428
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43172669

http://stackoverflow.com/comment/43258931
has text: It means your inputStream is not getting data.
comment on: http://stackoverflow.com/a/27406311
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43375585
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27470358
has text: You could possibly use SWIG to automate some of it, but looking at [this question/answer](http://stackoverflow.com/questions/8168517/generating-java-interface-with-swig) it may not be as straightforward as you might like...

http://stackoverflow.com/q/27414798
type: Question
tagged with: android-viewpager
has comment: http://stackoverflow.com/comment/43274131
has title: Set Image Wallaper of ViewPager in Universal Image Loader UIL
tagged with: wallpaper
has comment: http://stackoverflow.com/comment/43274000
answer count: 1
downvote count: 0
favorite count: 0
has body: I am Using Nostra Universal Image Loader plugin, I would like to be able to see the currently image on the ViewPager as the Phone Wallpaper. My code below can set the wallpaper, but its not he currently image thats is displaying on the ViewPager, it will be a image before or a image after, and sometimes a ramdom image of the Sting Array. public class ImagePagerFragment extends Fragment { public static final String TAG = ImagePagerFragment.class.getSimpleName(); VarController vc; public static final int INDEX = 2; public String[] imageUrls; DisplayImageOptions options; ImageView imageView; Button buttonSetWallpaper; WallpaperManager wallManager; ViewPager pager; int storePosition; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.i(TAG, "onCreate"); options = new DisplayImageOptions.Builder() .showImageForEmptyUri(R.drawable.ic_empty) .showImageOnFail(R.drawable.ic_error) .resetViewBeforeLoading(true) .cacheOnDisk(true) //.imageScaleType(ImageScaleType.EXACTLY) .imageScaleType(ImageScaleType.EXACTLY_STRETCHED) .bitmapConfig(Bitmap.Config.RGB_565) .considerExifParams(true) .displayer(new FadeInBitmapDisplayer(300)) .build(); } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.custom_fr_image_pager, container, false); pager = (ViewPager) rootView.findViewById(R.id.pager); Log.i(TAG, "onCreateView"); //getActivity().getSupportActionBar().show(); // Initiates imageUrls = null; String DateTempVC = vc.readPref_HOLDER_TMP_DATA(); wallManager = WallpaperManager.getInstance(AppApplication.getAppContext()); buttonSetWallpaper = (Button) rootView.findViewById(R.id.buttonSetWallpaper); buttonSetWallpaper.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click Log.d(TAG, "buttonSetWallpaper.setOnClickListener - storePosition=&gt; " + storePosition); try { setWall(); } catch(Exceptio…
has comment: http://stackoverflow.com/comment/43274474
has comment: http://stackoverflow.com/comment/43274152
tagged with: android
type: AnsweredQuestion
linked to: http://stackoverflow.com/q/11938182
tagged with: universal-image-loader
score: 1
has answer: http://stackoverflow.com/a/27416631
tagged with: java
accepted answer: http://stackoverflow.com/a/27416631
upvote count: 1

http://stackoverflow.com/a/27365247
type: Answer
has comment: http://stackoverflow.com/comment/43183730
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/43184384
answers question: http://stackoverflow.com/q/27365216
has body: The problem is that the jTDS library itself is compiled in Java 7. You should use Java 7 to run it, not Java 6. If you cannot change the Java version, you can try using an older version of the library that's compiled in Java 6. Or if you have access to the source code, you can try building it with the -target compiler flag set to 1.6.
upvote count: 3
has comment: http://stackoverflow.com/comment/43184141

http://stackoverflow.com/comment/43288004
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27422651
has text: There's webpage with THE answer: http://logging.apache.org/log4j/2.x/manual/configuration.html

http://stackoverflow.com/q/27473808
possible better answer: http://stackoverflow.com/a/27474481
score: 1
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27473839
accepted answer: http://stackoverflow.com/a/27473839
upvote count: 1
favorite count: 0
has body: got my first question and here it goes. I'm programming in java and making a litte program where I would like to track mouse event and make some statistics. For example number of right/left clicks, movements, time between doubleclicks, averages, etc. However I'm not able to make a little program and let in run in the background without any gui components in java. I'm not able to test my program and let it (for example) print lines in the console (in eclipse) for the events it gets from the mouse without resorting to a gui. I have not found anything where a mouselistener is used without a JPanel or where I can use a mouselistener without a gui. Is it not possible in java or are there ways I can get around this? Thanks in advance!
tagged with: mouselistener
has answer: http://stackoverflow.com/a/27474481
type: AnsweredQuestion
has title: MouseListener without a gui
downvote count: 0

http://stackoverflow.com/a/27410174
has body: Unfortunately, at this time I have no easy way to measure your Scala code, but your Java test method measured with a serious JVM benchmarking tool (JMH), clocks in at 0.5 nanoseconds&mdash;a proof that the JIT compiler treated it as a no-op. Even if we improve the method's realism by returning i from it, the JIT compiler is still smart enough to just replace the loop with a direct formula, this time clocking in at mere 1.3 nanoseconds. The major point to take from the above is: beware of microbenchmarks like the one you have written. The results you get from them are usually misleading in the extreme if treated as indicator of performance in a production setting. (If you provide me with a JAR or a .class file with your Scala code, I will be happy to measure that variant on JMH, too.)
type: Answer
has comment: http://stackoverflow.com/comment/43280844
score: 3
answers question: http://stackoverflow.com/q/27407170
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27407170
has comment: http://stackoverflow.com/comment/43272130
upvote count: 3
type: AcceptedAnswer

http://stackoverflow.com/a/27460515
accepted answer of: http://stackoverflow.com/q/27460387
answers question: http://stackoverflow.com/q/27460387
score: 0
has body: HashSet is unordered by design. You are putting only limited small numbers which produce hash code of the value in same order. That's why it is printing in order. See the code below to see hash code and analyze it for (Integer num : nums){ System.out.println(num + " - hashcode = " +num.hashCode()); } Add few more large numbers to see unordered nature in action. Example: nums.add(29000); nums.add(199201);
type: Answer
type: AcceptedAnswer

http://stackoverflow.com/a/27479820
downvote count: 0
score: 4
answers question: http://stackoverflow.com/q/27359112
type: Answer
has body: 2 options in terms of pattern usage, but in essence they are pretty similar. In either cases, cyclic dependencies situation need to be handled as a error in task dependency configuration. e.g. A -> B -> A Mediator pattern After each task[i] finishes, it will notify the Mediator, the the Mediator will notify all successor tasks of task[i]. The graph of task dependencies will be read when the execution engine starts as the data structure for Mediator to use. Publish/Subscribe pattern via message bus. The graph of task dependencies will be read as the engine starts, and each task will subscribe to MessageBus of its predecessor task's (task[i]) message of completion on topic[i] When each task[i] finishes, it will send completion message to the MessageBus in topic[i]. Each task who subscribes to topic[i] will get notified and starts to work.
upvote count: 4

http://stackoverflow.com/comment/43182305
type: QuestionComment
score: 2
has text: Do you use Google Play Services?
comment on: http://stackoverflow.com/q/27365212
type: Comment

http://stackoverflow.com/comment/43148416
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27346418
has text: OP did *not* ask for complete solutions. He asked for tips and maybe a *walkthrough*. Big difference!

http://stackoverflow.com/q/27391319
has body: Ok, so i have a project to do, and I need some help with it. I can only use the While statements, (not for) and I need to create a box of asterisks, and so a user can input the width and the length of the box, how do I make the box? cause I got the top and bottom line done, but I do not know how to do the middle lines so theres a * on both sides and spaces in the middle of it. Here is what I have so far, be in mind this is only my 4th month coding in Java. import java.util.Scanner; public class Client { private static int width, length = 0; //Program 2 public static void input(){ Scanner console = new Scanner(System.in); System.out.print("What is the width? "); width = console.nextInt(); System.out.print("What is the length? "); length = console.nextInt(); } public static void topBottom(int width){ while(width &gt;= 1){ System.out.print("x"); width--; } } public static void length(int length){ //this is mainly where i need help int num = length - 2; //num is for the spaces in between the two * in the middle while(length &gt;= 3){ //I have no idea how to create the box effect System.out.println("x"); while(num &gt;= 0){ System.out.print(" "); num--; } length--; } } public static void main(String[] args) { input(); topBottom(width); System.out.println(""); length(length); topBottom(width); } }
type: AnsweredQuestion
upvote count: 0
possible better answer: http://stackoverflow.com/a/27391487
tagged with: java
has answer: http://stackoverflow.com/a/27391487
tagged with: loops
type: Question
answer count: 2
score: -2
has title: How to make a box using only the While loop?
downvote count: 2
tagged with: while-loop
has answer: http://stackoverflow.com/a/27391435
accepted answer: http://stackoverflow.com/a/27391435
favorite count: 0

http://stackoverflow.com/q/27452749
tagged with: jpa-2.1
downvote count: 0
possible better answer: http://stackoverflow.com/a/27452808
has title: What causes "java.lang.IllegalArgumentException: Can not set java.lang.Integer field"
has body: I cannot resolve these new exceptions Can not set java.lang.Integer field GcmRegistraionIdentity.gcmId to GcmRegistraionIdentity org.hibernate.PropertyAccessException: could not get a field value by reflection getter of GcmRegistraionIdentity.gcmId My Dynamic Web Project (Jee7) targeted to GlassFish Server Open Source Edition 4.1 (build 13) Hibernate Hibernate Core {4.3.7.Final} My Persistence.xml org.hibernate.jpa.HibernatePersistenceProvider jdbc/testDB <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.SunOneJtaPlatform" /> <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" /> <property name="hibernate.show_sql" value="true" /> Heres my EDITED entity class (partial: e.g Getters/Setters NOT SHOWN) @Entity @Table(name = "gcm_registration") public class GcmRegistraionIdentity { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "gcm_id", unique = true, nullable = false, insertable = false, updatable = false) private Integer gcmId; @Column(name = "registration_id") private String registraionId = null; @Column(name = "created") @Temporal(TemporalType.TIMESTAMP) private Date created; public Integer getGcmId() { return gcmId; } public void setGcmId(final Integer gcmId) { this.gcmId = gcmId; } Mysql version is Version 5.6.22 MySQL Community Server (GPL) I am running on Mac OS X 10.10.1 (14B25) (Yosemite) Heres my JAX-RS class @Path("registrations") @Stateless public class RegistrationResource { @PersistenceContext private EntityManager mEntityManager; @POST @Path("gcm") public void register(final RegistrationIdJson registrationId) { final GcmRegistraionIdentity gcmRegistraionIdentity = new GcmRegistraionIdentity(); gcmRegistraionIdentity.setRegistraionId(registrationId.getRegistrationId()); mEntityManager.persist(gcmRegistraionIdentity); } } Heres the DDL for my MySql table CREATE TABLE `gcm_registration` ( `gcm_id` int(11) NOT NULL AUTO_INCREMENT, `registration_id` …
favorite count: 0
accepted answer: http://stackoverflow.com/a/27453881
tagged with: glassfish-4
has answer: http://stackoverflow.com/a/27452808
upvote count: 1
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27453881
score: 1
tagged with: java
tagged with: hibernate
tagged with: mysql
type: Question
answer count: 2

http://stackoverflow.com/q/27452966
favorite count: 0
has answer: http://stackoverflow.com/a/27453028
has answer: http://stackoverflow.com/a/27453047
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27453000
has title: How to add a 1/100 chance using random
has comment: http://stackoverflow.com/comment/43344392
has comment: http://stackoverflow.com/comment/43344406
answer count: 4
tagged with: java
has comment: http://stackoverflow.com/comment/43344342
type: Question
has answer: http://stackoverflow.com/a/27453090
score: 0
has comment: http://stackoverflow.com/comment/43344399
tagged with: random
upvote count: 1
downvote count: 1
has body: I'm trying to make it so my game has a 1/100 chance to critical hit. I'm not sure how exactly to do this. I'm pretty sure this doesn't work: criticalChance = crit.nextInt(1)/100; How can I make this work?

http://stackoverflow.com/comment/43116555
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27328993
has text: Is it possible if I remove the last two days. After saturday it will go back at sunday?

http://stackoverflow.com/q/27449562
upvote count: 5
has answer: http://stackoverflow.com/a/27450124
accepted answer: http://stackoverflow.com/a/27450124
has comment: http://stackoverflow.com/comment/43338000
downvote count: 0
tagged with: maven
type: AnsweredQuestion
has title: Gradle project version outside build.gradle at runtime
tagged with: java
tagged with: gradle
type: Question
score: 5
has body: I would like to obtain a Gradle project version in my Java code. In Maven, it can be done this way: version.properties: version=${project.version} which resolves to: version=1.0-SNAPSHOT in jar/war if we add this to pom.xml: src/main/resources true Is there any convenient way to achieve similar result in Gradle? Or should I manually write a task that produces a property file with the project version and then read it in my code?
answer count: 1
favorite count: 0

http://stackoverflow.com/q/27358261
tagged with: java
tagged with: swing
type: Question
accepted answer: http://stackoverflow.com/a/27359181
linked to: http://stackoverflow.com/q/8674474
has body: WindowConstants is defined as this: public interface WindowConstants { public static final int DO_NOTHING_ON_CLOSE = 0; public static final int HIDE_ON_CLOSE = 1; public static final int DISPOSE_ON_CLOSE = 2; public static final int EXIT_ON_CLOSE = 3; } JFrame is defined as this: public class JFrame extends Frame implements WindowConstants, Accessible, RootPaneContainer, TransferHandler.HasGetTransferHandler { /** * The exit application default window close operation. If a window * has this set as the close operation and is closed in an applet, * a SecurityException may be thrown. * It is recommended you only use this in an application. * * @since 1.3 */ public static final int EXIT_ON_CLOSE = 3; Why the EXIT_ON_CLOSE is redefined? And since it is final in the WindowConstants interface, how could it be redefined?
has comment: http://stackoverflow.com/comment/43168848
score: 4
upvote count: 4
answer count: 1
downvote count: 0
favorite count: 0
tagged with: windowlistener
has comment: http://stackoverflow.com/comment/43169173
has comment: http://stackoverflow.com/comment/43168782
tagged with: jframe
has comment: http://stackoverflow.com/comment/43168865
has title: Why JFrame redefine the "EXIT_ON_CLOSE" which it inherits from interface "WindowConstants"?
has comment: http://stackoverflow.com/comment/43169080
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43168911
has answer: http://stackoverflow.com/a/27359181

http://stackoverflow.com/a/27410029
has body: If you receive this error, you forgot to include the .java suffix when compiling the program.
upvote count: 3
type: Answer
answers question: http://stackoverflow.com/q/27409989
downvote count: 0
score: 3

http://stackoverflow.com/q/27359184
has title: Can't add (int, double) pair to HashMap<Integer, Double>
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43170511
score: 5
upvote count: 5
downvote count: 0
has body: I'm working on a Java project right now, and I have a class I've created called DistanceQueue. It's signature is given by public class DistanceQueue&lt;Integer&gt; extends PriorityQueue&lt;Integer&gt; In this class, there is a method public boolean add(int v) which adds the key-value pair (v, Double.MAX_VALUE) to a HashMap called distances that is in the class DistanceQueue. However, inside of add(int v), when I type distances.put(v, Double.MAX_VALUE); I get the following error: DistanceQueue.java:98: error: no suitable method found for put(int,double) distances.put(v, Double.MAX_VALUE); ^ method HashMap.put(Integer,Double) is not applicable (actual argument int cannot be converted to Integer by method invocation conversion) where Integer is a type-variable: Integer extends Object declared in class ShortestPaths.DistanceQueue 1 error Does anyone know why I am getting this error? I thought Java automatically converted between int and Integer for you. Is there an easy way that I can fix it? Thanks!
has answer: http://stackoverflow.com/a/27359239
tagged with: types
answer count: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43170785
has comment: http://stackoverflow.com/comment/43170468
accepted answer: http://stackoverflow.com/a/27359239
type: AnsweredQuestion

http://stackoverflow.com/comment/43300122
score: 0
has text: of course it works as suggested. thanks. the problem was on a different part of my code. sorry
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27416065

http://stackoverflow.com/a/27367437
has comment: http://stackoverflow.com/comment/43187918
has comment: http://stackoverflow.com/comment/43188023
has comment: http://stackoverflow.com/comment/43187249
has comment: http://stackoverflow.com/comment/43188093
has comment: http://stackoverflow.com/comment/43187060
has comment: http://stackoverflow.com/comment/43213036
downvote count: 0
score: 1
type: Answer
has comment: http://stackoverflow.com/comment/43187186
has body: It seems like you have a problem with the firstResponse.readEntity(String.class) call. Otherwise you wouldn't have [null, null] as output. So the problem came from here first. Try to have that working. Then if you don't specify a SerializedName rule on your class' fields, GSON requires that the name must match exactly the key's name in your JSON file. You have "Transaction-Id" on the JSON side but you defined it as Transaction_Id in your Java file, same for Challenge_Response. Since in Java an identifier can't have a -, you need to specify a rule for those two attributes. class round1Body { String User; @SerializedName("Transaction-Id") String Transaction_Id; @SerializedName("Challenge-Response") String Challenge_Response; String Challenge; //... } With these changes, it successfully print (I'm reading your JSON string from a file): [User = 538000001 Transaction-Id = oHbgP2y2OXfdDcxAOI/q9HxY68PNs+xS+8CvfGpoN2ZUU/8mavBaI0564VeZXYBDMnk84kkfZeCJM51I92rFdf4Zi4uKEoqJd7jr78bXo4MOyoSs5mntIir7aVJ9/b+4nz6x2+g0LPY7+Sq8RHvbr+c4Evhg+VXeKDzE3f6+bJo=,YWFhd3MxLnJlYWxtMTsxNDE4MDczNTk0MjkxOzUyQDUzODAwMDAwMQ== Challenge-Response = 7ZGlkpVfYvQDjvTa2EShZwZ3dGc=Challenge = MzcrMzM3NzA4MTM3KzE0MTgwNzM1OTQ=, User = 538000000 Transaction-Id = +5Oi4NnG9HOVMPx4nM/TP4ZBONG4HtOBbA5+uf/d+hik7o1Aes9H0PLCqAgG/Td2xLDPOdZJJW7ppj3MLkZBvJr+t9JWKdSGpGHAYTp0oonRTVsesPVCtNI6dXvMY9P+bHDiBWkZiqjSjOZuuzImLaJ17G1/D/GNqIonaNCjqjo=,YWFhd3MxLnJlYWxtMTsxNDE4MDczNTk0Mjk1OzUzQDUzODAwMDAwMA== Challenge-Response = eEzLzYLmzo5R2tNwokG0mfbuLZY=Challenge = MzgrNDY2NjY4NjgyKzE0MTgwNzM1OTQ=] Note that you could use this annotation to respect naming conventions.
has comment: http://stackoverflow.com/comment/43213184
has comment: http://stackoverflow.com/comment/43187938
upvote count: 1
answers question: http://stackoverflow.com/q/27367352

http://stackoverflow.com/q/27342044
answer count: 1
has answer: http://stackoverflow.com/a/27345108
tagged with: bytecode
tagged with: java
tagged with: agent
type: UnansweredQuestion
has title: ASM bytecode manipulation: Measuring method execution speed
score: 2
downvote count: 0
has body: I am pretty new to ASM and bytecode manipulation. My task is fairly simple: I tell my agent what class and method to visit and it measures the execution time of that method. The measurment is done with Guava library's Stopwatch class. ASM basically surrounds the method body by starting the Stopwatch at the beginning and stopping it at the end of the method body and printing out the execution time. This has worked on some methods, but has failed on most of them. This is the part where ASM visits the beginning of the target method. package com.agent.agentclasses; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; import org.objectweb.asm.commons.LocalVariablesSorter; import org.objectweb.asm.Type; public class ModifierMethodWriter extends LocalVariablesSorter /*MethodVisitor*/ { private int time; protected ModifierMethodWriter(int api, int access, String desc, MethodVisitor mv) { super(api, access, desc, mv); } @Override public void visitCode() { System.out.println("I am @ModifierMethodWriter!"); /* * Guava - beginning of the method ! */ time = newLocal(Type.getObjectType("stopwatch")); super.visitMethodInsn(Opcodes.INVOKESTATIC, "com/google/common/base/Stopwatch", "createStarted", "()Lcom/google/common/base/Stopwatch;", false); super.visitVarInsn(Opcodes.ASTORE, time); super.visitCode(); } Adding code to the end ! package com.agent.agentclasses; import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; import org.objectweb.asm.commons.AdviceAdapter; public class AddCodeBeforeReturn extends AdviceAdapter { public AddCodeBeforeReturn(int api, MethodVisitor mv, int acc, String name, String desc){ super(api, mv, acc, name, desc); } @Override protected void onMethodExit(int opcode) { /* * Guava - Before return ! */ super.visitFieldInsn(Opcodes.GETSTATIC, "java/lang/System", "out", "Ljava/io/PrintStream;"); super.visitIntInsn(Opcodes.ALOAD, 2); super.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "com/google/common/base/Stopwatch", "stop", "(…
favorite count: 0
type: Question
tagged with: java-bytecode-asm
upvote count: 2

http://stackoverflow.com/a/27463886
score: 0
has comment: http://stackoverflow.com/comment/43364353
has body: int count = 0; for (int i = 0; i &lt; 6; i++) for (int j = 0; j &lt; 6; j++) if (array1[i] == yourNumbers[j]) { count++; break; } Assuming the 6 lottery numbers are unique, adding this bit of code after you have taken the input should give you how many numbers match with the lottery numbers in the variable count.
type: Answer
answers question: http://stackoverflow.com/q/27463860

http://stackoverflow.com/comment/43200619
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27375095
has text: You should start your java program with "java -Djava.awt.headless=true <classname>"
score: 0

http://stackoverflow.com/comment/43096393
type: QuestionComment
comment on: http://stackoverflow.com/q/27318070
has text: From the edit it sounds like you aren't preventing browser default form submit and page is reloading
score: 0
type: Comment

http://stackoverflow.com/comment/43243215
comment on: http://stackoverflow.com/q/27398861
score: 3
type: Comment
type: QuestionComment
has text: You need to cast a to Exampleclass

http://stackoverflow.com/q/27331716
has answer: http://stackoverflow.com/a/64330472
accepted answer: http://stackoverflow.com/a/27331765
type: AnsweredQuestion
score: 2
upvote count: 3
tagged with: java
has body: I'm trying to make a program that draws a pyramid in java and i have to type the height the char i want to use, how many spaces from the begin and with how many chars should start I made the pyramid but how to tell the program with how many chars should start(ex Height = 10 and start with 3 chars) My code public void Tr (int height, int begin, int spaces) { for (int i = 0; i &lt; height; i++) { for (int j = 0; j &lt; height - 1 - i; j++){ System.out.print(" "); } for (int k = 0; k &lt; i * 2 + 1; k++){ System.out.print("*"); } System.out.println(); } }
downvote count: 1
type: Question
has title: Pyramid wih chars in Java
has answer: http://stackoverflow.com/a/27331765
answer count: 2
possible better answer: http://stackoverflow.com/a/64330472
favorite count: 0

http://stackoverflow.com/comment/43582140
type: Comment
has text: that was actually a typo on my part, but yes. :)
comment on: http://stackoverflow.com/a/27516472
type: AnswerComment
score: 0

size
type: Tag
tags question: http://stackoverflow.com/q/27443510
tags question: http://stackoverflow.com/q/27414155
tag name: size

http://stackoverflow.com/q/27403960
tagged with: java
accepted answer: http://stackoverflow.com/a/59894796
tagged with: http
type: Question
score: 5
upvote count: 6
possible better answer: http://stackoverflow.com/a/27417155
has comment: http://stackoverflow.com/comment/105920895
tagged with: rest
answer count: 2
has body: Actually, my requirement is, client can call my rest based services in both synchronous (request-response) or in asynchronous (request-acknowledgment-response) mode. Now, based on the request type, I have to follow the mode. Now, my question is, is there any way, from the request itself, by default, is there any indicator, which will tells the clients desire request-response model. Service protocol is http. if not possible, then what will be the best practice, to handle this type of scenario.
downvote count: 1
tagged with: asynchronous
favorite count: 0
has comment: http://stackoverflow.com/comment/105917540
has title: How to identify if a request type is synchronous or asynchronous
has answer: http://stackoverflow.com/a/27417155
tagged with: web-services
has comment: http://stackoverflow.com/comment/43253458
has comment: http://stackoverflow.com/comment/105918207
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/105922816
has answer: http://stackoverflow.com/a/59894796

http://stackoverflow.com/q/27445275
has answer: http://stackoverflow.com/a/27446114
has title: Garbage collection of a fragment in java
score: 2
type: AnsweredQuestion
downvote count: 0
has comment: http://stackoverflow.com/comment/43329442
favorite count: 0
linked to: http://stackoverflow.com/q/10951812
type: Question
upvote count: 2
answer count: 2
tagged with: android
tagged with: fragment
tagged with: garbage
has answer: http://stackoverflow.com/a/27446199
has body: This may be a stupid question but i have little knowledge of garbage collection. When i looked up info about it, it became clear that nullifying an object sets it's reference count to 0 so it becomes eligble for garbage collection So i wanted to test it and I made a fragment,it uses about 5 MB of memory. When i remove the fragment with the transactionmanager, nullify the fragment and explicitly call the garbage collector (GC.collect()),the allocated memory stays the same and i don't get the 5 MB back.. What could be the reason(s) for this? public void Unselect() { var ft = this.SupportFragmentManager.BeginTransaction (); switch (selected) { case 8:... case 9: //FindViewById (Resource.Id.fragment_container).SetBackgroundDrawable (null); ft.Hide (carFragment); ft.Remove (carFragment); Console.WriteLine ("NULLIFY"); carFragment = null; break; case 10:... } ft.Commit (); The carFragment is a fragment that has a Google Maps V2 supportfragment in it
tagged with: java
has comment: http://stackoverflow.com/comment/43330475
accepted answer: http://stackoverflow.com/a/27446199
tagged with: collections
has comment: http://stackoverflow.com/comment/43329461
possible better answer: http://stackoverflow.com/a/27446114

http://stackoverflow.com/a/27447189
accepted answer of: http://stackoverflow.com/q/27434617
answers question: http://stackoverflow.com/q/27434617
score: 0
type: AcceptedAnswer
has body: Alright, no worries i'm going to answer my own question, i've found the solution. I'm still not quite sure as to why Gradle wasn't packaging the .geodatabase file in the package, but the solution was putting the file on the PHYSICAL device and then in the code referencing it from there, where I knew that it was, as so: try { geodatabase = new Geodatabase("/sdcard/Geodatabase/basemap.geodatabase"); } catch (FileNotFoundException e) { Log.e("ERROR", "File Not found"); e.printStackTrace(); } So I put the file on my tablet in that place in the file hierarchy(/sdcard/Geodatabase/basemap.geodatabase") and the program found it there.
type: Answer

http://stackoverflow.com/comment/43317283
has text: There is any exception for that. Because you need to put in out of src folder under Java Project
comment on: http://stackoverflow.com/a/27438606
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27341127
tagged with: groovy
accepted answer: http://stackoverflow.com/a/27341433
answer count: 1
downvote count: 0
has title: Why doesn't gradle return dependencies for another projects?
favorite count: 0
has body: I have the following build script (webapp:build.gradle): apply plugin: 'java' dependencies { project(':api') } When I run gradle dependencies webapp:dependencies in command line I get: :dependencies ------------------------------------------------------------ Root project ------------------------------------------------------------ No configurations :webapp:dependencies ------------------------------------------------------------ Project :webapp ------------------------------------------------------------ archives - Configuration for archive artifacts. No dependencies compile - Compile classpath for source set 'main'. No dependencies default - Configuration for default artifacts. No dependencies runtime - Runtime classpath for source set 'main'. No dependencies testCompile - Compile classpath for source set 'test'. No dependencies testRuntime - Runtime classpath for source set 'test'. No dependencies There was nothing to be said about dependency from api project. Why? What's wrong?
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/27341433
tagged with: gradle
type: Question

http://stackoverflow.com/comment/43330785
comment on: http://stackoverflow.com/q/27401437
type: Comment
type: QuestionComment
score: 1
has text: Because that's what `\\b` means.

http://stackoverflow.com/comment/43273887
comment on: http://stackoverflow.com/q/27414933
score: 2
has text: I see several separate questions here.
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27364139
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27364806
tagged with: spring
tagged with: java
type: Question
tagged with: encoding
has body: I am using @Valid annotation and the when error mesage has special characters they are always being displayed incorrectly. public class Test { @NotEmpty(message = "{test}") private String test; //omitted getter and setter } ValidationMessages.properties: test=Número Error Handling: private void handleBindException(final Exception ex, final Result res) { BindException bex = (BindException) ex; for (ObjectError error : bex.getAllErrors()) { res.addError(new ErrorCode(error.getCode(), error.getDefaultMessage())); } } Spring MessageResouce: public ReloadableResourceBundleMessageSource messageSource() { ReloadableResourceBundleMessageSource ms = new ReloadableResourceBundleMessageSource(); ms.setBasename("classpath:ValidationMessages"); ms.setUseCodeAsDefaultMessage(true); ms.setDefaultEncoding("UTF-8"); ms.setCacheSeconds(0); return ms; } Final result: NÃºmero Can anybody help me with this issue please?
score: 0
has title: Spring ObjectError getDefaultMessage() encoding
answer count: 1

http://stackoverflow.com/a/27405843
score: 0
upvote count: 1
downvote count: 1
answers question: http://stackoverflow.com/q/27387365
type: Answer
has comment: http://stackoverflow.com/comment/43256354
has body: Is the file at the top of the classpath, i.e. in WEB-INF/classes? The API doc for Classloader.getResource() says the resource name is: "The name of a resource is a '/'-separated path name that identifies the resource." So if your file is in some subdirectory, that path should be part of the resource name.

http://stackoverflow.com/comment/43150733
has text: Is there a way to do it without creating the student object?
type: Comment
comment on: http://stackoverflow.com/a/27347833
score: 0
type: AnswerComment

http://stackoverflow.com/q/27323100
score: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43105577
type: Question
has body: Hello guys I am new to android programming. I want to create a puzzle game in which user will sort the html unsorted tags by dragging them on the screen. I am using a listview control to store the unsorted html tags. I have implemented the following library: https://github.com/terlici/DragNDropList Now I am trying to get the position or index of the list item after user drop the list item so I can compare the user sorted list items to the actual sorted items. Here is my code Main.java PuzzleManager pm = new PuzzleManager(this); pm.insertPuzzle(" , , , , , ", " , , , , , "); Cursor cursor = pm.getPuzzle(1); pm.close(); String s = cursor.getString(1); List<String> puzzleList = Arrays.asList(s.split(",")); ArrayList<Map<String, Object>> items = new ArrayList<Map<String, Object>>(); for(int i = 0; i < puzzleList.size(); ++i) { HashMap<String, Object> item = new HashMap<String, Object>(); item.put("puzzle", puzzleList.get(i)); items.add(item); } DragNDropListView list = (DragNDropListView)findViewById(android.R.id.list); DragNDropSimpleAdapter adaptor = new DragNDropSimpleAdapter(this, items, R.layout.row, new String[]{"puzzle"}, new int[]{R.id.text}, R.id.handler); list.setDragNDropAdapter(adaptor); Main.xml <com.terlici.dragndroplist.DragNDropListView android:id="@id/android:list" android:layout_width="match_parent" android:layout_height="match_parent" /> row.xml <?xml version="1.0" encoding="utf-8"?> <ImageView android:id="@+id/handler" android:layout_width="60px" android:layout_height="60px" android:src="@android:drawable/btn_star_big_on" android:layout_marginLeft="8px" /> <TextView android:id="@+id/text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Large Text" android:textAppearance="?android:attr/textAppearanceLarge" /> Thanks in advance
has answer: http://stackoverflow.com/a/27334552
tagged with: listview
answer count: 1
accepted answer: http://stackoverflow.com/a/27334552
tagged with: drag-and-drop
has title: how to get index or position of listview control
tagged with: android
tagged with: draggable
type: AnsweredQuestion

http://stackoverflow.com/q/27466038
has answer: http://stackoverflow.com/a/27466112
tagged with: java
linked to: http://stackoverflow.com/q/363681
type: Question
has comment: http://stackoverflow.com/comment/43368705
has comment: http://stackoverflow.com/comment/43368098
has comment: http://stackoverflow.com/comment/43368275
tagged with: jcreator
has comment: http://stackoverflow.com/comment/43368106
has title: A set of random values in an int array of a user specified size
has comment: http://stackoverflow.com/comment/43368151
downvote count: 4
has comment: http://stackoverflow.com/comment/43368184
has comment: http://stackoverflow.com/comment/43368284
upvote count: 0
has comment: http://stackoverflow.com/comment/43368082
answer count: 1
has comment: http://stackoverflow.com/comment/43368118
favorite count: 0
type: UnansweredQuestion
score: -4
has comment: http://stackoverflow.com/comment/43368159
has body: Write a method to generate and return a set of random values in an int array of a user specified size. The values should all be between +/- N, where N is a constant such as 100. Thank you. Here's Mine; import java.util.*; public class Test { public static void main(String[] args) { int limit, numbers; Random random = new Random(); Scanner scan = new Scanner(System.in); System.out.print ("Enter your limit value for your array: "); //Needs to be positive. limit = scan.nextInt(); int[] list = new int[limit]; for (int i = 0; i &lt; list.length; i++) { System.out.print(list[i] + ", "); } numbers = random.nextInt(limit - (0 - limit)) + (0 - limit); System.out.println (numbers); System.out.println (list[numbers]); } }

http://stackoverflow.com/comment/43147892
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27346430
has text: also you didn't write the code inside a method.
score: 0

http://stackoverflow.com/a/27350116
answers question: http://stackoverflow.com/q/27350072
downvote count: 0
type: Answer
score: 1
upvote count: 1
has body: Try this; public boolean hovering(float x, float y) { if((x &gt; this.x) &amp;&amp; (x &lt; this.x + this.width)) { if((y &gt; this.y) &amp;&amp; (y &lt; this.y + this.height)) { return true; } } return false; }

http://stackoverflow.com/comment/43319650
comment on: http://stackoverflow.com/a/27439354
has text: I am not asking programmatically. To exit from Screen Pinning, the Back button and recents button both should be pressed at same time. How can you press both of them with mouse at same time?
type: AnswerComment
type: Comment
score: 2

http://stackoverflow.com/comment/43497035
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27389860
has text: I don't have any specific issues in mind, but I would recommend getting up to the latest 2.1 release before getting too deep on this.
score: 0

http://stackoverflow.com/comment/43382294
comment on: http://stackoverflow.com/a/27473449
type: Comment
has text: If you put the correct path and it isn't really working (I'm unable to test it right now) you should use @Sas solution.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/52080911
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/31447763
has text: I had an issue in one of my layout files which crashed the gradle process. Thanks to this tip I could find it in no time and gradle finished.

http://stackoverflow.com/a/27378944
has comment: http://stackoverflow.com/comment/43207234
has comment: http://stackoverflow.com/comment/43208861
has comment: http://stackoverflow.com/comment/43207395
accepted answer of: http://stackoverflow.com/q/27378818
type: Answer
upvote count: 3
has body: This is because calls of get normalize the Calendar in lenient mode, and validate it in strict mode: returns the value of the given calendar field. In lenient mode, all calendar fields are normalized. In non-lenient mode, all calendar fields are validated and this method throws an exception if any calendar fields have out-of-range values. The normalization and validation are handled by the complete() method, which process is calendar system dependent. It looks like your Calendar object is in lenient mode, hence the normalization is performed. Normalization is dependent on the calendar instance.
score: 3
has comment: http://stackoverflow.com/comment/43207630
answers question: http://stackoverflow.com/q/27378818
has comment: http://stackoverflow.com/comment/43207443
has comment: http://stackoverflow.com/comment/43207369
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27392035
type: Answer
answers question: http://stackoverflow.com/q/27391055
downvote count: 0
score: 2
has body: You can use the @BeforeClass and @AfterClass IN THE SUITE CLASS. This will run the methods before any of the test classes in the suite execute and after all the test classes finish (respectively) This way you can run them only once. //..usual @RunWith etc annotations here public class MySuite{ @BeforeClass public static void setup(){ } @AfterClass public static void tearDown(){ } }
upvote count: 2
has comment: http://stackoverflow.com/comment/43271656

http://stackoverflow.com/comment/43310725
type: QuestionComment
has text: use f_name.split("\\."). It takes a `regex` as input. It fails since `.` is a special character.
comment on: http://stackoverflow.com/q/27434893
score: 1
type: Comment

http://stackoverflow.com/a/27330125
accepted answer of: http://stackoverflow.com/q/27330066
has body: make this change: for(int c=1;c&lt;Number;c++){ for(int b=1;b&lt;c;b++){ for(int a=1;a&lt;b;a++){ if(a*a + b*b == c*c ) but be aware that the are even more efficient methods such as Euclid's formula
score: 0
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27330066
type: Answer

http://stackoverflow.com/q/27473359
has answer: http://stackoverflow.com/a/27473670
has comment: http://stackoverflow.com/comment/43381561
type: AnsweredQuestion
tagged with: java
has title: Snake game moving issue [JAVA]
downvote count: 1
has answer: http://stackoverflow.com/a/27473694
type: Question
has body: I'm trying to write a Snake game in Java, as a start I figured out how to get the snake (I have only implemented its head for the moment) move right. My problem is that I can't get it to move down (the snake should continue going down even if the key is released) when the "down" key is pressed. Any ideas? Main code: import javax.swing.JFrame; public class Main { public static void main(String[] args) throws InterruptedException { JFrame frame = new JFrame(); frame.setVisible(true); frame.setSize(500, 500); frame.setResizable(false); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); Window window = new Window(); frame.add(window); while(true) { window.move(); Thread.sleep(10); } } } Window code: import java.awt.Graphics; import javax.swing.JPanel; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; public class Window extends JPanel { public Snake snake = new Snake(this); public Window() { this.setLayout(null); setFocusable(true); } public void paint(Graphics g2d) { super.paint(g2d); snake.paint(g2d); } public void move() { snake.moveRight(); this.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent event) { if(event.getKeyCode() == KeyEvent.VK_DOWN) { snake.setDx(0); } } public void keyReleased(KeyEvent event) { if(event.getKeyCode() == KeyEvent.VK_DOWN) { snake.moveDown(); } } public void keyTyped(KeyEvent event) { } }); this.repaint(); } } Snake code: import java.awt.Graphics; public class Snake { Window window; private int positionX = 0; private int positionY = 0; private int dx = 1; private int dy = 1; public Snake(Window window) { this.window = window; } public void paint(Graphics g2d) { g2d.fillRect(positionX, positionY, 20, 20); } public int getPositionX() { return positionX; } public void setPositionX(int positionX) { this.positionX = positionX; } public int getPositionY() { return positionY; } public void setPositionY(int positionY) { this.positionY = positionY; } public int getD…
score: -1
has answer: http://stackoverflow.com/a/27473490
answer count: 3
accepted answer: http://stackoverflow.com/a/27473670
upvote count: 0
has comment: http://stackoverflow.com/comment/43381282
favorite count: 0
has comment: http://stackoverflow.com/comment/43381322
possible better answer: http://stackoverflow.com/a/27473694
has comment: http://stackoverflow.com/comment/43381602

http://stackoverflow.com/q/27465568
score: 0
answer count: 1
tagged with: hibernate-envers
tagged with: java
tagged with: hibernate
accepted answer: http://stackoverflow.com/a/27479641
type: AnsweredQuestion
has title: Hibernate envers - fetch latest data for non-audited and historical data for audited fields
has body: I would like to know if there is a easy/standard way to query oneToMany relationship where owning entity/parent is not audited but the child is audited Person -&lt; Address public class Person { @Id int id; @Column(name = "name") String name; @Audited @OneToMany(mappedBy = "person", orphanRemoval = true, cascade = { CascadeType.ALL }) private List&lt;Address&gt; addresses = new ArrayList&lt;&gt;(); } @Audited public class Address { @Id int id; @Column(name = "country") String country; @Column(name = "city") String city; @ManyToOne @JoinColumn(name = "person_id") private Person person; } So how can I query the list of address and person at a revision with all fields populated (audited &amp; non-audited) E.g. On the above data model, if I do a auditReader.createQuery(). forEntitiesAtRevision(Person.class, 2).getResultList().get(0); I am expecting the below result Person 1 -&gt; 5, "Bob", [{1, "USA", "Seattle"},{2,"USA","Austin"}] But instead its returning Person 1 -&gt; 5, null , [{1, "USA", "Seattle"},{2,"USA","Austin"}]
type: Question
has answer: http://stackoverflow.com/a/27479641

http://stackoverflow.com/q/27354900
type: AnsweredQuestion
upvote count: 2
tagged with: java
downvote count: 2
has comment: http://stackoverflow.com/comment/43164561
type: Question
has comment: http://stackoverflow.com/comment/43164408
tagged with: enums
tagged with: arrays
has answer: http://stackoverflow.com/a/27355522
has comment: http://stackoverflow.com/comment/43163858
has comment: http://stackoverflow.com/comment/43164819
has comment: http://stackoverflow.com/comment/43163395
has body: I want to assign an array of bytes value to an enum variable. I'm able to assign one byte to a variable but unable to assign a whole byte array. How can I do that? (I hope my question is not absurd.) public enum abc { a (new byte[] {0x11,0x22}, b ((byte)0x17); byte value; byte[] val=new byte[2]; private abc(byte[] val) { this.val=val; } private abc(byte value) { this.value=value; } } now if i want to print abc.a...it is showing me 0 instead of 11 22.And i want to print the whole sequence as 11 22 17 by storing all values in an array.How can i do it?(is my question clear now?)
score: 0
has comment: http://stackoverflow.com/comment/43164132
answer count: 1
has comment: http://stackoverflow.com/comment/43164621
has comment: http://stackoverflow.com/comment/43164569
favorite count: 0
tagged with: assign
has title: How can I assign a byte array to an enum variable and print it?
accepted answer: http://stackoverflow.com/a/27355522
tagged with: byte
has comment: http://stackoverflow.com/comment/43164501
has comment: http://stackoverflow.com/comment/43164495

http://stackoverflow.com/comment/43109723
score: 0
has text: And I didn't knew before this before :O List of Threads. Interesting !
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27325248

http://stackoverflow.com/q/27327182
has body: Consider the following code: class Predicate { public boolean eval(EvaluationContext ec) { /* logic here */ } } // later ... List&lt;Predicate&gt; preds = new List&lt;&gt;( /* some predicates here */ ); // now let's use Stream&lt;&gt; to implement the AND logical connective: // VERSION A: Boolean resultA = preds.stream() .map(p -&gt; p.eval(context)) .reduce(Boolean.TRUE, (a,b) -&gt; Boolean.logicalAnd(a,b)); // Oops: the code above doesn't compile ... // Error: incompatible types: java.lang.Object cannot be converted to boolean // VERSION B: (add an intermediate variable with explicit type) Stream&lt;Boolean&gt; v = _children.stream().map(p -&gt; p.eval(context)); Boolean resultB = v.reduce(Boolean.TRUE, (a,b) -&gt; Boolean.logicalAnd(a, b) ); // compiles just fine... So, my question is: What is wrong with the structure of Version A that prevents the Java compiler from correctly inferring the type of the result of map()? Is this a limitation of the type-inference algorithm in Java? If so, is there a better way to write this code so that the type inference succeeds?
has comment: http://stackoverflow.com/comment/43228110
tagged with: type-inference
tagged with: java-8
has comment: http://stackoverflow.com/comment/43113360
tagged with: java
has comment: http://stackoverflow.com/comment/43113794
has title: Java 8 type inference involving Booleans
type: Question
has answer: http://stackoverflow.com/a/27356933
has comment: http://stackoverflow.com/comment/43113374
has answer: http://stackoverflow.com/a/27372486
has comment: http://stackoverflow.com/comment/43113456
score: 0
answer count: 2
tagged with: generics
tagged with: compiler-errors
has comment: http://stackoverflow.com/comment/43119667
type: UnansweredQuestion

http://stackoverflow.com/a/45119852
type: Answer
upvote count: 2
has body: Give list::add as callback When the task is to test a callback that is a functional interface accepting one parameter (here a boolean, could as well be String or any random type), it seems most concise to prepare a list, pass the List.add(e) method as callback and then check the content of the list: List&lt;Boolean&gt; callbackArgs = new ArrayList&lt;&gt;(); methodUnderTest(callbackArgs::add); // assert that the callback was called exactly once and with a "true" value: assertEquals(Arrays.asList(true), callbackArgs); Alternative case for a callback that accepts Strings: List&lt;String&gt; callbackArgs = new ArrayList&lt;&gt;(); methodUnderTest(callbackArgs::add); // assert that the callback was called twice with "foo" and "bar" values respectively: assertEquals(Arrays.asList("foo", "bar"), callbackArgs); Analogously, a counter class may serve for testing a callback that accepts no parameter. Here using AtomicInteger, as that seems to be the only counter-like class available in the standard libs - the atomicity property is not needed here: AtomicInteger callbackCounter = new AtomicInteger(); methodUnderTest(callbackCounter::incrementAndGet); // assert that the callback was called 5 times: assertEquals(5, callbackCounter.get());
score: 2
downvote count: 0
answers question: http://stackoverflow.com/q/27348625
has comment: http://stackoverflow.com/comment/81662636

http://stackoverflow.com/comment/43339464
type: QuestionComment
score: 2
has text: 1- Don't use KeyListener with txt components, use an ActionListerner instead; 2- Swing is single threaded, meaning that any operation which is long running or blocking will prevent the UI from been updated, so even if you do fix the problem with loop, it won't update until the actionPerformed method exits. Instead you could use a SwingWorker
comment on: http://stackoverflow.com/q/27449596
type: Comment

http://stackoverflow.com/q/27440369
downvote count: 0
tagged with: elasticsearch
favorite count: 0
has body: I use ElasticSearchTemplate().queryForPage(SearchQuery, CLASS) How can I print the full json request? I manage to print only filter by doing : searchQuery.getFilter().toString() But cant manage to do the same with: searchQuery.getAggregations().toString(); I would like to print in console something like : "aggs": { "agg1": { "terms": { "field": "basket_id_1", "size": 0 }, "aggs": { "basket_id_2": { "terms": { "field": "basket_id_2", "size": 0 }, "aggs": { "basket_id_3": { "terms": { "field": "basket_id_3", "size": 0 } } } } } } }
type: UnansweredQuestion
upvote count: 7
tagged with: spring
has title: How to print the full elasticsearch request for debug in java
has answer: http://stackoverflow.com/a/35933077
score: 7
tagged with: java
has answer: http://stackoverflow.com/a/27592080
type: Question
tagged with: debugging
answer count: 2

http://stackoverflow.com/a/27359373
type: Answer
accepted answer of: http://stackoverflow.com/q/27358698
score: 2
answers question: http://stackoverflow.com/q/27358698
upvote count: 2
has body: You are signing String data = "aa"; in sign method while verifying String data2 = "bb"; so the signature verification will return false. digitally signing the data to check it's integrity (which means no alter to the data). I hope this could help!
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43128264
has text: Thanks all for helping me to understand this. You guys are awesome!
score: 0
comment on: http://stackoverflow.com/q/27328101
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27472893
score: 2
upvote count: 2
has comment: http://stackoverflow.com/comment/43380356
has body: The specific problem you have might be solved in several different ways, what follows is a generic answer. Usually, whenever you have a situation in which the only way out seems to be writing a meta-program (i.e. code to generate code, happens frequently with people who are beginning programming), give recursion a thought. Example Consider the problem of generating all the possible strings of length k that can be created using the set S = {a, b, c, d}. One way of doing it is to write a meta program, which generates another program having k for loops. Something like: for `i1` in S: for `i2` in S: ... for `ik` in S: print i1 + i2 + ... + ik You will then need to compile it and run the executable thus obtained using system() or a similar function. A much cleaner alternative is to use recursion. For eg: //sg public class printKStr { int k; String S; public void printKdigs(int pos, char[] str) { if(pos == k) { System.out.println(str); return; } int l = S.length(); for(int i = 0; i &lt; l; i++) { str[pos] = S.charAt(i); printKdigs(pos + 1, str); } } public static void main(String args[]) { printKStr pk = new printKStr(); pk.S = "abc"; pk.k = 3; char[] temp1 = new char[pk.k + 1]; pk.printKdigs(0, temp1); } } Each activation of printKdigs represents a for loop in some sense. We need a data structure that can hold the state created by each of these activations, in this case, it is the string str. We set values correctly and recurse. Finally, at the termination, the value in the data structures holding the trail of recursive calls (str here) gives you one legal combination.
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27472707

http://stackoverflow.com/q/27473522
type: Question
has title: capturing internal audio java
answer count: 1
score: 0
has answer: http://stackoverflow.com/a/27473859
type: UnansweredQuestion
tagged with: audio
tagged with: capture
has body: i will record the sound from my programs. I use Ubuntu 14.04 and PulseAudio. Now i try to record from pulseaudio but currently i'm only recording from my microphone. How can i record the sound from pulseaudio instead of my microphone? public static void captureAudio() { try { final AudioFormat format = getFormat(); DataLine.Info info = new DataLine.Info(TargetDataLine.class, format); final TargetDataLine line = (TargetDataLine) AudioSystem.getLine(info); line.open(format); line.start(); Runnable runnable = new Runnable() { int bufferSize = (int)format.getSampleRate() * format.getFrameSize(); byte buffer[] = new byte[bufferSize]; public void run() { out = new ByteArrayOutputStream(); running = true; try { while (running) { int count = line.read(buffer, 0, buffer.length); if (count &gt; 0) { out.write(buffer, 0, count); } } out.close(); } catch (IOException ex) { ex.printStackTrace(); } } }; Thread captureThread = new Thread(runnable); captureThread.start(); } catch (LineUnavailableException ex) { ex.printStackTrace(); } } I tried some things to change this in my code: Mixer mixer = AudioSystem.getMixer(null); And then: final TargetDataLine line = (TargetDataLine) mixer.getLine(info); Hope anyone have a solution. Greetings Daniel
tagged with: java

http://stackoverflow.com/q/27391886
has title: Populating a ListView from a Sqlite databse
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27391922
tagged with: cursor
downvote count: 1
type: Question
score: -1
tagged with: listview
upvote count: 0
tagged with: sqlite
answer count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27391922
has body: I have been looking through a lot of tutorials and I still can't seem to find what I am looking for. I need to have the information that is stored in my SQLite Database shown in a ListView. I have the Database created and I know that it has the correct information in it, however when I look at the page with my ListView, nothing is there. The app doesn't crash and there aren't any errors, it's just empty. For reference, the ListView stuff is in the first thing of code and the Cursor for the Database is in the bottom of the second thing of code. Also, please note that I am fairly new to Android and I could be missing something quite simple. Feel free to ask any questions and thanks for any answers! Here are some pieces of my code: public class Main_Screen extends Activity implements OnClickListener { Button Test; Button New; ListView PassEntries; DBHelper myDb; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.screen_main); Test = (Button) findViewById(R.id.buttonTEST); // This button is meant to refresh the ListView New = (Button) findViewById(R.id.button10); // This button takes the user to a new screen where they input the data into the Database PassEntries = (ListView) findViewById(R.id.listView1); openDB(); populatePassEntriesFromDB(); Test.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub populatePassEntriesFromDB(); } }); New.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub myDb.close(); Intent NewPass = new Intent(getApplicationContext(), NewPass.class); startActivity(NewPass); } }); } private void populatePassEntriesFromDB() { // TODO Auto-generated method stub Cursor CR = myDb.getAllRows(); String[] fromFieldNames = new String[] {DBinfo.ACC_NAME}; int[] toViewIDs = new int[] {R.id.nameView}; ListAdapter Adapter = new SimpleCursorAdapter( this, R…
tagged with: android

http://stackoverflow.com/comment/43179113
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27363391
has text: If there is a sort method `void sort( int[] x)` it cannot be used to sort a `String[]`.
score: 1

http://stackoverflow.com/comment/43276329
comment on: http://stackoverflow.com/a/27416028
type: Comment
has text: @SeumasFrew I would say it meets the requirements halfway. Take a look at MadProgrammer's answer, he covers most if not all of what's lacking.
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43202597
has text: What problem you are facing, are you getting any Exception.. etc.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27376364

http://stackoverflow.com/tag/html
tags question: http://stackoverflow.com/q/27409107
tags question: http://stackoverflow.com/q/27318041
tags question: http://stackoverflow.com/q/27347256
tags question: http://stackoverflow.com/q/27433269
tags question: http://stackoverflow.com/q/27454518
tags question: http://stackoverflow.com/q/27432674
tags question: http://stackoverflow.com/q/27330787
tags question: http://stackoverflow.com/q/27437629
tags question: http://stackoverflow.com/q/27418353
tags question: http://stackoverflow.com/q/27391467
tags question: http://stackoverflow.com/q/27450617
tags question: http://stackoverflow.com/q/27418770
tags question: http://stackoverflow.com/q/27462127
tags question: http://stackoverflow.com/q/27374454
tags question: http://stackoverflow.com/q/27325234
tags question: http://stackoverflow.com/q/27421664
tags question: http://stackoverflow.com/q/27344005
tags question: http://stackoverflow.com/q/27343632
tags question: http://stackoverflow.com/q/27351242
tags question: http://stackoverflow.com/q/27397382
tags question: http://stackoverflow.com/q/27320573
tags question: http://stackoverflow.com/q/27445341
type: Tag
tags question: http://stackoverflow.com/q/27377641
tags question: http://stackoverflow.com/q/27411475
tags question: http://stackoverflow.com/q/27335505
tags question: http://stackoverflow.com/q/27375193
tags question: http://stackoverflow.com/q/27363178
tags question: http://stackoverflow.com/q/27345018
tags question: http://stackoverflow.com/q/27448155
tags question: http://stackoverflow.com/q/27346299
tags question: http://stackoverflow.com/q/27441313
tags question: http://stackoverflow.com/q/27392215
tags question: http://stackoverflow.com/q/27426869
tags question: http://stackoverflow.com/q/27390426
tags question: http://stackoverflow.com/q/27329108
tags question: http://stackoverflow.com/q/27422979
tags question: http://stackoverflow.com/q/27434464
tags question: http://stackoverflow.com/q/27372242
tags question: http://stackoverflow.com/q/27467332
tags question: http://stackoverflow.com/q/27447430
tags question: http://stackoverflow.com/q/27471327
tag name: html
tags question: http://stackoverflow.com/q/27394600
tags question: http://stackoverflow.com/q/27373757
tags question: http://stackoverflow.com/q/27332937
tags question: http://stackoverflow.com/q/27468352
tags question: http://stackoverflow.com/q/27422641
tags question: http://stackoverflow.com/q/27322818
tags question: http://stackoverflow.com/q/27365295
tags question: http://stackoverflow.com/q/27373302
tags question: http://stackoverflow.com/q/27331978
tags question: http://stackoverflow.com/q/27359279
tags question: http://stackoverflow.com/q/27384942

http://stackoverflow.com/comment/43139980
comment on: http://stackoverflow.com/q/27342121
type: QuestionComment
type: Comment
has text: @CassyHiggins I tried running your `outputGrades` method and all 10 students were printed.
score: 0

http://stackoverflow.com/q/27454386
has answer: http://stackoverflow.com/a/27454630
has comment: http://stackoverflow.com/comment/43347246
downvote count: 0
has body: Is it possible to check a collision with a line using an Area object? Currently the way I am doing it is not working: This returns false when you run it. But the line is very clearing touching the rectangle, in fact its completely inside it. import java.awt.Rectangle; import java.awt.geom.Area; import java.awt.geom.Line2D; public class collision { public static void main(String[] args) { Area area1 = new Area(new Rectangle(0, 0, 100, 100)); Area area2 = new Area(new Line2D.Double(0, 0, 100, 100)); System.out.println(isColliding(area1, area2)); } public static boolean isColliding(Area area1, Area area2) { if (area2 != null) { Area collide1 = new Area(area1); collide1.subtract(area2); if (!collide1.equals(area1)) { return true; } } return false; } }
possible better answer: http://stackoverflow.com/a/27454630
favorite count: 0
has answer: http://stackoverflow.com/a/27455209
has comment: http://stackoverflow.com/comment/43346871
upvote count: 2
has comment: http://stackoverflow.com/comment/43346938
has comment: http://stackoverflow.com/comment/43348236
score: 2
type: AnsweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43346922
tagged with: collision-detection
accepted answer: http://stackoverflow.com/a/27455209
has title: Checking collisions with a line and a rectangle
has comment: http://stackoverflow.com/comment/43346967
has comment: http://stackoverflow.com/comment/43347404
type: Question
answer count: 2
has comment: http://stackoverflow.com/comment/43347198
has comment: http://stackoverflow.com/comment/43347146

dicom
tag name: dicom
type: Tag
tags question: http://stackoverflow.com/q/27473895

http://stackoverflow.com/a/27376212
score: 1
answers question: http://stackoverflow.com/q/27375608
has comment: http://stackoverflow.com/comment/43202565
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: First of all, avoid using scriptlet in jsp page put this code in a servlet istead. Then I think the javax.json API and specifically javax.json.JsonObject and javax.json.JsonArrayis a simplier solution to manage Json objects, and your code will be: JsonArrayBuilder cellsBuilder=Json.createArrayBuilder(); cellsBuilder.add("x1"); cellsBuilder.add("X2"); cellsBuilder.add("X3"); cellsBuilder.add("X3"); JsonArray cells=cellsBuilder.build(); JsonObject rows =Json.createObjectBuilder() .add("id", "id_val1") .add("cells", cells).build(); JsonObject dataUsers =Json.createObjectBuilder() .add("nume","total") .add("salariu","1000").build(); JsonObject my_data =Json.createObjectBuilder() .add("rows", "rows") .add("dataUser", dataUsers).build();
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27375608

http://stackoverflow.com/q/27451257
accepted answer: http://stackoverflow.com/a/27451310
tagged with: sorting
tagged with: comparator
has answer: http://stackoverflow.com/a/27451310
answer count: 1
favorite count: 0
has body: I Want to sort a List of employee in Java in which Boss name should appear first followed by other employeees in a Alphabetical order. Employee employee1 = new Employee(); Employee employee2 = new Employee(); Employee employee3 = new Employee(); Employee employee4 = new Employee(); employee2.setName("X1"); employee2.setSalary("1000"); employee1.setName("BOSS"); employee1.setSalary("1000"); employee3.setName("A2"); employee3.setSalary("1000"); employee4.setName("X3"); employee4.setSalary("1000"); List&lt;Employee&gt; lists = new ArrayList&lt;Employee&gt;(); lists.add(employee1); lists.add(employee2); lists.add(employee3); lists.add(employee4); After sorting the output should be BOSS A2 X1 X3
score: -4
has comment: http://stackoverflow.com/comment/43341167
downvote count: 4
has comment: http://stackoverflow.com/comment/43341828
type: AnsweredQuestion
upvote count: 0
has comment: http://stackoverflow.com/comment/43341052
has comment: http://stackoverflow.com/comment/43341318
has title: sort list of employees in Java in which Boss name should name appeas first followed by other employees in a alphabetical order
tagged with: java
tagged with: comparable
type: Question

http://stackoverflow.com/a/27371910
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43196295
upvote count: 1
answers question: http://stackoverflow.com/q/27371836
type: Answer
has comment: http://stackoverflow.com/comment/43196447
has body: Load the Reader once (outside the loop), and then you can iterate the keySet. Next, you could display the key and value. Using Format String Synatx that might look something like, try (InputStreamReader is = new InputStreamReader( conn.getInputStream(), "UTF-8")) { Properties prop = new Properties(); prop.load(is); for (Object key : prop.keySet()) { System.out.printf("%s=%s%n", key, prop.get(key)); } } For hard coded keys (your specific case and if you want to ignore other properties), you don't need a loop try (InputStreamReader is = new InputStreamReader( conn.getInputStream(), "UTF-8")) { Properties prop = new Properties(); prop.load(is); String amount = prop.getProperty("ssl_amount"); String card = prop.getProperty("ssl_card_number"); String approval = prop.getProperty("ssl_approval_code"); String results = prop.getProperty("ssl_result_message"); String time = prop.getProperty("ssl_txn_time"); System.out.println(amount + " " + card + " " + approval + " " + results + " " + time + " "); } The above are using try-with-resources to close the stream(s) when done.

database
tags question: http://stackoverflow.com/q/27327762
tags question: http://stackoverflow.com/q/27373189
tags question: http://stackoverflow.com/q/27416473
tags question: http://stackoverflow.com/q/27454844
tags question: http://stackoverflow.com/q/27376192
tags question: http://stackoverflow.com/q/27466361
type: Tag
tags question: http://stackoverflow.com/q/27327060
tags question: http://stackoverflow.com/q/27420797
tags question: http://stackoverflow.com/q/27436793
tags question: http://stackoverflow.com/q/27334613
tags question: http://stackoverflow.com/q/27362112
tags question: http://stackoverflow.com/q/27472985
tags question: http://stackoverflow.com/q/27375272
tag name: database
tags question: http://stackoverflow.com/q/27361404
tags question: http://stackoverflow.com/q/27445045
tags question: http://stackoverflow.com/q/27360970
tags question: http://stackoverflow.com/q/27377802
tags question: http://stackoverflow.com/q/27346332
tags question: http://stackoverflow.com/q/27355124
tags question: http://stackoverflow.com/q/27356227
tags question: http://stackoverflow.com/q/27343500
tags question: http://stackoverflow.com/q/27426796
tags question: http://stackoverflow.com/q/27410668
tags question: http://stackoverflow.com/q/27358576
tags question: http://stackoverflow.com/q/27360272
tags question: http://stackoverflow.com/q/27416108
tags question: http://stackoverflow.com/q/27418944

http://stackoverflow.com/a/27345775
score: 0
type: AcceptedAnswer
type: Answer
has comment: http://stackoverflow.com/comment/43146867
answers question: http://stackoverflow.com/q/27345657
has comment: http://stackoverflow.com/comment/43147074
accepted answer of: http://stackoverflow.com/q/27345657
has body: As i mentioned in my comments earlier, There is no button with id button_id.. instead you have android:id="@+id/button1" in your xml file.. so, please change final Button button = (Button) findViewById(R.id.button_id); to final Button button = (Button) findViewById(R.id.button1); in MainActivity.java OR change android:id="@+id/button1" to android:id="@+id/button_id" in your activity_main.xml
has comment: http://stackoverflow.com/comment/43147107

http://stackoverflow.com/comment/43101233
type: Comment
score: 0
has text: You are not creating any students in the array.... All i see is you are making the array but not creating a `new Student()` @Chrismas007 I think his question is in the title....
type: QuestionComment
comment on: http://stackoverflow.com/q/27320961

http://stackoverflow.com/comment/43176798
score: 0
type: AnswerComment
type: Comment
has text: That's a reference to another class. Just replace it with a System.out.println
comment on: http://stackoverflow.com/a/27344215

http://stackoverflow.com/comment/43228989
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27367308
has text: @Timbo Also, if you want to get the current question, I would make a method called `getCurrentQuestion()`, which simply returns `questions[currentQuestionIndex]`.

http://stackoverflow.com/q/27348785
type: AnsweredQuestion
tagged with: math
tagged with: java
has body: I can't understand the http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm enough to write it in Java (I'm in 8th grade). From a starting point, I need to get a point toward a destination point. I have found several forum posts but no examples in Java. I tried this (inside my Vector2 class): public Vector2 getNextPointTowardOther(Vector2 dest, int speed) { if (dest == null) return this; double deltaX = dest.getX() - this.x; double deltaY = dest.getY() - this.y; double direction = Math.atan(deltaY / deltaX); double x = this.x + (speed * Math.cos(direction)); double y = this.y + (speed * Math.sin(direction)); return new Vector2(x, y); } But it never returns a negative x or y coordinate, and it just doesn't seem to be altogether accurate.
type: Question
score: 0
tagged with: vector
answer count: 1
has comment: http://stackoverflow.com/comment/43152460
accepted answer: http://stackoverflow.com/a/27348908
has comment: http://stackoverflow.com/comment/43152459
has answer: http://stackoverflow.com/a/27348908
has title: Get next point toward other point

http://stackoverflow.com/q/27384590
accepted answer: http://stackoverflow.com/a/27384622
tagged with: subclass
possible better answer: http://stackoverflow.com/a/27385152
type: AnsweredQuestion
has title: Changing method of an abstract class in subclass
tagged with: java
tagged with: methods
type: Question
has body: I made a method in an abstract class namely the method String toString() public String toString() { String res ="(" + Character.toString(propositieletter1) + " " + symboolconstante + " " + Character.toString(propositieletter2) + ")"; return res; } this is a method of my abstract method, my subclasses need to use this method only change the "symboolconstante". I have no idea how I can do this without making the entire method again in my subclass.
has answer: http://stackoverflow.com/a/27384622
tagged with: class
score: 0
answer count: 3
tagged with: abstract
has answer: http://stackoverflow.com/a/27385251
has answer: http://stackoverflow.com/a/27385152

http://stackoverflow.com/comment/43106304
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27323563
has text: "...due to some errors" what errors? How other people with same problem would find your question and potential solutions if you will not include any informations about problem you are trying to solve?
score: 0

http://stackoverflow.com/q/27435617
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27612470
upvote count: 1
type: Question
has body: I have a web application that uses Spring MVC and Spring Security. When I add the following configuration to my web.xml, it turns impossible do login, it just gets the session expired and I´m not able to authenticate: 15 true true 31536000 COOKIE If I remove the following, works fine: true true 31536000 Is there any conflict with Spring configuration? Following is my spring-security.xml: <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" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.2.xsd"> <context:component-scan base-package="com.blank.controller"/> <global-method-security secured-annotations="enabled"/> <intercept-url pattern="/usuario**" access="hasRole('ROLE_USER')" /> <intercept-url pattern="/usuario/**" access="hasRole('ROLE_USER')" /> <access-denied-handler error-page="/403" /> <form-login login-page="/login" default-target-url="/index" always-use-default-target="true" authentication-failure-url="/login?error" username-parameter="username" password-parameter="password" /> <logout logout-success-url="/login?logout" invalidate-session="true" delete-cookies="JSESSIONID" /> <csrf /> <concurrency-control error-if-maximum-exceeded="true" expired-url="/login?expire" max-sessions="1"/> <remember-me key="terror-key"/> <authentication-manager> <authentication-provider> <jdbc-user-service data-source-ref="dataSource" users-by-username-query="select usuario as username, senha as password, ativo as enabled from usuario where usuario = ?" authorities-by-username-query="select u.us…
tagged with: session
downvote count: 0
tagged with: spring-security
has title: Session always expired in Spring when adding web.xml configuration
answer count: 1
has answer: http://stackoverflow.com/a/27612470
favorite count: 0
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion

http://stackoverflow.com/q/27389249
has comment: http://stackoverflow.com/comment/43228469
has comment: http://stackoverflow.com/comment/43226500
downvote count: 0
answer count: 1
score: 1
favorite count: 0
tagged with: shared-secret
accepted answer: http://stackoverflow.com/a/27398689
tagged with: javax.imageio
linked to: http://stackoverflow.com/q/124630
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43226694
tagged with: java
upvote count: 1
has body: I don't understand how WritableRaster class of Java works. I tried looking at the documentation but don't understand how it takes values from an array of pixels. Plus, I am not sure what the array of pixels consists. Here I explain. What I want to do is : Shamir's Secret Sharing on images. For that I need to fetch an image in BuferedImage image. I take a secret image. Create shares by running a 'function' on each pixel of the image. (basically changing the pixel values by something) Snippet: int w = image.getWidth(); int h = image.getHeight(); for (int i = 0; i &lt; h; i++) { for (int j = 0; j &lt; w; j++) { int pixel = image.getRGB(j, i); int red = (pixel &gt;&gt; 16) &amp; 0xFF; int green = (pixel &gt;&gt; 8) &amp; 0xFF; int blue = (pixel) &amp; 0xFF; pixels[j][i] = share1(red, green, blue); // Now taking those rgb values. I change them using some function and return an int value. Something like this: public int share1 (r, g, b) { a1 = rand.nextInt(primeNumber); total1 = r+g+b+a1; new_pixel = total1 % primeNumber; return new_pixel; } // This 2d array pixels has all the new color values, right? But now I want to build an image using this new values. So what I did is. First converted this pixels array to a list. Now this list has pixel values of the new image. But to build an image using RasterObj.setPixels() method, I need an array with RGB values [I MIGHT BE WRONG HERE!] So I take individual values of a list and find rgb values and put it consecutively in a new 1D array pixelvector..something like this (r1,g1,b1,r2,g2,b2,r3,g3,b3...) Size of the list is wh because it contains single pixel value of each pixel. BUT, Size of the new array pixelvector will become wh*3 since it contains r,g,b values of each pixel.. Then to form image I do this: Snippet BufferedImage image_share1 = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); WritableRaster rast = (WritableRaster) image_share1.getData(); rast.setPixels(0, 0, w, h, pixelvector); image_share1.setData(rast); ImageI…
has comment: http://stackoverflow.com/comment/43227126
has comment: http://stackoverflow.com/comment/43226594
type: Question
has comment: http://stackoverflow.com/comment/43226498
has answer: http://stackoverflow.com/a/27398689
has title: What type of array required in WritableRaster method setPixels()?

http://stackoverflow.com/q/27402466
type: UnansweredQuestion
has title: Variable type in JSON using Jersey+MOXy
score: 2
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has body: I am writing REST services using Jersey and MOXy. I need to create a JSON array of objects that looks like this: { indexes:[ { "name": "ABC", "value": "abcdef" "displayValue": "abcdef", "type": "string" }, { "name": "XYZ", "value": 12345 "displayValue": "12345", "type": "number" }, ... ] } The string-type should be quoted while the "number"-type should be un-quoted. I tried to return the following POJO in the service request: public class Index { String name; Object value; String displayValue; String type; } I defined the setValue to assign either Integer, or String to value, based on "type". Similarly, I defined getValue to return either Integer or String. Here is my output, that, non-surprisingly, creates another level of curly braces: { indexes:[ { "name": "ABC", "value": { "type": "xsd:string", "value": "abcdef" }, "displayValue": "abcdef", "indexType": "string" }, { "name": "XYZ", "value": { "type": "xsd:int", "value": 812501 }, "displayValue": "812501", "indexType": "number" }, ... Is there any way to achieve what I need, variable type value for the "value" field?
type: Question
has answer: http://stackoverflow.com/a/27403117
tagged with: jersey
downvote count: 0
answer count: 1
tagged with: moxy
favorite count: 0
upvote count: 2

http://stackoverflow.com/comment/43182802
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27336085
has text: Why don't you use the support of JWrapper?

http://stackoverflow.com/comment/43227872
has text: That prints the last name now but not the one with the largest value
comment on: http://stackoverflow.com/q/27389159
score: 0
type: Comment
type: QuestionComment

javafx
tags question: http://stackoverflow.com/q/27399242
tags question: http://stackoverflow.com/q/27398157
type: Tag
tags question: http://stackoverflow.com/q/27354320
tags question: http://stackoverflow.com/q/27349485
tags question: http://stackoverflow.com/q/27379892
tags question: http://stackoverflow.com/q/27470647
tags question: http://stackoverflow.com/q/27454911
tags question: http://stackoverflow.com/q/27469164
tags question: http://stackoverflow.com/q/27318089
tags question: http://stackoverflow.com/q/27470040
tags question: http://stackoverflow.com/q/27446360
tags question: http://stackoverflow.com/q/27387116
tags question: http://stackoverflow.com/q/27332003
tags question: http://stackoverflow.com/q/27393511
tags question: http://stackoverflow.com/q/27468218
tags question: http://stackoverflow.com/q/27327914
tags question: http://stackoverflow.com/q/27441384
tag name: javafx
tags question: http://stackoverflow.com/q/27359709
tags question: http://stackoverflow.com/q/27448899
tags question: http://stackoverflow.com/q/27399806
tags question: http://stackoverflow.com/q/27375106
tags question: http://stackoverflow.com/q/27350618
tags question: http://stackoverflow.com/q/27420115
tags question: http://stackoverflow.com/q/27464696
tags question: http://stackoverflow.com/q/27468195
tags question: http://stackoverflow.com/q/27338544
tags question: http://stackoverflow.com/q/27394095
tags question: http://stackoverflow.com/q/27412530
tags question: http://stackoverflow.com/q/27438629
tags question: http://stackoverflow.com/q/27435387
tags question: http://stackoverflow.com/q/27356870
tags question: http://stackoverflow.com/q/27469265
tags question: http://stackoverflow.com/q/27442553
tags question: http://stackoverflow.com/q/27465062
tags question: http://stackoverflow.com/q/27453113
tags question: http://stackoverflow.com/q/27443647
tags question: http://stackoverflow.com/q/27313975
tags question: http://stackoverflow.com/q/27464382
tags question: http://stackoverflow.com/q/27372973
tags question: http://stackoverflow.com/q/27385636
tags question: http://stackoverflow.com/q/27334455
tags question: http://stackoverflow.com/q/27364844
tags question: http://stackoverflow.com/q/27416758
tags question: http://stackoverflow.com/q/27458526
tags question: http://stackoverflow.com/q/27460432
tags question: http://stackoverflow.com/q/27338946
tags question: http://stackoverflow.com/q/27419148
tags question: http://stackoverflow.com/q/27384572
tags question: http://stackoverflow.com/q/27424673
tags question: http://stackoverflow.com/q/27380082
tags question: http://stackoverflow.com/q/27375002
tags question: http://stackoverflow.com/q/27338844
tags question: http://stackoverflow.com/q/27410671
tags question: http://stackoverflow.com/q/27322376
tags question: http://stackoverflow.com/q/27441960
tags question: http://stackoverflow.com/q/27418189
tags question: http://stackoverflow.com/q/27348231
tags question: http://stackoverflow.com/q/27345498

http://stackoverflow.com/comment/43378355
score: 2
type: Comment
has text: Java's is its own language. Don't base your knowledge of it off of C++.
type: QuestionComment
comment on: http://stackoverflow.com/q/27471868

swagger-ui
tag name: swagger-ui
type: Tag
tags question: http://stackoverflow.com/q/27444975

http://stackoverflow.com/a/27421145
has comment: http://stackoverflow.com/comment/43286982
type: Answer
has body: you can use this code. you have to extends your drawing objects to PaintObject, background as well. and implement their paint in their own. I hope this code can give you idea. you can collect all area needs to be repaint. then, find which object are in there. after, repaint only this area class GameCanvas extends Canvas { private static final int FPS = 24; private boolean isAlive; private Vector&lt;PaintObject&gt; allObjects = new Vector&lt;Rec.PaintObject&gt;(); private Vector&lt;Rectangle&gt; paintingClipsInTurn = new Vector&lt;Rectangle&gt;(); public GameCanvas() { isAlive = true; new Thread(){ @Override public void run() { while(isAlive){ long ti1 = System.currentTimeMillis(); repaint(); long ti2 = System.currentTimeMillis(); long frameTime = ti2-ti1; long targetFrameTime = 1000/FPS; if (targetFrameTime &gt; frameTime){ try { Thread.sleep(targetFrameTime - frameTime); } catch (InterruptedException e){ } } } } }.start(); } @Override public void paint(Graphics g) { if (paintingClipsInTurn.size() &gt; 0) { Rectangle s = paintingClipsInTurn.get(0); int min_x = s.x; int min_y = s.y; int max_x = s.x + s.width; int max_y = s.y + s.height; for (Rectangle r : paintingClipsInTurn) { if (r.x &lt; min_x) min_x = r.x; if (r.y &lt; min_y) min_y = r.y; if (r.x + r.width &gt; max_x) max_x = r.x + r.width; if (r.y + r.height &gt; max_y) max_y = r.y + r.height; } Rectangle totalclip = new Rectangle(min_x, min_y, max_x-min_x, max_y-min_y); for (PaintObject object : allObjects) { Rectangle r1 = object.getClip(); if (totalclip.intersects(r1)){ object.paintObject(g); } } } paintingClipsInTurn.clear(); } public void addDrawComponent(PaintObject object){ object.parent = this; allObjects.add(object); } public void removeDrawComponent(PaintObject object){ object.parent = null; allObjects.remove(object); } void requestRepaint(PaintObject object){ paintingClipsInTurn.add(object.getClip()); } } abstract class PaintObject { GameCanvas parent; private int x,y,w,h; public void setPosition(int …
score: 0
answers question: http://stackoverflow.com/q/27405985

http://stackoverflow.com/comment/43248451
comment on: http://stackoverflow.com/q/27401807
type: Comment
type: QuestionComment
has text: I get "An internal error occurred during: "Decoration Calculation". Java heap space" error too sometime.
score: 0

http://stackoverflow.com/comment/43305519
comment on: http://stackoverflow.com/a/27432124
type: Comment
score: 1
has text: Just tried that still seem to be a related issue: java.io.FileNotFoundException: C:\jpg\IMG_7734.jpg (The system cannot open the file) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(Unknown Source) at java.io.FileInputStream.<init>(Unknown Source) and the file is definitely there
type: AnswerComment

http://stackoverflow.com/a/27427440
answers question: http://stackoverflow.com/q/27427414
has body: Because your regex is not doing what you think it should be doing. Use this regex with Negative lookahead: Pattern pattern = Pattern.compile("^(?!bob|alice|kitty).*$"); Your regex: [^(bob)(alice)(kitty)] is using a character class and inside a character class there are no groups. (?!bob|alice|kitty) is negative lookahead that means fail the match if any of these 3 words appear at start of input. Important to use anchors ^ and $ to make sure we're not matching from middle of the string. If you want to avoid matching these 3 words anywhere in input then use this regex: ^(?!.*?(?:bob|alice|kitty)).*$ RegEx Demo
type: Answer
has comment: http://stackoverflow.com/comment/43296768
has comment: http://stackoverflow.com/comment/43296423
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43296615
score: 35
upvote count: 35
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27427414

http://stackoverflow.com/comment/43447740
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27400919
has text: it can local variable or object field but it must be primitive not wrappers
score: 0

http://stackoverflow.com/comment/43219119
type: Comment
type: AnswerComment
has text: Am I missing something? There's no hidden secret method, it sounds like you just need a query on the name property. Look into JPQL, which is how queries are written in JPA framework.[1] [1] - http://www.objectdb.com/java/jpa/query/jpql/structure
comment on: http://stackoverflow.com/a/27337001
score: 0

http://stackoverflow.com/a/27413865
score: 1
accepted answer of: http://stackoverflow.com/q/27383803
has comment: http://stackoverflow.com/comment/43289065
answers question: http://stackoverflow.com/q/27383803
has body: Firstly you should check out this link for naming conventions (lower case function). Im not 100% Sure what you are asking but I see the commented out part and know it would give you an error (if thats what you are asking about). When you call public void ResetFrame() you say this.dispose(); That means you are telling that instance to get rid of itself. Then you make a new instance and set it visible. Where you say if(!createTabs.isVisible()){ createTabs.ResetFrame(); //createTabs.setVisible(true); } You told the instance of createTabs to get rid of itself so you cannot now tell it to be visible again. The new instance of CreateTabs you made in the ResetFrame function is not being referenced. If you want createTabs to be a "fresh" CrateTabs, you can say... public CreateTabs ResetFrame(){ this.dispose() CreateTabs newTabs = new CreateTabs(); newTabs.setVisible(true); return newTabs; } ... if(!createTabs.isVisible()){ createTabs = createTabs.ResetFrame(); createTabs.setVisible(true); } If that is not what you were asking about just let me know.
upvote count: 1
type: AcceptedAnswer
type: Answer
downvote count: 0

http://stackoverflow.com/comment/43307870
has text: Did you add the struts2-core-.jar to the libraries of the project? If you did, clean the project.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27433114

http://stackoverflow.com/comment/43120673
has text: Yes `ArrayList<Integer> ID` declares ID as an ArrayList of Integer, but it doesn't mean that it's initialized. declaration != initialization !!!
comment on: http://stackoverflow.com/q/27331289
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/comment/43314984
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27423423
score: 1
has text: sb.append(lsSerializer.writeToString(childNodes.item(i)));

http://stackoverflow.com/comment/43118661
has text: I think there is not much gain using `EnumMap`s as raw types. Use them properly with type parameters.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27330303

http://stackoverflow.com/q/27368775
downvote count: 0
has comment: http://stackoverflow.com/comment/43190167
has body: For my Android application, I am using a Parse.com backend. I am trying to update information for a parse user, but the saveInBackground() method is acting strange to me. When I have this code: HomeActivity.currentUser.put("dealNotifications",deals.isChecked()); HomeActivity.currentUser.put("itemSuggestions",items.isChecked()); HomeActivity.currentUser.saveInBackground(); The user, and the two fields "dealNotifications" and "itemSuggestions" are updated, but all other custom properties are deleted from the Parse browser. On the other hand, when I have this code: HomeActivity.currentUser.put("dealNotifications",deals.isChecked()); HomeActivity.currentUser.put("itemSuggestions",items.isChecked()); HomeActivity.currentUser.put("favourites",HomeActivity.favourites); HomeActivity.currentUser.saveInBackground(); The Parse user is not updated at all. I have no idea why this is happening. From my understanding, the saveInBackground() method should not modify fields that have not been changed, so the first behaviour is very odd. I also have no idea why adding another "put" causes the saveInBackground() method to do nothing. Anyone have an idea what is happening here?
tagged with: android
favorite count: 0
has comment: http://stackoverflow.com/comment/43190278
answer count: 0
tagged with: parse-platform
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/43189627
score: 1
tagged with: java
has title: ParseUser saveInBackground weird behaviour
has comment: http://stackoverflow.com/comment/43190623
type: Question
has comment: http://stackoverflow.com/comment/43189421

http://stackoverflow.com/q/27352520
type: UnansweredQuestion
tagged with: swt
score: 1
tagged with: java
tagged with: forms
upvote count: 1
has body: In my RCP application, I'm using Horizontal SashForms. Sash can be moved using divider line. But I need my sashes to be moved using buttons (left/right) on divider line. How can I create Sash form having buttons on divider line to move sashes to left or right up to specific width? I searched on internet, but did not find any relevant answer.
has title: How to move/resize sashes of Sash forms using arrow buttons (or anything like button) on divider line?
type: Question
answer count: 2
downvote count: 0
tagged with: resize
tagged with: divider
has answer: http://stackoverflow.com/a/27542443
has answer: http://stackoverflow.com/a/27362111
favorite count: 0

http://stackoverflow.com/comment/43232650
type: QuestionComment
comment on: http://stackoverflow.com/q/27392607
has text: You need to read about Access Modifiers check this out. https://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html
score: 0
type: Comment

http://stackoverflow.com/q/27318070
tagged with: ajax
score: 0
answer count: 1
has comment: http://stackoverflow.com/comment/43095738
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43096393
tagged with: java
has title: Showing specific error in JSP with Ajax
has answer: http://stackoverflow.com/a/27318281
type: Question
has body: I'm trying to show in my App different errors when a user is already logged in and when the user wrote their username/password wrong. I have tried many ways but none of them is working. I don't know what else to try or if it's even possible. I don't know if I'm close to the solution either. What I'm trying to do is: Set the errorMessage in the request; Set the SC_INTERNAL_SERVER_ERROR in the response so the AJAX function enters in ** and the HTML in the paramether is the one in the JSP with the specific Message. Action public class LogUser extends Action { @Override public void execute() throws Exception { ... String pageToGo = this.tryLogUser(username, password); request.getRequestDispatcher(pageToGo).forward(request, response); } private String tryLogUser(String username, String password) throws Exception { String pageToGo = "page/userHome"; ... if(canLog) { ... try { ... Server.getInstance().logIn(user); // Throws an Exception if the User is already logged in. ... } catch (ServerException e) { this.setErrorMessage("That user is already logged in."); pageToGo = "page/error.jsp"; } } else { this.setErrorMessage("User and/or Password are incorrect."); pageToGo = "page/error.jsp"; } return pageToGo; } private void setErrorMessage(String message) { request.setAttribute("errorMessage", message); response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } } JSP &lt;div class="alert alert-danger"&gt; ${ requestScope.errorMessage } &lt;/div&gt; AJAX function showUserHome() { $.post( "${ sessionScope.ServletUrl }", $( "form#logForm" ).serialize() ) .done(function( html ) { $( "div#toolbar" ).load("page/userToolbar.jsp"); $( "div#content" ).html( html ); }) .fail(function( html ) { $( "#result" ).html( html ); }); } Edit: While trying to Debug it from the browser, it gets in the $.post and after that step, it jumps to the end of the function, skipping .done and .fail and the page remains the same. I'm not getting any error in the RAD Console or the Browser Console o…
tagged with: jsp
tagged with: jquery
has comment: http://stackoverflow.com/comment/43096222

http://stackoverflow.com/comment/43152477
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27348779
score: 1
has text: How large are the images?

http://stackoverflow.com/comment/43352790
type: QuestionComment
comment on: http://stackoverflow.com/q/27457889
has text: http://docs.oracle.com/javase/7/docs/api/java/awt/event/KeyEvent.html#getExtendedKeyCodeForChar%28int%29
score: 0
type: Comment

http://stackoverflow.com/a/27335367
answers question: http://stackoverflow.com/q/27335243
type: Answer
has body: This should create the object according to your description Constructor&lt;?&gt; constr = ValueClass.getConstructor( object.getClass() ); Object newObj = constr.newInstance(object); All sorts of exceptions can be raised by this - see the javadoc.
upvote count: 1
has comment: http://stackoverflow.com/comment/43127747
has comment: http://stackoverflow.com/comment/43137164
score: 1
accepted answer of: http://stackoverflow.com/q/27335243
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/comment/43439631
type: Comment
has text: Actually I have one Galaxy Y older than my grandfather, but it does not fail. Not that phone, not every emulator I have run. On the other hand I do not collect information from my users, so I have no way to associate a crash with an user so I can contact him/her. Anyway, I am looking at the code of that library right now.
comment on: http://stackoverflow.com/a/27485703
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43161068
comment on: http://stackoverflow.com/q/27353878
score: 2
type: Comment
type: QuestionComment
has text: Use Java reflection: https://docs.oracle.com/javase/tutorial/reflect/member/methodInvocation.html

http://stackoverflow.com/a/27414120
score: 0
has comment: http://stackoverflow.com/comment/43272320
type: Answer
has body: The compiler is correctly telling that outputString is not declared correctly. The outputString is declared within the for loop, but you are trying to print the value outside. A quick way to fix this would be to declare outputString outside the for loop by having outputString = "";
answers question: http://stackoverflow.com/q/27414099

http://stackoverflow.com/q/27467401
has answer: http://stackoverflow.com/a/27467477
tagged with: java
has body: I am looking for way to continue my selection and stop the program when I choose 3. Here is my code: Arrays.sort(a); int x = 0; System.out.println("Choose order: "); System.out.println("1. Smallest to biggest."); System.out.println("2. Biggest to smallest."); System.out.println("3. Stop app."); int ii = input.nextInt(); switch (ii) { case (1): for (int number : a) { System.out.print(" " + number); } break; case (2): for (i = 0, j = a.length - 1; i &lt; (a.length) / 2; i++, j--) { x = a[i]; a[i] = a[j]; a[j] = x; } for (int number : a) { System.out.print(" " + number); } break; case (3): break; default: { } } Sorry for unclear question. I know how to stop. My question is after I choose 1 command the program run and then the program show the list to choose again not stop. I added break label but it showed that only loop is labeled. So could not labeled the pintln.
score: -1
tagged with: loops
type: Question
has answer: http://stackoverflow.com/a/27467440
tagged with: arrays
favorite count: 0
answer count: 3
possible better answer: http://stackoverflow.com/a/27467477
downvote count: 1
has title: Showing the chosen list and input again
accepted answer: http://stackoverflow.com/a/27467436
upvote count: 0
has answer: http://stackoverflow.com/a/27467436
type: AnsweredQuestion

http://stackoverflow.com/comment/43187674
comment on: http://stackoverflow.com/q/27367566
has text: What are you mapping to? Entire CSV files? Chunks of CVS files?
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27325927
linked to: http://stackoverflow.com/q/3369794
tagged with: java
accepted answer: http://stackoverflow.com/a/27326510
has comment: http://stackoverflow.com/comment/43112099
has answer: http://stackoverflow.com/a/27326510
has comment: http://stackoverflow.com/comment/43127093
answer count: 1
tagged with: jar
tagged with: java-io
has comment: http://stackoverflow.com/comment/43111828
score: 0
tagged with: javafx-2
has body: Currently I'm developing a java application to carry out a survey. I want to read/write to a .txt file, creating a .csv to store inputted data. Below is code I have used so far to write data - Of course this makes the JAR file not portable as it has an absolute path. File file = new File("C:/Files/JavaApp/src/text.text/"); FileWriter fw = null; BufferedWriter bw = null; try { fw = new FileWriter(file, true); } catch (IOException e) { System.out.println(e.getMessage()); } bw = new BufferedWriter(fw); try { bw.write("blah" + ","); } catch (IOException e) { System.out.println(e.getMessage()); } try { bw.newLine(); } catch (IOException e) { System.out.println(e.getMessage()); } try { bw.close(); } catch (IOException e) { System.out.println(e.getMessage()); } I have tried several methods such as ClassName.class.getResource("Text.text"); but it will always return a Reflection or a NullPointer error. I know that writing to a file within the JAR does pose some problems, meaning I would have to point to a file outside to read/write. However I don't know how to preform this in code. I need the JAR file to be completely portable. Even if that means it must be kept within a directory, so the JAR can search for the .txt file within that directory. Or, is there another way? If anyone can help me out, I would be very grateful.
has comment: http://stackoverflow.com/comment/43111935
has title: Read/Write to a .txt file from JAR
linked to: http://stackoverflow.com/q/5052311
has comment: http://stackoverflow.com/comment/43111783
type: Question
type: AnsweredQuestion

http://stackoverflow.com/comment/43189721
type: Comment
comment on: http://stackoverflow.com/q/27368235
type: QuestionComment
has text: @HovercraftFullOfEels What do you mean clarify? I'm trying to achive the same animation effect as the codepen I linked. I put the code into a Swing Timer and the effects are still the same. Also I don't need a getX, which is visible in the code, the x axis is 100 + 20 * k, I convered that JS code from ActionScript, I also converted it to C# and it worked alright too. There isn't any reason simple math shouldn't work with Swing.
score: 0

http://stackoverflow.com/a/29349471
answers question: http://stackoverflow.com/q/27404709
type: Answer
score: 3
downvote count: 0
has comment: http://stackoverflow.com/comment/46885936
has body: FtpServerFactory serverFactory = new FtpServerFactory(); ListenerFactory factory = new ListenerFactory(); //factory.setServerAddress("127.0.0.1"); // set the port of the listener factory.setPort(3232); factory.setIdleTimeout(3000); // replace the default listener serverFactory.addListener("default", factory.createListener()); System.out.println("Adding Users Now"); PropertiesUserManagerFactory userManagerFactory = new PropertiesUserManagerFactory(); userManagerFactory.setFile(new File("users.properties")); userManagerFactory.setPasswordEncryptor(new PasswordEncryptor() {//We store clear-text passwords in this example @Override public String encrypt(String password) { return password; } @Override public boolean matches(String passwordToCheck, String storedPassword) { return passwordToCheck.equals(storedPassword); } }); BaseUser user1 = new BaseUser(); user1.setName("test"); user1.setPassword("test"); user1.setHomeDirectory("D:/Softwares/ApacheFTP/ftpserver-1.0.6/apache-ftpserver-1.0.6/res/home"); List&lt;Authority&gt; authorities = new ArrayList&lt;Authority&gt;(); authorities.add(new WritePermission()); user1.setAuthorities(authorities); UserManager um = userManagerFactory.createUserManager(); try { um.save(user1);//Save the user to the user list on the filesystem } catch (FtpException e1) { e1.printStackTrace(); } serverFactory.setUserManager(um); Map&lt;String, Ftplet&gt; m = new HashMap&lt;String, Ftplet&gt;(); m.put("miaFtplet", new Ftplet() { @Override public void init(FtpletContext ftpletContext) throws FtpException { System.out.println("init"); //System.out.println("Thread #" + Thread.currentThread().getId()); } @Override public void destroy() { System.out.println("destroy"); //System.out.println("Thread #" + Thread.currentThread().getId()); } @Override public FtpletResult beforeCommand(FtpSession session, FtpRequest request) throws FtpException, IOException { //System.out.println("beforeCommand " + session.getUserArgument() + " : " + session.toString() + " |…
upvote count: 3
has comment: http://stackoverflow.com/comment/117065224

http://stackoverflow.com/q/27446508
type: Question
tagged with: java
tagged with: mongodb
answer count: 1
has answer: http://stackoverflow.com/a/27791798
has title: MongoDB Nested objects with own Repository interface
score: 0
has body: I am using Spring Data MongoDB to load and save some simple domain classes. As a simple example lets say I have Factory and Product @Document public class Factory { @Id String id; String name; List&lt;Product&gt; products; } @Document public class Product { @Id String id; String name; Date productionDate; } Ok, simple enough I can now create a FactoryRepository: public interface FactoryQueryRepository extends MongoRepository&lt;Factory, String&gt; {} This repository already has basic CRUD functionality to store and load Factories together with nested products. Now lets say I want to only retrieve a set of products for a given factory. I now have two questions: A) Can I somehow return a list of products instead of a list of factories in the FactoryQueryRepository like so: @Query(value = "???") public List&lt;Product&gt; findProductByFactoryName(String name); B) Lets say my factory does not only have products but also employees, customers, suppliers, you name it ... Now if need to define a few special query methods for each of these nested collections then I soon end-up with a very big FactoryQueryRepository interface. So it would actually be more appropriate to create a new ...QueryRepositoy for Product, Employee, Customer and so on. But when I try to do this, it seems it only works if I first save a stand alone Product object that is not nested inside a Factory. Is there a way that I can (similar to question A) define a ProductQueryRepository interface and use it to retrieve all Products that are nested inside a Factory by specifying some filter criteria of the Factory, something like this: public interface ProductQueryRepository extends MongoRepository&lt;Product, String&gt; { @Query(/* select products from factory where name = '?0' */) public List&lt;Product&gt; findProductsByFactoryName(String name); } Shoud I in this case rather make use of the @DBRef than to use nested objects?
type: UnansweredQuestion
tagged with: spring

geotools
type: Tag
tags question: http://stackoverflow.com/q/27452596
tags question: http://stackoverflow.com/q/27429097
tags question: http://stackoverflow.com/q/27414600
tag name: geotools

http://stackoverflow.com/comment/43174667
comment on: http://stackoverflow.com/a/27361187
score: 0
type: AnswerComment
has text: What about an input? Do you know any values which this code might fall with?
type: Comment

http://stackoverflow.com/q/27465321
accepted answer: http://stackoverflow.com/a/27465405
score: 0
tagged with: java
tagged with: leiningen
has comment: http://stackoverflow.com/comment/44016134
has title: Installing leiningen
type: Question
type: AnsweredQuestion
tagged with: clojure
has body: I am trying to manually install Leiningen on OSX. Following the standard instructions at http://leiningen.org/, I: Downloaded the script. Copied it to ~/bin with my credentials. (I verified that bin is in my PATH) Attempted to set it to executable: ~::bin user$ chmod a+x lein.sh (seems to work here) ~:bin user$ "Run it (lein) and it will download the self-install package" Here is the terminal output: -bash: lein: command not found Why? Comment if I can provide any relevant information.
has comment: http://stackoverflow.com/comment/43366832
has answer: http://stackoverflow.com/a/27465405
answer count: 1

http://stackoverflow.com/a/27387792
accepted answer of: http://stackoverflow.com/q/27387635
answers question: http://stackoverflow.com/q/27387635
has body: You can override the toString() method to display how the Dog object should look: @Override public String toString() { return name + "," + breed; // You can add other attributes here as well. } Just place the toString() method in your Dog class and you should be good to go.
type: AcceptedAnswer
score: 0
type: Answer

http://stackoverflow.com/comment/43336772
score: 0
type: QuestionComment
has text: I tried loops and it works but I look for more efficient way
type: Comment
comment on: http://stackoverflow.com/q/27448767

http://stackoverflow.com/comment/43186555
has text: that should work, and display both the text and the image
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27336547

http://stackoverflow.com/q/27394662
has answer: http://stackoverflow.com/a/27395041
tagged with: nested-class
tagged with: inheritance
has body: I have two nested classes inside a class with the outer class extending another class. The structure is something like this. public class EXTENSION_CLASS { public int Get_Value() { return(100); } } public class OUTER extends EXTENSION_CLASS { public static class NESTED1 { public void Method1() { int value=0; value=Get_Value(); System.out.println("Method1: "+value); } } public static class NESTED2 { NESTED1 Nested1_Instance=new NESTED1(); public void Method2() { Nested1_Instance.Method1(); } } public void run() { NESTED2 Nested2_Instance=new NESTED2(); Nested2_Instance.Method2(); } public static void main (String[] args) { OUTER New_Class=new OUTER(); New_Class.run(); } } I'm expecting the output: "Method1: 100". But, am getting the output: "OUTER.java:16: error: non-static method Get_Value() cannot be referenced from a static context value=Get_Value();". How can i make this working? Cheers ! Rajesh.
has title: How to access a method of Extended Class from nested class?
has comment: http://stackoverflow.com/comment/43236661
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27394787
has answer: http://stackoverflow.com/a/27394983
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/128812355
answer count: 4
has comment: http://stackoverflow.com/comment/43236211
score: 1
has comment: http://stackoverflow.com/comment/43236463
tagged with: java
has answer: http://stackoverflow.com/a/27394820
linked to: http://stackoverflow.com/q/27339664
type: Question

archive
tags question: http://stackoverflow.com/q/27402234
type: Tag
tag name: archive

http://stackoverflow.com/a/27443083
score: 0
type: AcceptedAnswer
has body: Yes you are using a load once method with is not dynamicly. Use for MVVM: &lt;decimalbox tooltiptext="@load(vm.createToolTip())"/&gt; For MVC I suggest putting a listener(when your tooltiptext has to change) and alter the tooltiptext in java code. Normally the method is in your Controller so you can autowire the decimalbox and change the tooltip. If that is not the case, provide a little more info from where the method comes. Example in fiddle : http://zkfiddle.org/sample/3hjk8af/6-decimalbox-tooltip Note: For answering this question, I gave same answer as I gave on the ZK-forum, witch was marked as solution.
type: Answer
accepted answer of: http://stackoverflow.com/q/27431230
answers question: http://stackoverflow.com/q/27431230

http://stackoverflow.com/comment/43417284
comment on: http://stackoverflow.com/q/27465968
has text: A servlet in Sling is an OSGi service, actually.
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43151475
comment on: http://stackoverflow.com/q/27345778
score: 0
has text: I do not really understand your question. What do you want to achieve? The row number in any DBMS is a very tricky thing. Most DBMS will count row numbers starting at 1 for each new result set (which could be a join as well). I recommend not relying on row numbers. Especially not if you want to support different DBMS.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43245122
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27386337
type: Comment
has text: I don't use any range queries in testing. Here is the schema of my CF: Schema: create table usertable ( y_id varchar primary key, field0 varchar, field1 varchar, field2 varchar, field3 varchar, field4 varchar, field5 varchar, field6 varchar, field7 varchar, field8 varchar, field9 varchar) with speculative_retry='NONE' and read_repair_chance=0 and caching='ALL'; Query: Select * from usertable where y_id=<key> (key :this is selected according to the HotSpot distribution)

http://stackoverflow.com/a/27338490
has body: I would suggest this: public int binSearch(int empID) { int first = 0; int last = empCount - 1; int mid; // check the first and last element, otherways it could take too long to get to them if (empNums[first] &gt;= empID) mid = first; else if (empNums[last] &lt;= empID) mid = last; else do { mid = (first + last) / 2; // If you have found an element, just return it, no found variable is required // And you do not want to add or subtract 1 from a limits, because // next element could be one you looking for if (empNums[mid] == empID) return mid; else if (empNums[mid] &lt; empID) first = mid; else last = mid; } while (first &lt; last); // optional check to see that correct parameter has been found if (empNums[mid] != empID) { // do something } return mid; }
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27338254

http://stackoverflow.com/a/27459630
has comment: http://stackoverflow.com/comment/43355921
has comment: http://stackoverflow.com/comment/43356045
has comment: http://stackoverflow.com/comment/43355977
score: 0
has comment: http://stackoverflow.com/comment/43356011
has body: In Project Properties->JavaBuildPath section-> order and Export section. Make sure checkbox is checked or not for googlePlayService. And then clean your project and re-build.
has comment: http://stackoverflow.com/comment/43356126
type: Answer
answers question: http://stackoverflow.com/q/27459519

http://stackoverflow.com/a/27422270
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27405581
has body: You check the file size before closing stream. I you do after closing streams you will get the same size with operation system connection.connect(); int sizeBefore = connection.getContentLength(); BufferedInputStream bufferedInputStream = new BufferedInputStream(connection.getInputStream()); File destFile = new File (destFileName); BufferedOutputStream bufferedOutputStream = new BufferedOutputStream( new FileOutputStream(destFile)); while ((i = bufferedInputStream.read()) != -1) { bufferedOutputStream.write(i); } bufferedOutputStream.flush(); bufferedInputStream.close(); long sizeAfter = destFile.length(); if (sizeAfter==sizeBefore) { log.info("Downloaded correct"); }
accepted answer of: http://stackoverflow.com/q/27405581
type: Answer
score: 0

http://stackoverflow.com/comment/43172217
comment on: http://stackoverflow.com/q/27360067
score: 0
type: Comment
type: QuestionComment
has text: What errors are you getting?

http://stackoverflow.com/q/27444398
downvote count: 0
has comment: http://stackoverflow.com/comment/43327910
favorite count: 0
possible better answer: http://stackoverflow.com/a/27444824
has answer: http://stackoverflow.com/a/27444484
has answer: http://stackoverflow.com/a/27444824
tagged with: regex
accepted answer: http://stackoverflow.com/a/27444484
type: AnsweredQuestion
score: 1
tagged with: java
upvote count: 1
type: Question
tagged with: split
has body: I have this string na23me=12341234las4tName=654567stree2t[696]=764545457OK that I'd like to transform into this array: ['na23me=12341234', 'las4tName=654567', 'stree2t[696]=764545457', 'OK'] I thought this should have work: String[] tokens = buffer.split("(?!^)(?=\\b\\w=\\d+)");
has title: Tricky split string with regexpr
has comment: http://stackoverflow.com/comment/43327752
answer count: 2

remote-debugging
tag name: remote-debugging
tags question: http://stackoverflow.com/q/27419376
tags question: http://stackoverflow.com/q/27405988
type: Tag

http://stackoverflow.com/q/27384640
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43217767
tagged with: java
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27384661
score: 0
has body: the following code works: String myString = null; if (myString != null &amp;&amp; myString.length()&gt; 0 ) { System.out.println("this is NOT null"); } else{ System.out.println("yes this is NULL!!"); } output: yes this is NULL!! however, the following will give an error: String myString = null; if ( myString.length()&gt; 0 ) { System.out.println("this is NOT null"); } else{ System.out.println("yes this is NULL!!"); } why does the if condition require 2 conditions to check if this string is null ?
has answer: http://stackoverflow.com/a/27384668
has title: determining if string is null takes 2 arguments for some reason
tagged with: android

http://stackoverflow.com/q/27354019
score: 1
tagged with: java
tagged with: http://stackoverflow.com/tag/json
has answer: http://stackoverflow.com/a/27355016
type: Question
tagged with: jersey
has comment: http://stackoverflow.com/comment/43162186
has title: How to Convert a Properties Object to JSON Object with JAXB
has comment: http://stackoverflow.com/comment/43161848
upvote count: 1
answer count: 1
tagged with: jersey-2.0
tagged with: jax-rs
favorite count: 0
has comment: http://stackoverflow.com/comment/43161797
accepted answer: http://stackoverflow.com/a/27355016
has body: I want to accept and respond JSON objects in a REST Application. The data I need to send and receive are in a .properties file. I have already read them and are now in a Properties Object(From java.util.Properties). Is there a way to marshal and unmarshal Properties Objects, without implementing a new class? I am using Jax-rs API in a Weblogic server. @POST @Path("{id}") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public JSONObject getbyID(@PathParam("id")JSONObject inputJsonObj) { //marshalling and unmarshalling goes here }
has comment: http://stackoverflow.com/comment/43162331
type: AnsweredQuestion
downvote count: 0

http://stackoverflow.com/a/27471413
has body: You can do - Date date = new Date(); This will assign the current system date to date.
has comment: http://stackoverflow.com/comment/43377597
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43377856
answers question: http://stackoverflow.com/q/27471328

http://stackoverflow.com/a/27525827
answers question: http://stackoverflow.com/q/27472580
score: 0
has comment: http://stackoverflow.com/comment/43492418
has body: From Intellij support: "We can change warning text for example to: "While it is legal to extend an annotation interface it is often done by accident, and the result won't be usable as an annotation." Note that you can always suppress the warning for the statement." My response: The proposed solution... would require developers to always suppress the warning for the statement. This solution is poor because the code would be littered with @SuppressWarning or, worse, the developer would need to turn off the warning altogether. The best and most useful solution, would be to not display any warning whatsoever if the developer extends AnnotationLiteral or TypeLiteral and implements an @interface at the same time. A YouTrack Issue was filed.
has comment: http://stackoverflow.com/comment/43490364
type: Answer
accepted answer of: http://stackoverflow.com/q/27472580
type: AcceptedAnswer

http://stackoverflow.com/comment/43290857
score: 0
has text: @FastSnail That's hardly a solution.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27424491

encapsulation
tags question: http://stackoverflow.com/q/27454218
type: Tag
tag name: encapsulation
tags question: http://stackoverflow.com/q/27379999

http://stackoverflow.com/comment/43217870
has text: You mean, **print them** one value per line instead of in the format of the standard `toString()` method of a list? There is no actual format underneath, the `toString()` method decides to print them like that. You can print them however you want
score: 3
comment on: http://stackoverflow.com/q/27384678
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27371860
score: 0
accepted answer of: http://stackoverflow.com/q/27371725
answers question: http://stackoverflow.com/q/27371725
type: AcceptedAnswer
has body: The error message java.lang.UnsatisfiedLinkError: Cannot load 64-bit SWT libraries on 32-bit JVM is clear, you are running 64-bit SWT (Eclipse) in a 32-bit JVM (Java Virtual Machine) you have to download the 32-bit version of eclipse. Or If you have a 64-bit JVM installed change eclipse.ini file to point to the correct vm. Check this link for how to change.
type: Answer

http://stackoverflow.com/comment/43282969
score: 0
has text: Read [«this answer»](http://stackoverflow.com/a/26105217/2711488) and consider that this also applies to all kinds of code generators acting like an embedded compiler. If you look at its “Linked” section you will find tons of similar Jasper related questions…
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27404937

http://stackoverflow.com/q/27332950
has title: Some doubts related to the AOP configuration in Spring
upvote count: 1
tagged with: spring
tagged with: spring-mvc
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27334659
score: 1
tagged with: java
has body: I am studying for Spring Core certification and I have a doubt related how Spring handle AOP. Reading the documentation it seems to understand that exist 2 way to obtain AOP in Java: Using AspectJ that using byte code modification for aspect weaving offers a full-blown Aspect Oriented Programming language. (so it seems to me that AspectJ is a differnt language that can be integrated with Java to offer it the AOP features). Spring AOP: used in Spring framework that uses dynamic proxies for aspect weaving instead the bytecode modification. So my doubts are mainly the followings: 1) Reading the documentations found the following method to add the AOP support to my Spring application: USING JAVA CONFIGURATION CLASS: @Configuration @EnableAspectJAutoProxy @ComponentScan(basePackages=“com.example”) public class AspectConfig { ... } USING XML CONFIGURATION: &lt;beans&gt; &lt;aop:aspectj-autoproxy /&gt; &lt;context:component-scan base-package=“com.example” /&gt; &lt;/beans&gt; As you can see in both configurations there is a reference to AspectJ: @EnableAspectJAutoProxy and &lt;aop:aspectj-autoproxy /&gt; Why? If Spring use Spring AOP instead AspectJ why there is a reference to AspectJ when I configure AOP in Spring? 2) In the previous examples are show 2 way to configure Spring: by Java configuration class and by XML configuration. I know that exist a third way to configure a Spring application: by the use of annotations. So exist a way to configure AOP using the annotations?
tagged with: aop
type: Question
accepted answer: http://stackoverflow.com/a/27334659
answer count: 2
downvote count: 0
tagged with: spring-aop
possible better answer: http://stackoverflow.com/a/27333019
has answer: http://stackoverflow.com/a/27333019
favorite count: 0

http://stackoverflow.com/q/27344418
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43144368
has answer: http://stackoverflow.com/a/27344455
tagged with: regex
has comment: http://stackoverflow.com/comment/43144186
has title: Splitting expression with String#split()
tagged with: java
has answer: http://stackoverflow.com/a/27344526
type: Question
has comment: http://stackoverflow.com/comment/43448891
has body: I want to convert a infix operation to postfix operation. My code works when the input is given as already split expression through an array. But it doesn't when the input is given as the raw String expression. String[] exp={"23","+","32"}//this works String str="23 + 32"; String[]exp=str.split("//s+" );//this doesn't work
score: 0
answer count: 2
tagged with: arrays
tagged with: string

http://stackoverflow.com/comment/43217267
type: QuestionComment
has text: Those are not methods but statements. You need to post the declaration of your method (function). And indeed: add a context to the parameters of your function.
score: 0
comment on: http://stackoverflow.com/q/27384225
type: Comment

http://stackoverflow.com/comment/43156315
type: Comment
has text: How does the spring-boot artifact relate to spring-boot-starter-web and spring-boot-starter-parent? Should it be in addition to these, or replace one or both?
comment on: http://stackoverflow.com/a/27350922
score: 1
type: AnswerComment

http://stackoverflow.com/q/27332328
type: Question
has comment: http://stackoverflow.com/comment/43123753
has comment: http://stackoverflow.com/comment/43123589
has comment: http://stackoverflow.com/comment/43123698
tagged with: project
tagged with: java
has body: (Eclipse Luna) Say I have the following "Project A": Project A a.b.c.package1 One.java Two.java Three.java a.b.c.package2 Four.java Five.java And I have another "Project B" that attempts to serve as an experimentation project that uses Project A as a dependency. So Project B depends upon Project A in the project settings. Project B looks like this: Project B x.y.z.package3 Main.java (which then uses many of the classes in project A, and Main.java contains application main() routine). This of course works fine. However, what if I want project B to experiment with changing a class from project A, and have it replace it entirely. Such as: Project B x.y.z.package3 Main.java a.b.c.package2 Four.java &lt;-----this is to replace the Four.java in Project A ....and have Project A's Four.java be completely ignored by everything so long as I'm "in" Project B. So if Five.java refers to Four.java, it actually is referring to Project B's Four, etc. Can this be done?
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43123533
has comment: http://stackoverflow.com/comment/43123782
has comment: http://stackoverflow.com/comment/43122435
has comment: http://stackoverflow.com/comment/43123503
downvote count: 0
answer count: 1
has answer: http://stackoverflow.com/a/27333423
has comment: http://stackoverflow.com/comment/43123932
favorite count: 0
has comment: http://stackoverflow.com/comment/43123639
tagged with: projects-and-solutions
has title: In eclipse, how to have one project override class files of another project
has comment: http://stackoverflow.com/comment/43123749
score: 2
type: AnsweredQuestion
upvote count: 2
tagged with: eclipse-luna
accepted answer: http://stackoverflow.com/a/27333423
has comment: http://stackoverflow.com/comment/43122267
has comment: http://stackoverflow.com/comment/43123850

http://stackoverflow.com/a/27387916
answers question: http://stackoverflow.com/q/27387547
type: Answer
has body: By the nature of arrays/matrices, you will probably want to use loops. In your problem, you could use one loop to traverse down rows of the matrix. To fill the columns you might use another loop. Some pseudocode might look like for (int i = 0; i &lt; matrix.Rows; i++) //standard indexing loop var pattern = determinePrintingPattern(row) print(pattern) In your problem in particular, it looks like the printing of dots happens in 6 groups of 4, with decreasing dots every even row. So function returnPattern determinePrintingPattern(int row) //might look like pseudocoded for 6 iterations print 4 - row/2 dots //integer division is desirable and will truncate (drop the decimal)
score: 0

http://stackoverflow.com/comment/43153230
type: QuestionComment
has text: No nothing in the manifest file. If i very simply create a new project the first is perfect by default, if I add a second activity and dont edit anything immediately I receive errors with anything related to R without manipulating any code in the second activity
score: 0
comment on: http://stackoverflow.com/q/27347365
type: Comment

http://stackoverflow.com/a/27402014
type: Answer
has body: To Send the data, use the following lines of code: Bundle bundle = new Bundle(); bundle.putString("KEY", "VALUE"); // set Fragmentclass Arguments Fragmentclass fragobj = new Fragmentclass(); fragobj.setArguments(bundle); And in order to recieve a data use this: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { String strtext = getArguments().getString("KEY"); return inflater.inflate(R.layout.fragment, container, false); } Hope this helps.
score: 0
answers question: http://stackoverflow.com/q/27400366

http://stackoverflow.com/comment/43114745
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27327801
has text: OK! Solved it! My home network's router needs some configuring. Probably need to forward a port or something. This isn't something I need to do (and it's possibly not my router cough) so let's consider this solved! THANKS

http://stackoverflow.com/q/27399706
has body: May you describe allocating and deallocating memory to a static method when I called it? public class Class1 { public static ArrayList&lt;String&gt; method1(Context context) { // some variables return new ArrayList&lt;String&gt;(); } } I've wrote a simple sample of Static method in Class1 that invoked in a service that works indefinitely! Now I want to know whether this method removed from memory by the garbage collector? I've studied about static variables, That once class loader remove from memory, static variables will removed. But what about methods? Sorry, I know that my question is not clear, But my mean is in title. public class TestService extends IntentService { public TestService() { super("test"); } @Override protected void onHandleIntent(Intent intent) { while(true){ Class1.method1(this); } } }
tagged with: android
has answer: http://stackoverflow.com/a/27399769
accepted answer: http://stackoverflow.com/a/27399769
type: AnsweredQuestion
tagged with: memory-management
tagged with: java
type: Question
has title: Allocate and deallocate memory to static method
score: 0
answer count: 1
tagged with: static

http://stackoverflow.com/q/27338670
has comment: http://stackoverflow.com/comment/43143950
type: AnsweredQuestion
has title: C3P0 Managed connection pool could not acquire a resource from its primary or factory resource
downvote count: 0
score: 1
linked to: http://stackoverflow.com/q/27338535
favorite count: 0
has body: I am using Postgresql as my underlying Database and and letting Spring managed my DataSource/Connection pool. The configuration I have is this ${hibernate.sql.dialect} ${hibernate.connection.pool_size} true org.hibernate.connection.C3P0ConnectionProvider org.postgresql.Driver true 5 15 300 50 3000 SCHEMA org.myproj.hibernate.SchemaResolver org.myproj.hibernate.MultitenantConnectionProvider However, whenever I am booting up my application this log message appears. Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@88f0b8ea [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@ce8fda44 [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, debugUnreturnedConnectionStackTraces -> false, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1hge0yw969iurgbvtwis0|6ee5f485, idleConnectionTestPeriod -> 3000, initialPoolSize -> 5, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 300, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 15, maxStatements -> 50, maxStatementsPerConnection -> 0, minPoolSize -> 5, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@ce2ef138 [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> 1hge0yw969iurgbvtwis0|ccd341d, jdbcUrl -> null, properties -> {} ], preferredTestQuery -> null, propertyCycle -> 0, statementCacheNumDeferredCloseThreads -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false; userOverrides: {} ], dataSourceName -> null, factoryClassLocation -> null, identityToken -> 1hge0yw969iurgbvtwis0|53eba4b8, numHelperThreads -> 3 ] I believe…
type: Question
accepted answer: http://stackoverflow.com/a/27368718
tagged with: spring
has comment: http://stackoverflow.com/comment/43136721
has comment: http://stackoverflow.com/comment/43139150
has comment: http://stackoverflow.com/comment/43137592
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/43138829
has comment: http://stackoverflow.com/comment/43137423
upvote count: 1
answer count: 1
tagged with: c3p0
has answer: http://stackoverflow.com/a/27368718
has comment: http://stackoverflow.com/comment/43143954
tagged with: postgresql

http://stackoverflow.com/comment/43287235
has text: override isSelected for JButton, rest of [important for success, methods are here](http://stackoverflow.com/a/7919280/714968)
comment on: http://stackoverflow.com/q/27422421
type: Comment
type: QuestionComment
score: 0

http://stackoverflow.com/comment/43374699
type: Comment
type: QuestionComment
has text: I think this is the wrong approach. The autocomplete stuff isn't intrinsic to a text area or anything else; it's something that builds off a chunk of text, e.g., it builds off of keyboard events, regardless of what's consuming those keypresses. You might want to check out implementations in things like jedit or the autocomplete component of rsyntaxtextarea, https://github.com/bobbylight/AutoComplete
score: 1
comment on: http://stackoverflow.com/q/27469655

http://stackoverflow.com/a/27328313
has body: In your while loop, check to see if the line starts with what you care about. For example, while ((line = in.readLine() != null) { if (line.startsWith("ssl_amount") { Receipt.receText.append(line + "\n"); System.out.println(line); } }
answers question: http://stackoverflow.com/q/27328165
score: 0
type: Answer

http://stackoverflow.com/q/27354648
score: 1
favorite count: 0
has comment: http://stackoverflow.com/comment/43162726
has comment: http://stackoverflow.com/comment/43164247
answer count: 0
type: UnansweredQuestion
upvote count: 1
tagged with: web-services
has body: I am trying to build simple webservices using Java, Rest Webservices(Jersey), Glass fish. project is successfully deploying in server without any errors, but when i access resources in browser it is giving 404-Not Found Error. My resources class: package org.student.services; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; @Path("/ConversionService") public class FeetToInchAndInchToFeetConversionService { @GET @Path("/InchToFeet/{i}") @Produces(MediaType.TEXT_XML) public String convertInchToFeet(@PathParam("i") int i) { int inch=i; double feet = 0; feet =(double) inch/12; return " " + " " + inch + " " + " " + feet + " " + " "; } @Path("/FeetToInch/{f}") @GET @Produces(MediaType.TEXT_XML) public String convertFeetToInch(@PathParam("f") int f) { int inch=0; int feet = f; inch = 12*feet; return " " + " " + feet + " " + " " + inch + " " + " "; } } And Web.xml is: <?xml version="1.0" encoding="UTF-8"?> StudentPortal Jersey REST Service org.glassfish.jersey.servlet.ServletContainer jersey.config.server.provider.packages org.student.services 1 Jersey REST Service /rest/* using following Url with https// mylocalhost:port/StudentPortal/rest/ConversionService/InchToFeet/2 Please Someone point what i am doing wrong
tagged with: java
type: Question
tagged with: jersey
downvote count: 0
has title: Not able Publish RestFul webservices Using Jersey
has comment: http://stackoverflow.com/comment/43162525

http://stackoverflow.com/comment/43199820
has text: @FereRes Just extract it with 7Zip for example.
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27374643
type: AnswerComment

http://stackoverflow.com/comment/43162648
has text: @OliverCharlesworth Discovery of nodes is `O(n)`, trying to find all different paths using DFS is not that simple, you are going to revisit "closed" nodes, since you need to create ALL paths.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27354375

package
tags question: http://stackoverflow.com/q/27359359
tag name: package
tags question: http://stackoverflow.com/q/27319680
type: Tag
tags question: http://stackoverflow.com/q/27343268
tags question: http://stackoverflow.com/q/27355727
tags question: http://stackoverflow.com/q/27367355

backend
tags question: http://stackoverflow.com/q/27342460
type: Tag
tag name: backend

http://stackoverflow.com/comment/43208827
comment on: http://stackoverflow.com/q/27379734
score: 0
has text: Doesn't hibernate do this for me? I thought the cascade type "persist" is there to do this?
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27372819
has comment: http://stackoverflow.com/comment/43199346
favorite count: 0
possible better answer: http://stackoverflow.com/a/27473201
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/27473201
tagged with: jdbc
has comment: http://stackoverflow.com/comment/43197217
has answer: http://stackoverflow.com/a/38822587
tagged with: java
tagged with: etl
answer count: 3
has answer: http://stackoverflow.com/a/27372968
has comment: http://stackoverflow.com/comment/43196586
has title: Building high volume batch data processing tool in Java
has body: I am trying to build an ETL tool using Java. ETL tools are for doing batch read, write, update operations on high volume of data (both relational and other kind). I am finding it difficult to choose right framework/tool to accomplish this task. A simplified Typical Use Case: Establish a connection with a database (source) Read 1 million records joining two tables Establish a connection with another database (target) Update/write those 1 million records in the target database My Choices: Use plain JDBC. Build a higher level API using JDBC to accomplish the tasks of connecting, reading and writing data to and from databases. Use some framework like Spring or Hibernate. I have never used these frameworks. I think Hibernate is for ORM purposes, but mine not a ORM kind of requirement. Spring may have some batch processing things but I wonder whether the effort to learn that is actually less than doing it myself as in my option 1. Any other option/ framework? which one among above is best suited for me? Considerations I need to choose an option that can give me high level of performance. I won't mind complexity or losing flexibility in favor of more performance. I don't already know any of the frameworks like Spring etc. I only know core Java. Of late, I have done lot of googling but will appreciate if you can provide me some "first hand" opinion.
score: 2
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27372968
downvote count: 0
has comment: http://stackoverflow.com/comment/43196699

http://stackoverflow.com/a/27455203
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27455114
score: 1
has comment: http://stackoverflow.com/comment/43348834
has comment: http://stackoverflow.com/comment/43348808
has comment: http://stackoverflow.com/comment/43348903
downvote count: 0
has body: The problem is related to this section: while(rs.next()){ // ... other code if(name.getText().equals(authorname)) txt.setText(data); else txt.setText("no matches"); If the value of name.getText() is not found in your database, rs.next() will never return true. Since you've enclosed your if block inside of the while loop, it will never be executed if no match is found in your database. You could solve it a number of ways, one way is to do something like this instead: boolean has_results = rs.next(); if(has_results){ do { // ... your loop code }while(rs.next()); }else { text.setText("No Matches"); } In this code, if the first call to rs.next() returns false, we know nothing we returned from the database. Otherwise, loop as normal. In this instance, I changed the loop to a post-checking do...while loop instead, since we want to check rs.next() at the end of the loop now. Note: This answer demonstrates another way of checking whether the result set contains rows.
has comment: http://stackoverflow.com/comment/43349007

http://stackoverflow.com/comment/43112938
comment on: http://stackoverflow.com/a/27326959
score: 0
type: AnswerComment
has text: PS: variable names, in Java standards, starts with lower case.
type: Comment

http://stackoverflow.com/comment/43344728
type: Comment
comment on: http://stackoverflow.com/a/27453121
type: AnswerComment
has text: If `init()` starts a new thread or shares its `this` reference with another class that may access the reference from another thread, you should _not_ call it in the constructor. If you do, you'll have a data race.
score: 0

http://stackoverflow.com/comment/58373494
score: 1
has text: Check your `.xml` files for any type of errors. I was using a `drawable` file which is deleted from `drawable` folder.
comment on: http://stackoverflow.com/a/30864068
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/44188149
has text: @Rohit did Red Hat provide any useful information other than to downgrade?
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27524224
type: Comment

http://stackoverflow.com/q/27387999
answer count: 1
type: UnansweredQuestion
has title: Error when deploying Java app to Heroku using maven
has body: I have a Java web app made in Eclipse and I'm using maven. It works fine on localhost (Apache Tomcat). When I try to deploy to Heroku using this guide I get the following error (DEBUG enabled). It seems very obscure because google finds next to nothing. [ERROR] Failed to execute goal com.heroku.sdk:heroku-maven-plugin:0.1.9:deploy-war (default-cli) on project tours: Failed to deploy application: There was an exception invoking the remote service: HTTP(403): Server returned HTTP response code: 403 for URL: https://api.heroku.com/apps/tours/config-vars -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.heroku.sdk:heroku-maven-plugin:0.1.9:deploy-war (default-cli) on project tours: Failed to deploy application at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:108) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213) at org.apache.maven.cli.MavenCli.main(MavenCli.java:157) 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.codeha…
tagged with: maven
has comment: http://stackoverflow.com/comment/43293314
tagged with: heroku
linked to: http://stackoverflow.com/q/7048216
tagged with: java
has comment: http://stackoverflow.com/comment/43271764
tagged with: eclipse
has comment: http://stackoverflow.com/comment/43258594
type: Question
has answer: http://stackoverflow.com/a/27429869
score: 0
has comment: http://stackoverflow.com/comment/43269340

http://stackoverflow.com/a/27429874
has comment: http://stackoverflow.com/comment/43301631
accepted answer of: http://stackoverflow.com/q/27429806
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43300990
has comment: http://stackoverflow.com/comment/43301053
type: Answer
has body: There are 33 columns in this insert statement. There are 33 values -- 28 ? place holders and 5 literal values (sysdate). The indexes in the setXYZ methods refer to the index of the ? placeholders, not the index into the values of the insert statement. For the sysdate values, you don't need to do anything, so remove those calls to setDate. But for values beyond the first 4 sysdates, you just need to use the next value, which is 13, not 17. prpstmt.setInt(1, randomNumberGenerator()); // snip prpstmt.setInt(12, 8); // calls to `setDate(13-16, getCurrentDate());` removed prpstmt.setInt(13, 43); // changed 17 to 13 // snip prpstmt.setInt(28, 2); // changed 32 to 28 What is sysdate? sysdate is an Oracle function that returns the current date/timestamp, equivalent to Calendar.getInstance() in Java. For the purposes of JDBC, it's a value that is already supplied in the insert statement.
upvote count: 1
has comment: http://stackoverflow.com/comment/43301063
score: 1
answers question: http://stackoverflow.com/q/27429806

http://stackoverflow.com/comment/43200246
type: Comment
comment on: http://stackoverflow.com/a/27358509
has text: Hi Emre, try reducing the first sleep to 1sec and adding another sleep(6s) after the file.close
score: 0
type: AnswerComment

http://stackoverflow.com/q/27339609
has answer: http://stackoverflow.com/a/27339643
tagged with: user-input
downvote count: 1
has body: I want my user to keep inputting employee numbers until the user inputs -1, which stops the loop. But my code keeps printing the inputted numbers and won't ask another question. System.out.println("Which employee number do you want to see --&gt;"); index = myScanner.nextInt(); while (payData.getOneEmpNum(index) != -1) { if (payData.getOneEmpNum(index) &gt;= 0) { System.out.printf("Sequential found employee #%d ",payData.getOneEmpNum(index)); System.out.printf("and the pay rate is $%.2f.\n ", payData.getPayRate(index)); System.out.printf("Binary found employee #%d ",payData.getOneEmpNum(index)); System.out.printf("and the pay rate is $%.2f.\n ", payData.getPayRate(index)); } else { System.out.println("Invalid employee number!"); } System.out.println("Which employee number do you want to see --&gt;"); }
type: AnsweredQuestion
has title: Keep asking user to input data, stuck in endless loop
tagged with: java
accepted answer: http://stackoverflow.com/a/27339643
score: -1
possible better answer: http://stackoverflow.com/a/27339645
type: Question
has answer: http://stackoverflow.com/a/27339645
upvote count: 0
has comment: http://stackoverflow.com/comment/43135666
favorite count: 0
has comment: http://stackoverflow.com/comment/43135729
tagged with: while-loop
answer count: 3
has answer: http://stackoverflow.com/a/27339658

http://stackoverflow.com/q/27465957
has title: Null Pointer Excpetion when trying to test if array is empty java
has body: I was tyring to test if my array is empty, but I always get a null pointer exception for some reason. I don't understand since my test actually test if the value is null. Here is the code where it gets stucks. I get the null pointer on the While loop: private int findIndex(String key) { int index = calculateHashCode(key); while (table[index] != null &amp;&amp; !table[index].getKey().equals(key)) { index = (index + 1) % TABLE_SIZE; } return index; } EDIT table is declared like this: static HashEntry[] table;
tagged with: arrays
has answer: http://stackoverflow.com/a/27465972
has comment: http://stackoverflow.com/comment/43367968
score: 0
tagged with: nullpointerexception
answer count: 3
has answer: http://stackoverflow.com/a/27465976
accepted answer: http://stackoverflow.com/a/27465976
possible better answer: http://stackoverflow.com/a/27465972
has answer: http://stackoverflow.com/a/27466026
type: AnsweredQuestion
tagged with: java
type: Question

http://stackoverflow.com/a/27489282
has body: As people said, your story looks like a story of asynchronous execution which really can be implemented using a standard JMS container, for example. But if you'd like to insist on your own solution: Try to decrease contention. Use lock on User object to fetch and process its requests instead of lock on a processor. Use SELECT FOR UPDATE if your DBMS supports it to lock a user in "user" table before a request of this user is being processed. This moves synchronization from java code to DB level and still has significant cost. Or try to rid off the locks at all. Share user data among N threads when each thread processes data for a given subset of users. Let's say, the first thread processes requests of users A-F, second one for users G-L etc. Use any reasonable static/dynamic rule. Also, since JDBC connection isn't thread-safe, each thread should establish and hold its own instance of connection. As result, you don't have a critical section at all, since you don't have any data shared among any threads and this may work even faster than an "out of the box" JMS setup, since you manage all the process and you don't have any "generic" code. And finally, check your JDBC code, please: make sure you use PreparedStatement, batch processing and appropriate isolation level for transactions.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27358881

http://stackoverflow.com/comment/43148536
type: Comment
has text: Are you running `setContentView(R.layout.Activity_Second)` in your second activity?
comment on: http://stackoverflow.com/q/27346721
score: 0
type: QuestionComment

http://stackoverflow.com/comment/119536752
comment on: http://stackoverflow.com/a/27409673
type: Comment
has text: @MartinF It is possible to leak handlers where close/shutdownXXX won't get called. I don't want a dangling thread to hold up shutdown of the JVM. I'm not using the executor with a custom queue because that wraps every log record in a FutureTask + Callable. Why not just post a competing answer?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43131711
comment on: http://stackoverflow.com/q/27337480
has text: no, a direction to make the change from pulling in a file, to using a string.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43149496
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27345789
has text: oh sorry,Sir, you will see an arrow right beneath my answer score, tick that, and it will be accepted, and you gain +2 rep(s)

http://stackoverflow.com/comment/43111549
type: Comment
type: AnswerComment
comment on: http://stackoverflow.com/a/27325480
score: 0
has text: System.out.println("Do you want to fire another shot? (Y/N)"); input = keyboard.nextLine(); answer = input.charAt(0); The error is that the string index is out of range

http://stackoverflow.com/q/27340619
answer count: 0
downvote count: 0
favorite count: 0
has comment: http://stackoverflow.com/comment/43138586
type: Question
upvote count: 2
tagged with: exception
has comment: http://stackoverflow.com/comment/43194780
has title: lwjgl java.lang.NoClassDefFoundError
tagged with: java
tagged with: lwjgl
has body: The program successfully extracts the jars to the folder /home/ty/gopro2027game/lib/jars/ and the natives to /home/ty/gopro2027game/lib/jars/. The program also, first thing besides copying the files, runs this: System.setProperty("java.library.path", Game.gameFolder+"/lib/jars"); System.setProperty("org.lwjgl.librarypath", new File(Game.gameFolder+"/lib/natives").getAbsolutePath()); System.out.println(System.getProperty("java.library.path")); System.out.println(System.getProperty("org.lwjgl.librarypath")); The println's show the right folder for the files too. But i get this error when ran (this is all after exporting the program): Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException at com.gopro2027.lwjgl.Start.Solo(Start.java:144) at com.gopro2027.lwjgl.Start.main(Start.java:55) Caused by: java.lang.ClassNotFoundException: org.lwjgl.LWJGLException at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) ... 2 more I do not know how this is happening and i don't want to go back to jarmatey. Thanks- Tyler
has comment: http://stackoverflow.com/comment/43183799
has comment: http://stackoverflow.com/comment/127472501
type: UnansweredQuestion
score: 2

http://stackoverflow.com/q/27410581
has comment: http://stackoverflow.com/comment/43265962
answer count: 1
has comment: http://stackoverflow.com/comment/43265709
has comment: http://stackoverflow.com/comment/43265931
tagged with: dto
tagged with: dao
has title: Is it ok to pass interface of DTO to DAO
upvote count: 1
has comment: http://stackoverflow.com/comment/43265536
favorite count: 0
downvote count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43267310
has comment: http://stackoverflow.com/comment/43265800
has answer: http://stackoverflow.com/a/51429405
has body: It's about passing interface of DTO to DAO. For example I have following code public interface User { String getName(); } public class SimpleUser implements User { protected String name; public SimpleUser(String name) { this.name = name; } @Override public String getName() { return name; } } // Mapped by Hibernate public class PersistentUser extends SimpleUser { private Long id; // Constructor // Getters for id and name // Setters for id and name } I'm using generic DAO. Is it ok if I create DAO with using interface User instead PersistentUser? User user = new PersistentUser(name); UserDao.create(user); I read a lot of topics on stack but not figured out is this approach ok or no. Please help me. Maybe this is stupid and I can achive only problems. About separating beans. I did this because some classes I want to share via API module, that can be used outside to create entities and pass them to my application. Because they uses interface I developed so I can pass them to my DAO for persisting.
has comment: http://stackoverflow.com/comment/43267406
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/43267178
type: Question

http://stackoverflow.com/a/27487345
has body: I resolved my problem. Here is my approach based on standard SAX parsing. 1) Created custom SaxHandler: ` public class CustomSAXHandler extends DefaultHandler { private Stack&lt;XmlNodeInfo&gt; nodeStack = new Stack&lt;XmlNodeInfo&gt;(); private List&lt;String&gt; xPaths; private XmlNodeInfo rootNode; private final NamespaceContext namespaceContext; private List&lt;XmlNodeInfo&gt; resultNodes; public CustomSAXHandler(String xpath, XmlNodeInfo rootNode, NamespaceContext namespaceContext) { this.rootNode = rootNode; this.namespaceContext = namespaceContext; resultNodes = new ArrayList&lt;XmlNodeInfo&gt;(); xPaths = splitXpaths(xpath); } @Override public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { String element = "&lt;" + qName + getAttributes(atts) + "&gt;"; if (!nodeStack.empty()) { rootNode = nodeStack.peek(); } if (matchDefinedXpath(qName)) { XmlNodeInfo newNode = new XmlNodeInfo(qName); rootNode.addChild(newNode); nodeStack.push(newNode); newNode.getHeader().append(element); } else { if (!nodeStack.empty()) { nodeStack.peek().getBody().append(element); } } } @Override public void characters(char[] ch, int start, int length) throws SAXException { XmlNodeInfo currentNode = nodeStack.empty() ? null : nodeStack.peek(); if (currentNode != null) { currentNode.getBody().append(new String(ch, start, length)); } } @Override public void endElement(String namespaceURI, String localName, String qName) throws SAXException { String finalElement = xPaths.get(xPaths.size() - 1); String element = "&lt;/" + qName + "&gt;"; XmlNodeInfo currentNode = nodeStack.empty() ? null : nodeStack.peek(); if (currentNode != null) { if (qName.equals(finalElement) &amp;&amp; nodeStack.size() == xPaths.size()) { currentNode.getFooter().append(element); resultNodes.add(currentNode); nodeStack.pop(); } else { if (currentNode.getName().equals(qName)) { currentNode.getFooter().append(element); nodeStack.pop(); } else { currentNode.getB…
type: Answer
has comment: http://stackoverflow.com/comment/43466971
has comment: http://stackoverflow.com/comment/43490752
score: 0
answers question: http://stackoverflow.com/q/27442046

http://stackoverflow.com/comment/96751316
type: Comment
comment on: http://stackoverflow.com/a/27379155
has text: Can we use this for images or video compare?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43278361
type: Comment
type: QuestionComment
has text: Thanks a lot Azureforg!- it works finally!. I still haven't understood the logic behind that. Why it says the file exists? and Why it's not removed from Hadoop once I remove it?
comment on: http://stackoverflow.com/q/27412437
score: 0

http://stackoverflow.com/comment/43096786
score: 1
comment on: http://stackoverflow.com/q/27318596
type: QuestionComment
has text: I strongly suggest you compile *often*. That way you'll be able to find errors as you go along, which makes it much easier to work out what's caused them. When you don't compile until you've built up a whole *load* of problems, it can be much harder to fix them.
type: Comment

http://stackoverflow.com/a/27371808
score: 0
answers question: http://stackoverflow.com/q/27371143
type: Answer
has body: If you can extract data from html and convert it to json then you can use following jsfiddle code to create csv from json. [jsfiddle]: http://jsfiddle.net/JXrwM/1801/ "Stack Overflow"

http://stackoverflow.com/comment/43340856
score: 0
type: AnswerComment
has text: So when I go to stop it, should I set the instance to the server = null? Or set `thread = null`?
comment on: http://stackoverflow.com/a/27451024
type: Comment

http://stackoverflow.com/q/27340189
tagged with: http://stackoverflow.com/tag/xml
type: AnsweredQuestion
upvote count: 0
accepted answer: http://stackoverflow.com/a/27340198
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27340198
score: -1
tagged with: eclipse
answer count: 1
downvote count: 1
favorite count: 0
tagged with: android
has title: App installed on device but doesent show up
has body: Hi,Im new to android development and wrote a simple code to run a simple application.But when i run it on the emulator or on my device,the console window says that the app has successfully installed but nothing opens up on my emulator or phone.can u plz suggest a possible way of solving this problem. Manifest File <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="17" /> activity_main <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.firstapp.MainActivity" > <requestFocus android:layout_width="wrap_content" /> <ImageView android:id="@+id/imageView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_above="@+id/editText4" android:layout_centerHorizontal="true" android:layout_marginBottom="36dp" android:src="@drawable/robo" android:contentDescription="@null"/> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </RelativeLayout>
tagged with: android-manifest

http://stackoverflow.com/comment/43186186
score: 0
type: Comment
type: QuestionComment
has text: Could you post the layout of your fragment? The error from logcat signifies a mismatch between layout and fragment.
comment on: http://stackoverflow.com/q/27365596

http://stackoverflow.com/a/27330752
type: AcceptedAnswer
downvote count: 0
has body: First you should get the object InputStream to do your need. S3Object object = s3Client.getObject(new GetObjectRequest(bucketName, key)); InputStream objectData = object.getObjectContent(); Pass the InputStream, File Name and the path to the below method to download your stream. public void saveFile(String fileName, String path, InputStream objectData) throws Exception { DataOutputStream dos = null; OutputStream out = null; try { File newDirectory = new File(path); if (!newDirectory.exists()) { newDirectory.mkdirs(); } File uploadedFile = new File(path, uploadFileName); out = new FileOutputStream(uploadedFile); byte[] fileAsBytes = new byte[inputStream.available()]; inputStream.read(fileAsBytes); dos = new DataOutputStream(out); dos.write(fileAsBytes); } catch (IOException io) { io.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (out != null) { out.close(); } if (dos != null) { dos.close(); } } catch (IOException e) { e.printStackTrace(); } } } After you Download your object read the file and make it to JSON and write it to .txt file after that you can upload the txt file to the desired bucket in S3
has comment: http://stackoverflow.com/comment/80768780
has comment: http://stackoverflow.com/comment/56644808
type: Answer
answers question: http://stackoverflow.com/q/27318587
has comment: http://stackoverflow.com/comment/43127245
accepted answer of: http://stackoverflow.com/q/27318587
score: 12
upvote count: 12

http://stackoverflow.com/a/27445744
answers question: http://stackoverflow.com/q/27445665
type: Answer
has body: As far as functionality is concerned, both promise a (pseudo-)randomly distributed int in the range of [0..255]. The implementation specifics (e.g., the PRNG algorithm used) may be different, but you really shouldn't rely on those anyway.
upvote count: 1
downvote count: 0
score: 1

http://stackoverflow.com/comment/43167808
type: Comment
comment on: http://stackoverflow.com/q/27357702
type: QuestionComment
has text: How do you get the list of occupied cells and why can't a similar process get you a list of unoccupied cells?
score: 0

http://stackoverflow.com/q/27463989
tagged with: animation
has comment: http://stackoverflow.com/comment/43364194
tagged with: swing
linked to: http://stackoverflow.com/q/14540080
downvote count: 1
has title: Java: Moving jLabel twice using Timer
type: AnsweredQuestion
has body: I work on jFrame project: I have jlabel I want to move it in animation, and then move another jlabel in other words, I want the first jlabel to move and then when it finished,the second jlabel moves. I've already tried and didn't succeed. I have a function to move one jlabel and ifIi try to use it on both jlabels, both jlabels move at the same time, and I don't want this to happen. Can you help me do it, thank you so much. Here is the function that I have : public void MoveForPlayer(JLabel PlayerCard) { int delay = q; ActionListener taskPerformer = new ActionListener() { int count=0; @Override public void actionPerformed(ActionEvent evt) { if(count==20) { ((Timer)evt.getSource()).stop(); } PlayerCard.setLocation((PlayerCard.getLocation().x-5), PlayerCard.getLocation().y+5); count++; } }; new Timer(delay, taskPerformer).start(); }
score: 1
tagged with: java
accepted answer: http://stackoverflow.com/a/27466801
type: Question
has comment: http://stackoverflow.com/comment/43364700
answer count: 2
tagged with: delay
favorite count: 0
has answer: http://stackoverflow.com/a/27464089
has answer: http://stackoverflow.com/a/27466801
possible better answer: http://stackoverflow.com/a/27464089
tagged with: timer
upvote count: 2

http://stackoverflow.com/comment/43381528
score: 0
has text: @Zy0n Connection refused means the server is not listening on the port you are trying to connect to.
type: Comment
comment on: http://stackoverflow.com/a/27473226
type: AnswerComment

http://stackoverflow.com/q/27366096
tagged with: loops
downvote count: 1
type: Question
has body: For example i have an array with names: int n = numberofplayers(); //declaring number of players String[] myarray = new String[n]; //declaring array with players in game for (int i=0;i&lt;n;i++){ myarray[i] = JOptionPane.showInputDialog("Give me the names of players"); } I dont know how to give specific number to each name,like: 1.Stefan 2.Oleg 3.Andrew
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/27366179
has comment: http://stackoverflow.com/comment/43184157
has comment: http://stackoverflow.com/comment/43184132
upvote count: 0
tagged with: arrays
has answer: http://stackoverflow.com/a/27366152
favorite count: 0
answer count: 3
has answer: http://stackoverflow.com/a/27366184
has comment: http://stackoverflow.com/comment/43184135
has comment: http://stackoverflow.com/comment/43184104
has title: How to give a number to array?
type: UnansweredQuestion

http://stackoverflow.com/a/27437535
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27437522
upvote count: 3
type: Answer
has body: You can use abstract class and implement some of the methods
score: 3
downvote count: 0
answers question: http://stackoverflow.com/q/27437522

http://stackoverflow.com/q/27326410
type: AnsweredQuestion
has title: Communicating Between Java SE and Java EE Applications
type: Question
tagged with: sockets
has body: I have two applications: a Java SE application and a Java EE application. The Java EE application is being run on a GlassFish server. I want to send data in the form of JSON from the Java SE application to the Java EE application. I want to do this with both programs running on the same computer. The JSON sent would basically identify the student_id, student_name, instructor_name, school_name, course_name, absent_days, tardy_days, and total_grade. On top of this I want the Java EE application to parse the JSON that is received and send it to a java db (derby) database table called reports. I have never done something like this before and I am confused in regard to how to go about it. I have been trying to figure out this general problem for over a month. Can someone please help me. 1. First of all, would I use a socket, HTTP POST Request, or combination of the two? 2. Where exactly in the Java EE program would I even place the code that receives the socket or POST request? JSON object to be sent from the Java SE application: {“student_id”: “123456789”, “student_name: “Bart Simpson”, “instructor_name”: “Professor Xavier”, “school_name”: “Xavier High School”, “course_name”: “Eng12Per1”, “absent_days_num”: “0”, “tardy_days_num”: “1”, “total_grade”: “92.5”}
has answer: http://stackoverflow.com/a/27326682
score: 0
tagged with: java
answer count: 1
tagged with: http
tagged with: post
accepted answer: http://stackoverflow.com/a/27326682
has comment: http://stackoverflow.com/comment/43111860

http://stackoverflow.com/comment/43230865
has text: My bad. I misinterpreted javax.crypto.Mac.getInstance(java.lang.String)
score: 0
comment on: http://stackoverflow.com/q/27390055
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43269276
has text: @Grasshopper Seems to be an issue with the energy control settings. [see this](http://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7)
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27412096
score: 0

http://stackoverflow.com/q/27430675
tagged with: amazon-s3
tagged with: java
has answer: http://stackoverflow.com/a/27432714
score: 4
has answer: http://stackoverflow.com/a/45048943
has comment: http://stackoverflow.com/comment/43302711
has title: How should I handle "java.net.SocketException: Connection reset" in multithread AWS S3 file upload?
has answer: http://stackoverflow.com/a/27799053
possible better answer: http://stackoverflow.com/a/27432714
has comment: http://stackoverflow.com/comment/43305452
tagged with: amazon-web-services
has comment: http://stackoverflow.com/comment/43305590
favorite count: 0
has comment: http://stackoverflow.com/comment/43305131
upvote count: 4
accepted answer: http://stackoverflow.com/a/27497606
answer count: 4
has body: I have a ThreadPoolExecutorService to which I'm submitting runnable jobs that are uploading large (1-2 GB) files to Amazon's S3 file system, using the AWS Java SDK. Occasionally one of my worker threads will report a java.net.SocketException with "Connection reset" as the cause and then die. AWS doesn't use checked exceptions so I actually can't catch SocketException directly---it must be wrapped somehow. My question is how I should deal with this problem so I can retry any problematic uploads and increase the reliability of my program. Would the Multipart Upload API be more reliable? Is there some exception I can reliably catch to enable retries? Here's the stack trace. The com.example.* code is mine. Basically what the DataProcessorAWS call does is call putObject(String bucketName, String key, File file) on an instance of AmazonS3Client that's shared across threads. 14/12/11 18:43:17 INFO http.AmazonHttpClient: Unable to execute HTTP request: Connection reset java.net.SocketException: Connection reset at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:118) at java.net.SocketOutputStream.write(SocketOutputStream.java:159) at sun.security.ssl.OutputRecord.writeBuffer(OutputRecord.java:377) at sun.security.ssl.OutputRecord.write(OutputRecord.java:363) at sun.security.ssl.SSLSocketImpl.writeRecordInternal(SSLSocketImpl.java:830) at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:801) at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:122) at org.apache.http.impl.io.AbstractSessionOutputBuffer.write(AbstractSessionOutputBuffer.java:169) at org.apache.http.impl.io.ContentLengthOutputStream.write(ContentLengthOutputStream.java:119) at org.apache.http.entity.InputStreamEntity.writeTo(InputStreamEntity.java:102) at com.amazonaws.http.RepeatableInputStreamRequestEntity.writeTo(RepeatableInputStreamRequestEntity.java:153) at org.apache.http.entity.HttpEntityWrapper.writeTo(HttpEntityWrapper.java:98) at org.apache.http.impl.client.Ent…
type: AnsweredQuestion
downvote count: 0
tagged with: multithreading
has comment: http://stackoverflow.com/comment/43418632
has answer: http://stackoverflow.com/a/27497606
type: Question

http://stackoverflow.com/comment/67296821
type: Comment
has text: This is long time ago and have upgraded Nexus several times since then to newer versions and haven't seen the problem since way back. Still I believe your "guess" (and proposed solution) is as good as anyone and I don't understand why you got a downvote.
comment on: http://stackoverflow.com/a/39994669
score: 0
type: AnswerComment

gradle-eclipse
tags question: http://stackoverflow.com/q/27318254
tag name: gradle-eclipse
type: Tag

http://stackoverflow.com/a/30093884
downvote count: 0
answers question: http://stackoverflow.com/q/27373390
has comment: http://stackoverflow.com/comment/48301008
upvote count: 3
has body: OMSVGTextElement element; private OMSVGSVGElement svgElement; svgElement = doc.createSVGSVGElement(); element=doc.createSVGTextElement(); element.getElement().setInnerText("link label"); //the label svgElement.appendChild(element); This should do.
has comment: http://stackoverflow.com/comment/48300800
type: Answer
score: 3

http://stackoverflow.com/q/27383467
has comment: http://stackoverflow.com/comment/43215998
has comment: http://stackoverflow.com/comment/43217367
has comment: http://stackoverflow.com/comment/43216473
has answer: http://stackoverflow.com/a/27383534
type: Question
has body: I try to execute this in java: Process p = Runtime.getRuntime().exec(execString); execString is something like that: String execString = "/path/to/program.jar -e embedded " + jsonString; If I have "jsonString" like that: /path/to/jsFile.json everything works well. But in my Java-program I have a jsonstring which is a jsonObject.toString() and I would like to give this as input to the program.jar without saving it as file. Is this possible? Thank you very much!
tagged with: java
score: 0
answer count: 1
tagged with: exec
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43215631
has title: execute command in Java and faking input file as object

http://stackoverflow.com/q/27459682
has answer: http://stackoverflow.com/a/27460743
has comment: http://stackoverflow.com/comment/43356202
has comment: http://stackoverflow.com/comment/43356035
has comment: http://stackoverflow.com/comment/43358126
type: AnsweredQuestion
upvote count: 2
has body: Following this I have a JAVA code to do sudo -l, but it always hung. Btw, regardless if I use Reader stdOut = new InputStreamReader (p.getInputStream ()) or Reader stdOut = new InputStreamReader (p.getErrorStream ()) The output "[sudo] password for john" seems wasn't read by my code. Where did come from? Here is my code Process p= Runtime.getRuntime ().exec (new String[] {"sudo", "-l"}); Reader stdOut = new InputStreamReader (p.getErrorStream ()); BufferedReader reader = new BufferedReader(stdOut); StringBuffer output = new StringBuffer(); String line = ""; while ((line = reader.readLine())!= null) { System.out.println("$$" + line); if (line.contains ("password")) { break; } } OutputStream stdIn = p.getOutputStream (); stdIn.write ("&lt;my password&gt;\n".getBytes ("US-ASCII")); stdIn.flush (); while ((line = reader.readLine())!= null) { System.out.println(line); }
type: Question
has answer: http://stackoverflow.com/a/27462214
accepted answer: http://stackoverflow.com/a/27460743
has title: Input to a process in JAVA always hung
tagged with: java
possible better answer: http://stackoverflow.com/a/27462214
answer count: 2
score: 2
downvote count: 0
linked to: http://stackoverflow.com/q/7456613
favorite count: 0
linked to: http://stackoverflow.com/q/18708087

http://stackoverflow.com/comment/43152439
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27348870
has text: first way i got : Array constants can only be used in initializers, but the second way works fine , thanks
type: AnswerComment

http://stackoverflow.com/comment/127470202
type: Comment
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27931676
has text: Warning: DSL element 'dexOptions' is obsolete and should be removed.

http://stackoverflow.com/q/27326459
downvote count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43181126
type: Question
has comment: http://stackoverflow.com/comment/43112002
upvote count: 1
answer count: 1
has title: How does Facebook Chat heads detect a home/menu press?
tagged with: android
has answer: http://stackoverflow.com/a/30711034
has body: I've been trying to implement a service that displays UI similar to how facebook chatheads work. I noticed that I can detect a backpress inside of the View but I am unable to detect home presses. I played around with the facebook chat head and I noticed that they're able to handle home presses and recent activity button presses seemlessly. I've read this post: Detect 'home button pressed' event in android service displaying a UI (similar to facebook chatheads) but it does not seem to help How do you detect it?
favorite count: 0
has comment: http://stackoverflow.com/comment/43181070
type: UnansweredQuestion
tagged with: facebook

http://stackoverflow.com/comment/43091778
type: Comment
type: QuestionComment
has text: +point for you can ask next question
comment on: http://stackoverflow.com/q/27315654
score: 0

http://stackoverflow.com/comment/43381322
type: QuestionComment
has text: This may not solve your problem... but how many listeners are you adding? With each call of window.move() you are adding a new anonymous listener, or?
comment on: http://stackoverflow.com/q/27473359
score: 0
type: Comment

http://stackoverflow.com/comment/43163760
comment on: http://stackoverflow.com/a/27354292
score: 0
type: Comment
has text: Yes Now I am getting desired Output.Thank You.I did it as s.substring(s.indexOf("A")+1, s.indexOf("B"))
type: AnswerComment

http://stackoverflow.com/q/27348315
tagged with: twitter
has answer: http://stackoverflow.com/a/40691881
type: Question
score: 5
has title: How to create a java application to read twitter feeds?
answer count: 1
favorite count: 0
upvote count: 5
type: UnansweredQuestion
has body: I want to create a small application that will access twitter api to read feeds using application level authentication only. I have read many docs over net and feeling extremely confused. I understand that twitter api needs OAth to authorize any application to get or write data from/into twitter. For getting the keys associated(consumer secret key) the dev apps page of twitter asks us to create a new app which I created to get the keys. Now I have some tutorials that say how to make a properties file to save those keys and start running the java application. The problem is even after following everything i am not able to run the application. Can anyone describe in a step by step method about creating a java application to read feeds, setting up all the configurations needed, creating and explaining all the steps needed to get the keys ? I am using twitter 4j.
downvote count: 0
tagged with: java

http://stackoverflow.com/q/27323627
has title: How do i get the image from my jlable to auto scale or resize to the size of the JLabel
downvote count: 1
type: Question
has body: Im trying to add an image to a JLabel and i have encountered a problem where the image is to big for the JLabel so I'm looking for a way to make the image automatically scale to the size of the JLabel. Here is my main body of code where i call up my GUImain class: public class Main { public static void main(String[] args) { int i = 0; int t = 0; int st = 0; int h = 0; Texts textObject = new Texts(); textObject.TextList(); Commands commandObject = new Commands(); commandObject.commands(); GUImain guiObject = new GUImain(); guiObject.displayGUI(); } } And here is the code for my GUImain class, i will only include one image button because there are allot of objects in my code. import java.awt.EventQueue; import java.awt.Graphics; import java.awt.Image; import java.awt.image.BufferedImage; import javax.swing.ImageIcon; import javax.swing.JFrame; import javax.swing.JButton; import javax.swing.JList; import javax.swing.JTextPane; import javax.swing.JLabel; import javax.swing.JTextArea; import javax.swing.JScrollBar; import javax.swing.JTextField; import javax.swing.JPanel; import javax.swing.border.TitledBorder; public class GUImain { private JFrame frame; private JTextField textField; private ImageIcon image1; public void displayGUI() { this.frame.setVisible(true); } //Launch the application. public static void main(String[] args) { GUImain window = new GUImain(); } //Create the application. public GUImain() { frame = new JFrame(); frame.setBounds(100, 100, 611, 471); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); ... JLabel lblHunger = new JLabel(); Image img2 = new ImageIcon(this.getClass().getResource("/Food.png")).getImage(); lblHunger.setIcon(new ImageIcon(img2)); lblHunger.setBounds(211, 58, 50, 50); panel.add(lblHunger); } } }
upvote count: 0
score: -1
tagged with: awt
has comment: http://stackoverflow.com/comment/43106728
tagged with: image
duplicate of: http://stackoverflow.com/q/19648833
has comment: http://stackoverflow.com/comment/43106882
linked to: http://stackoverflow.com/q/19648833
answer count: 1
favorite count: 0
tagged with: jlabel
has answer: http://stackoverflow.com/a/27323914
tagged with: swing
type: AnsweredQuestion
accepted answer: http://stackoverflow.com/a/27323914
tagged with: java
has comment: http://stackoverflow.com/comment/43106439

http://stackoverflow.com/comment/43283018
score: 0
type: QuestionComment
type: Comment
has text: http://stackoverflow.com/questions/3064423/java-easily-convert-array-to-set
comment on: http://stackoverflow.com/q/27414342

http://stackoverflow.com/comment/43356853
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27460053
has text: I didn't get what you mean to say. I have some jar files which are stored in another Eclipse project. I am giving the path of those jar files to this plugin. Am I doing something wrong?

http://stackoverflow.com/a/27368200
has body: I think I can see what your trying to do. --> It's kinda like your looking for Abstract Classes (like in C++ for example) but there's some confusion between whether to use something else such as 'Protocols' (as opposed to Java's 'Interface'). Instead... I suggest a slightly simpler solution: Create a Class with a Default Method that you then Override later in a Sub-Class First create the Super-Class with your Message Constants and Default Method class TestInterface { let MSG_1:Byte = 0x11; let MSG_2:Byte = 0x22; let MSG_3:Byte = 0x33; func getMessageType () -&gt; Byte { return 0 } } Then you can Extend the Super-Class and Override the MessageType Method class SecondInterface : TestInterface { override func getMessageType () -&gt; Byte { return MSG_2 } } (personally I think it's good practice to do cross-language experiments)
answers question: http://stackoverflow.com/q/27338052
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27338052
type: Answer
score: 1
upvote count: 1

http://stackoverflow.com/comment/43224242
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27387729
type: Comment
has text: FYI - the last for loop is just a check to make sure the matrix outputs what you would like, it does not actually help the code at all. If you like the answer, please accept as an answer and upvote :) Of course, if this is not what you intended, please let me know and I can change it

http://stackoverflow.com/q/27316537
type: Question
has title: Handling Dates in Java
has answer: http://stackoverflow.com/a/27316712
answer count: 1
score: 0
has comment: http://stackoverflow.com/comment/43093040
has comment: http://stackoverflow.com/comment/43092803
type: UnansweredQuestion
has body: I am new to java GUI I have a form for simple data input that saved to mySQL. Among the textboxes I have defined is dateOfBirth. In mySQL, the dateOfBirth column is type DATE. When I attempt to save my record, I get incompatible conversions. How Do I handle this? The Date fields are DOR and DOB. I tried to define a format : DateFormat df= new SimpleDateFormat("dd/MM/yyyy"); and also changed redefined the var DOR or DOB as String: String DOB = new String(); then when inserting into database, formatted the var like this: df.format(DOB) I still got the error: "Error: Cannot format given object as a Date". What to do? String query = "INSERT INTO members (MemberID,FamilyName,BaptismName,DateOfRegistration,DateOfBirth,FatherName,MotherName,gender,MemberType,Address,Residence,City,CreatedBy)" +"VALUES('"+memberID+"','"+familyName+"','"+baptismName+"','"+DOR+"','"+DOB+"','"+fatherName+"','"+motherName+"','"+gender+"','"+memberType+"','"+address+"','"+residence+"','"+city+"','"+operator+"')"; con.UpDate(query);
has comment: http://stackoverflow.com/comment/43093069
tagged with: java
tagged with: mysql

http://stackoverflow.com/a/27357476
accepted answer of: http://stackoverflow.com/q/27357423
has body: The short answer is that you almost certainly shouldn't be doing it. But if you really want to, then you can declare your variables as static. If you move this int i = 0; int t = 0; int st = 0; int h = 0; to the beginning, just after the class declaration, and change to static int i = 0; static int t = 0; static int st = 0; static int h = 0; then you'll find you can access them as globals, at least from inside this package. If you declare them public too, you'll be able to get to them from anywhere. But, really, you shouldn't do it like this at all. Have your public static void main() method create an instance of the class (Main m = new Main()) and then invoke some instance method on m. That instance method will be able to access non-static (instance) fields. Whenever you feel the need for a global, ask yourself whether it's an indication that your code isn't structured in the right way. Most of the time (not quite all of the time) when you think you want a global, you don't really. It will just make the structural problem worse.
type: Answer
answers question: http://stackoverflow.com/q/27357423
score: 4
upvote count: 4
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43167479

http://stackoverflow.com/a/58316469
answers question: http://stackoverflow.com/q/27343268
type: Answer
score: 2
downvote count: 0
has body: Yes, the "Package" is the folder
upvote count: 2

http://stackoverflow.com/a/27340382
type: Answer
answers question: http://stackoverflow.com/q/27340354
has body: prior to the for loop, initialize the variable ec: Scanner sc = new Scanner(System.in); int n= 0; int ec = 0, oc = 0;
score: 0

http://stackoverflow.com/comment/43242164
comment on: http://stackoverflow.com/q/27362923
score: 0
type: Comment
type: QuestionComment
has text: I just edited my post to put the getMotionActivityEngine and also what I'm doing before the getMotionData.

http://stackoverflow.com/q/27354476
tagged with: arrays
has answer: http://stackoverflow.com/a/27354672
favorite count: 0
has comment: http://stackoverflow.com/comment/86718308
has answer: http://stackoverflow.com/a/27354669
has comment: http://stackoverflow.com/comment/43161988
score: -3
has body: I am stuck and if someone can point me in the right direction would be fantastic. I have this code below and I need to add a method that returns the product of elements in the array. public class ArrayProduct { public static void main( String [] args ) { int [] intArray = { 1, 2, 3, 4, 5, 6 }; System.out.print( "The elements are " ); for ( int i = 0; i &lt; intArray.length; i++ ) System.out.print( intArray[i] + " " ); System.out.println( ); System.out.println( "The product of all elements in the array is " + arrayProduct( intArray ) ); } // Insert your code here } I'm just not sure of a way to solve this without completely changing the code all together!
linked to: http://stackoverflow.com/q/2680548
duplicate of: http://stackoverflow.com/q/2680548
type: UnansweredQuestion
downvote count: 3
tagged with: methods
tagged with: java
has comment: http://stackoverflow.com/comment/43161962
has title: Method that returns the product of elements in an integer array
type: Question
answer count: 2
tagged with: product
upvote count: 0

http://stackoverflow.com/q/27365258
has body: Have an app works perfectly on an emulator or my test phone, but when downloaded from google store keep getting a null pointer. The server either returns a "1" or "0", any idea what's wrong? java.lang.NullPointerException at com.mobile.donswholesale.Scan$7.onPostExecute(Scan.java:363) at com.mobile.donswholesale.Scan$7.onPostExecute(Scan.java:1) at android.os.AsyncTask.finish(AsyncTask.java:632) at android.os.AsyncTask.access$600(AsyncTask.java:177) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:645) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:146) at android.app.ActivityThread.main(ActivityThread.java:5748) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1291) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107) at dalvik.system.NativeStart.main(Native Method) here's line 363: protected void onPostExecute(String result) { ///This is line 363: if (result.trim().equals("1")) { Toast.makeText(Scan.this, getString(R.string.vin_exists), Toast.LENGTH_LONG) .show(); } else { StartBid(); } } }.execute(); } And here's the php that checks if a VIN exists: if (mysql_num_rows($VINexists) &gt; 0) { echo ("1"); }else{ echo ("0"); }
has comment: http://stackoverflow.com/comment/43216383
answer count: 1
score: 0
accepted answer: http://stackoverflow.com/a/27365540
tagged with: android
has comment: http://stackoverflow.com/comment/43216261
has title: Works on emulator and test but not on alpha test in google store
has comment: http://stackoverflow.com/comment/43215286
has comment: http://stackoverflow.com/comment/43212739
type: Question
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27365540

http://stackoverflow.com/comment/101402423
has text: @David, I'm sorry, I don't have experience with that one. If you find the answer, though, please leave another comment.
comment on: http://stackoverflow.com/a/50343572
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27445280
has body: You must convert you integer variables to strings before concatenating them. For example: c=""+a.tostring();
downvote count: 1
type: Answer
has comment: http://stackoverflow.com/comment/43330951
upvote count: 0
answers question: http://stackoverflow.com/q/27444564
score: -1

http://stackoverflow.com/q/27314742
score: 0
linked to: http://stackoverflow.com/q/27285446
has title: How can i map/parse similar Json in Jackson?
has comment: http://stackoverflow.com/comment/43090979
has comment: http://stackoverflow.com/comment/43093575
linked to: http://stackoverflow.com/q/27261958
has body: { "8028298d-ec50-4067-8286-feaa39bdba7b": { "DUMMY": null, "MaxVMs": "1", "priority": "2" }, "f35c95e4-4808-4232-b057-0ecfbf735136": { "instancetype": "m3.xlarge", "datastore": "IOPS EBS", "network": null, "datacenter": "us-east-1c", "region": null, "MaxVMs": "2", "priority": "3" } }
has comment: http://stackoverflow.com/comment/43090738
answer count: 0
type: UnansweredQuestion
tagged with: java
has comment: http://stackoverflow.com/comment/43094630
has comment: http://stackoverflow.com/comment/43090288
has comment: http://stackoverflow.com/comment/43092202
type: Question
tagged with: http://stackoverflow.com/tag/json
tagged with: jackson

http://stackoverflow.com/q/27409078
score: 0
answer count: 1
tagged with: string
favorite count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43262562
has title: adding characters using charAt in java is giving me the wrong sum
tagged with: java
has answer: http://stackoverflow.com/a/27409119
upvote count: 1
downvote count: 1
type: Question
has body: int x=(int)compressedText.charAt(one1+1); int y=(int)compressedText.charAt(one1+2); count=x+y; count1=(char)count; the craracter value for compressedText.charAt(one1+2) and compressedText.charAt(one1+1) are each equal to 1 but when I try to debug my code it says count is equal to 98.

http://stackoverflow.com/q/27317237
type: Question
accepted answer: http://stackoverflow.com/a/27317345
has title: How to Maven - Spring project put online?
tagged with: java
linked to: http://stackoverflow.com/q/15530886
tagged with: web-hosting
has body: The last few months I studied JavaEE. I've done several projects with complete functionality and working on localhost tomcat server. How to make a web application where I used Maven, Spring, MYSQL, Backbone ... put online. I know I need to charter a java hosting or a free, but do I need some extra settings and new files in my project Do I need a folder structure as it is copied to the public file on hosting or make a WAR file that is copied to the hosting?
possible better answer: http://stackoverflow.com/a/27317689
answer count: 2
has answer: http://stackoverflow.com/a/27317689
score: 0
has answer: http://stackoverflow.com/a/27317345
type: AnsweredQuestion
tagged with: web-applications
tagged with: maven
tagged with: spring

http://stackoverflow.com/comment/116543923
type: Comment
has text: This helped me solve an an issue I had when I tried to print a large-size array and the elements overlapped each other in the console.
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27375382

http://stackoverflow.com/comment/43260153
type: AnswerComment
type: Comment
score: 0
has text: Thanks, it solved my problem. I was thinking of this error as the real problem and not as a consequence. As I said above, I could only reproduce it changing the settings but it was not the real problem. In fact it worked until now this way so I did not think it was a problem from resources.
comment on: http://stackoverflow.com/a/27407092

http://stackoverflow.com/comment/43370334
type: AnswerComment
has text: Yeah. Keep in mind that in android, with streams/entities, there may still exist some situation where httpUrlconnection will be better for handling the wrapped stream. I would experiment with apache to find right 'entity'wrapper . Then if no work , back to httpUrlConn
type: Comment
comment on: http://stackoverflow.com/a/27460293
score: 0

http://stackoverflow.com/a/27321036
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/43102373
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27320870
type: Answer
has body: The problem with stopping the event processor from reading is that you introduce a race condition: What happens if the server sends an event right after you terminated the read? The "response" that you read would wind up being an event. The proper way to do this is to do all your reading, both events and responses, in one place and handle the responses like an event also. Right before you send a command, register a listener for the response, then send the command. When the reading thread sees a response, have it find the proper listener and notify it that the response has been received.
accepted answer of: http://stackoverflow.com/q/27320870

http://stackoverflow.com/comment/43202489
has text: can you post the complete stack trace and which JDBC Url is used (which might be the cause for your problem)
comment on: http://stackoverflow.com/q/27376192
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27351904
has comment: http://stackoverflow.com/comment/43157983
score: 0
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43158014
has body: I am writing an application that needs to write test to wherever the user has the cursor placed within their desktop environment. I am aware that I can accomplish this by simulating actual key presses with the Robot class; however, I am wondering if their is a more efficient way to do this. Is there any System output that I could just write to so that I don't need to simulate actual keypresses? Any thoughts?
linked to: http://stackoverflow.com/q/7745959
answer count: 0
type: UnansweredQuestion
has title: Simulating keyboard presses - Java

http://stackoverflow.com/comment/100898870
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/57194901
has text: Hi, welcome to SO! Please explain some more why this is relevant for this question. As it is currently written it's hard to say what you are refering to.

http://stackoverflow.com/comment/127952674
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/72407840
has text: You draw shapes on the largest possible `BufferedImage`. You then shrink the image to fit.

http://stackoverflow.com/comment/43320195
comment on: http://stackoverflow.com/q/27440191
has text: It seems your class TableEntryIterator doesn't implements Iterator.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27408902
type: AnsweredQuestion
tagged with: java
tagged with: orm
type: Question
tagged with: activeandroid
linked to: http://stackoverflow.com/q/23365021
has answer: http://stackoverflow.com/a/27409150
tagged with: sqlite
answer count: 1
downvote count: 0
favorite count: 0
score: 8
accepted answer: http://stackoverflow.com/a/27409150
upvote count: 8
has title: Attempt to invoke virtual method 'java.lang.Class java.lang.reflect.Field.getType()' on a null object reference
tagged with: android
has body: I'm using activeandroid in my android app. Everything works fine running a debug build while developing. After creating a release build of my project the app is now crashing. This happens on a Nexus5 with Android 5.0 aswell as on a Nexus 7 with Android 4.4.2. Here's the source code if you need to take a look! https://github.com/MetalMatze/Krautreporter Thanks! java.lang.RuntimeException: Unable to create application com.activeandroid.app.Application: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.reflect.Field.getType()' on a null object reference at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4521) at android.app.ActivityThread.access$1500(ActivityThread.java:144) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1339) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:135) at android.app.ActivityThread.main(ActivityThread.java:5221) at java.lang.reflect.Method.invoke(Native Method) at java.lang.reflect.Method.invoke(Method.java:372) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.reflect.Field.getType()' on a null object reference at com.activeandroid.e.f.c(Unknown Source) at com.activeandroid.e.f.c(Unknown Source) at com.activeandroid.f.c(Unknown Source) at com.activeandroid.f.onCreate(Unknown Source) at android.database.sqlite.SQLiteOpenHelper.getDatabaseLocked(SQLiteOpenHelper.java:251) at android.database.sqlite.SQLiteOpenHelper.getWritableDatabase(SQLiteOpenHelper.java:163) at com.activeandroid.b.b(Unknown Source) at com.activeandroid.b.a(Unknown Source) at com.activeandroid.a.a(Unknown Source) at com.activeandroid.a.a(Unknown Source) at com.activeandroid.a.a(Unknown Source) at com.activeandroid.app.Application.onCreate(Unknown Source…

http://stackoverflow.com/q/27397647
answer count: 0
tagged with: java
type: Question
score: 0
has title: Entity Manager : primary and foreign key at the same time
tagged with: jpa
has comment: http://stackoverflow.com/comment/43241780
tagged with: entitymanager
has comment: http://stackoverflow.com/comment/43241390
has comment: http://stackoverflow.com/comment/43241579
type: UnansweredQuestion
has body: I have a trouble, i can't create an entity, User(id,username,lastname,...,pwd) Contact(idUser, idContact) I would like to create the entity Contact which contains user and contact as primary key and foreign key in reference to user.id, user and contact are both id's User Here is my entity Contact : @Entity @Table(name="contact") public class Contact { @Id @ManyToOne @JoinColumn(name="user-fk") private User idUser; @Id @ManyToOne @JoinColumn(name="contact-fk") private User idContact; public User getIdUser() { return idUser; } public void setIdUser(User idUser) { this.idUser = idUser; } public User getIdContact() { return idContact; } public void setIdContact(User idContact) { this.idContact = idContact; } Here is my entity User : @Entity @Table(name = "user") public class User { @Id @GeneratedValue(strategy=GenerationType.AUTO) private long id; private String userName; private String firstName; private String lastName; private String email; private String password; @OneToMany(mappedBy="emet") private List&lt;Message&gt; messageEmet; @OneToMany(mappedBy="recept") private List&lt;Message&gt; messageRecept; @OneToMany(mappedBy="idUser") private List&lt;Contact&gt; idUser; @OneToMany(mappedBy="idContact") private List&lt;Contact&gt; idContact; public long getId() { return id; } public void setId(long id) { this.id = id; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } 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; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public List&lt;Message&gt; getMessageEmet() { return messageEmet; } publi…

http://stackoverflow.com/a/41343036
has comment: http://stackoverflow.com/comment/70429492
downvote count: 1
answers question: http://stackoverflow.com/q/27465731
has comment: http://stackoverflow.com/comment/70431026
has comment: http://stackoverflow.com/comment/70429031
score: 0
upvote count: 1
has body: There is one more major difference between the two methods is when the object we are converting is an array. When you convert an array using Object.toString() you will get some kind of garbage value(@ followed by hashcode of array). To get a human-readable toString(), you must use String.valueOf(char[]); plz note that this method works only for Array of type char. I would recommend using Arrays.toString(Object[]) for converting arrays to String. Second difference is when the object is null, ValueOf() returns a String "null", while toString() will return null pointer exception.
type: Answer

http://stackoverflow.com/q/27348650
favorite count: 0
type: Question
has body: I am working on a 4 Way Pong Program. I have it to the point where my paddles will move with mouse movement, and the ball will bounce around the screen. I am stuck when it comes to figuring out how to check for collisions between the ball and the paddles (which will increase the score) and between the ball and the edges of the JPanel (which will end the game). Any guidance is greatly appreciated... Game Class import java.awt.BorderLayout; import java.awt.Color; import java.awt.Container; import java.awt.FlowLayout; import java.awt.Font; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; import java.io.File; import java.io.FileNotFoundException; import java.io.RandomAccessFile; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.Date; import java.util.Timer; import java.util.TimerTask; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.Timer; public class Game extends JPanel { JFrame window = new JFrame(); Timer timer = new Timer(30, new ActionHandler()); ArrayList&lt;Ball&gt; balls = new ArrayList&lt;Ball&gt;(); ArrayList&lt;Paddle&gt; horizPaddles = new ArrayList&lt;Paddle&gt;(); ArrayList&lt;Paddle&gt; vertPaddles = new ArrayList&lt;Paddle&gt;(); Paddle pTop; Paddle pBottom; Paddle pRight; Paddle pLeft; Ball b; int score = 0; JLabel scoreLabel; //========================================================== public Game() { window.setBounds(100,100,900,500); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setTitle("4 Way Pong"); window.setResizable(false); JPanel scorePanel = new JPanel(true); scoreLabel = new JLabel("Current Score: " + Integer.toString(score)); scoreLabel.setFont(new Font("sansserif", Font.PLAIN, 20)); sco…
tagged with: collision
tagged with: pong
accepted answer: http://stackoverflow.com/a/27351910
score: 0
tagged with: java
upvote count: 1
answer count: 1
downvote count: 1
has title: Java 4-Way Pong, Stuck With Checking for Collisions
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27351910
tagged with: user-interface

communication
tag name: communication
tags question: http://stackoverflow.com/q/27372273
type: Tag

http://stackoverflow.com/comment/43355132
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27458331
score: 0
has text: It's worth noting that an array can be an array of primitives whereas a `Collection` is a collection of references.

http://stackoverflow.com/comment/43342673
type: Comment
comment on: http://stackoverflow.com/a/27449512
type: AnswerComment
score: 0
has text: It's very possible. If Jackson objects implemented the Map and List interfaces, they would meet the criteria. Jackson is also type safe. If you call node.asInt() or asText() and the node is not of the right type, it will do a conversion for you. It also handles nulls by returning a MissingNode.

http://stackoverflow.com/comment/43349775
score: 0
type: Comment
type: QuestionComment
has text: pass count as no of tweets you want as a parameter your requests to get tweets
comment on: http://stackoverflow.com/q/27456023

http://stackoverflow.com/comment/43152484
type: QuestionComment
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27348743
has text: Generally speaking, don't resize the image within the paint method

http://stackoverflow.com/comment/43303206
score: 0
type: AnswerComment
has text: and what that web.xml actually do??
comment on: http://stackoverflow.com/a/27429173
type: Comment

http://stackoverflow.com/comment/43383497
type: Comment
type: QuestionComment
has text: Please include in your question what version you are using.
comment on: http://stackoverflow.com/q/27472708
score: 0

http://stackoverflow.com/a/27314924
has comment: http://stackoverflow.com/comment/43090818
type: Answer
has comment: http://stackoverflow.com/comment/43091110
upvote count: 1
score: 1
answers question: http://stackoverflow.com/q/27314654
downvote count: 0
has body: Two possibilities: This is running in background thread. One of the variables in that line is null

http://stackoverflow.com/q/27431215
has title: Classes wrapping
type: Question
answer count: 1
score: -1
tagged with: inheritance
has answer: http://stackoverflow.com/a/27431355
tagged with: class
downvote count: 1
favorite count: 0
upvote count: 0
has body: I am new to OOP and java world and trying to understand the concepts. There are three separate feature projects, each having their own abstract classes and interfaces. I am facing difficulty in wrapping these projects in my test automation solution. I am thinking of using Abstract factory pattern to create features abstract classes and interface in my test automation project. How can i wrap the classes in my project without direct referencing the feature classes. Thank you in advance for your help.
type: UnansweredQuestion
tagged with: oop
tagged with: java

http://stackoverflow.com/comment/43130142
type: AnswerComment
score: 0
has text: i have edited question with the sample code i used. tq
type: Comment
comment on: http://stackoverflow.com/a/27336540

http://stackoverflow.com/q/27405726
score: -1
accepted answer: http://stackoverflow.com/a/27405797
tagged with: string
favorite count: 0
tagged with: double
type: AnsweredQuestion
tagged with: java
has title: double to string error
has answer: http://stackoverflow.com/a/27405797
downvote count: 1
type: Question
has body: I am just learning Java and am doing a project on making a bank but i can not get it to work the aim is for it to return the current bank balance and account number but it says double can not be returned as a string... public String listProjectedPortfolioTimeframe(double desiredBalance) { desiredBalance = 88; String str = ""; double num = 200; String listProjectedPortfolioTimeframe = String.valueOf(listProjectedPortfolioTimeframe); if (bankAccounts.size() &lt;= 0) { str = "enter ammount to find number of years of constant saving will give 200 euro"; for (BankAccount ba : bankAccounts) { str += ba.getAccNumber(); str += ba.getBalance(); } return str; } else { return (double) (num * 100); } }
upvote count: 0
answer count: 1

http://stackoverflow.com/comment/43104003
has text: This is changing the Model without updating the View... the View might be stale, say for example the View is displaying an item which is no longer in the combo box.
type: AnswerComment
score: 0
comment on: http://stackoverflow.com/a/27322393
type: Comment

http://stackoverflow.com/comment/43193771
has text: Your chatList has no value.. you directly used the chatlist to set your adapter .. Obviously you are getting a null pointer. Initialize your chatlist and add values to it first and then set in the adapter.
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27371043
score: 0

http://stackoverflow.com/comment/43328643
type: QuestionComment
has text: like this? http://stackoverflow.com/q/9837843/2001247
comment on: http://stackoverflow.com/q/27444822
score: 1
type: Comment

http://stackoverflow.com/a/77026676
answers question: http://stackoverflow.com/q/27421838
score: 0
has body: In my case, it was happening because my IntelliJ Idea was configured for a different JDK version and my terminal was referring to a different JDK version. Due to this whenever I run Maven clean from the terminal, and then try to run tests via IDE, it gives this error.
type: Answer

http://stackoverflow.com/q/27469881
favorite count: 0
has comment: http://stackoverflow.com/comment/43375066
type: UnansweredQuestion
downvote count: 2
has comment: http://stackoverflow.com/comment/43374676
tagged with: java
has title: illegal start of expression - line 25
has comment: http://stackoverflow.com/comment/43374868
has comment: http://stackoverflow.com/comment/43374775
type: Question
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/43374865
answer count: 1
has comment: http://stackoverflow.com/comment/43374998
has answer: http://stackoverflow.com/a/27469910
has body: I am new at Java so I apologize for missing the obvious. I am struggling with the below code at line 25 AND 46. @25 - Netbeans is presenting a 'illegal start of expression'. That line is identical to others that are not in error (lines 30 &amp; 37). I ensured the variable names are syntax correct. @46 - I am getting the error message 'class, interface, or enum expected'. This curly bracket is linked to the 'public class Purchase {' at line 12. I have successfully addressed the other errors I had. Thank you in advance. Please assist... public class Purchase { /* set values for invoice, sale amount and tax*/ public int invoiceNumber=12345; public int invoiceNo; public int saleAmount=100; public double saleTax=0.05; public double saleTaxAmt; public static void main(String[] args) { /* @param invoiceNo*/ public void setinvoiceNo(int invoiceNo) &gt;&gt; HERE IS THE FIRST ERRANT LINE &gt;&gt; { this.invoiceNumber=invoiceNo; } public void setsaleAmount(int saleAmount) { this.saleAmount=saleAmount; saleTaxAmt=this.saleAmount*saleTax; } /* Display method displays data values*/ public void display() { System.out.println("Invoice Number: " + invoiceNumber); System.out.println(""); System.out.println("Sale amount: $" + saleAmount); System.out.println("Sales Tax Amount : $" + saleTaxAmt); System.out.println("Total Bill: $" + saleAmount+saleTaxAmt); } } &gt;&gt; HERE IS THE SECOND ERRANT LINE &gt;&gt;

http://stackoverflow.com/comment/43314650
comment on: http://stackoverflow.com/a/27431647
type: Comment
has text: I'm afraid that will have an impact on the uniqueness as well... set.add(new A("a", 1)); set.add(new A("a", 2)); set.add(new A("b", 1)); set.add(new A("b", 2)); Output: (b, 2), (a, 1), (b, 1)
score: 0
type: AnswerComment

http://stackoverflow.com/a/27474090
answers question: http://stackoverflow.com/q/27473941
upvote count: 2
type: Answer
score: 2
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27473941
has body: Show is a reserved keyword in MySQL. Change the associated table to FILM_SHOW and it will work: @Entity @Table(name="FILM_SHOW") public class Show { ... }

http://stackoverflow.com/comment/43357931
comment on: http://stackoverflow.com/a/27460584
type: AnswerComment
has text: No. It will terminate the JVM gracefully irrespective of whether you have uncaughtException handler or not. This was with respect to your question "What I want to know is is there some king of a procedure in the JVM(or anywhere) that executes when this happens"
score: 0
type: Comment

http://stackoverflow.com/comment/43301923
comment on: http://stackoverflow.com/q/27430015
type: Comment
score: 1
has text: nobody will ever know what your actual issue is - without error messages, problem descriptions and the likes
type: QuestionComment

http://stackoverflow.com/comment/43330475
comment on: http://stackoverflow.com/q/27445275
has text: Add some code here that demonstrates the issue. The particulars matter when it comes to garbage collection.
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43109770
type: QuestionComment
score: 0
has text: 223 columns is extremely long for a single line, you should consider splitting it up into several lines.
comment on: http://stackoverflow.com/q/27325247
type: Comment

http://stackoverflow.com/a/27381870
type: Answer
accepted answer of: http://stackoverflow.com/q/27380088
answers question: http://stackoverflow.com/q/27380088
has body: The difference between your public class MyPrintQue&lt;Job&gt; implements PrintQue&lt;Job&gt; and public class MyJobPrintQue implements PrintQue&lt;Job&gt; is that in the first case Job is a generic type parameter, nothing to do with the class Job. And the rewrite, there is a PrintQue of the class Job. Instead of parameters &lt;Job&gt; better use &lt;J&gt; or whatever. For good order "queue" is the spelling in English (for an explanation "few" also has double u). The NullPointerException can be removed by: if (front == n) { front = n.tail; } else { for (ListNode&lt;Job&gt; curr = front; curr !=null; curr = curr.tail) { if (curr.tail == n) { curr.tail = n.tail; break; } } }
type: AcceptedAnswer
score: 0

tcp
type: Tag
tags question: http://stackoverflow.com/q/27375381
tags question: http://stackoverflow.com/q/27344004
tags question: http://stackoverflow.com/q/27400998
tags question: http://stackoverflow.com/q/27456124
tags question: http://stackoverflow.com/q/27416952
tags question: http://stackoverflow.com/q/27397714
tags question: http://stackoverflow.com/q/27318259
tags question: http://stackoverflow.com/q/27437177
tags question: http://stackoverflow.com/q/27395929
tags question: http://stackoverflow.com/q/27376679
tags question: http://stackoverflow.com/q/27331486
tags question: http://stackoverflow.com/q/27327919
tag name: tcp
tags question: http://stackoverflow.com/q/27427171

http://stackoverflow.com/a/27331765
upvote count: 3
type: AcceptedAnswer
downvote count: 1
has body: Use Scanner class for fetching inputs from the user. Scanner s = new Scanner(System.in); System.out.println("Enter the height of the pyramid :- "); int height = s.nextInt(); System.out.println("Enter the number of characters of the pyramid to start with :- "); int start = s.nextInt(); Other option could be use to use String[] array of main method... java Pyramid 5 4 // passed arguments as default inputs to program(calling Pyramid class)
has comment: http://stackoverflow.com/comment/43121405
has comment: http://stackoverflow.com/comment/43122332
has comment: http://stackoverflow.com/comment/43127060
type: Answer
accepted answer of: http://stackoverflow.com/q/27331716
score: 2
has comment: http://stackoverflow.com/comment/43121518
answers question: http://stackoverflow.com/q/27331716
has comment: http://stackoverflow.com/comment/43122316
has comment: http://stackoverflow.com/comment/43121285
has comment: http://stackoverflow.com/comment/43121228

http://stackoverflow.com/comment/43201313
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27373703
has text: @LMeyer as log show,no connection is released
score: 0

http://stackoverflow.com/a/27412033
type: Answer
downvote count: 0
score: 1
has body: First: Please don't put your credentials in your code. It's way too easy to accidentally check credentials into version control, or otherwise post them. If you have your credentials in the default location, you can just do: AmazonCloudSearchDomainClient client = new AmazonCloudSearchDomainClient(); And the SDK will find them. One common cause of 403s is getting the endpoint wrong. Make sure you don't have /documents/batch on the end of your endpoint string. The SDK will add that. One other thing to try is setting the content length: req.setContentLength(file.length()); My code has that, and works, and is otherwise the same as yours.
answers question: http://stackoverflow.com/q/27349047
upvote count: 1

http://stackoverflow.com/comment/43113893
has text: so a frame layout instead of a relative layout?
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27327476
type: Comment

http://stackoverflow.com/comment/43141767
type: Comment
comment on: http://stackoverflow.com/a/27342743
type: AnswerComment
has text: Another method I've used is onWindowFocusedChanged in your Activity class: @Override public void onWindowFocusChanged (boolean hasFocus) { View layout = findViewById(R.id.yourFrameLayout); realHeight = layout.getHeight(); }
score: 0

http://stackoverflow.com/q/27364907
favorite count: 0
tagged with: dictionary
has comment: http://stackoverflow.com/comment/43181688
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27364997
has body: What is the time complexity of TreeMap.lastKey() part of the SortedMap interface? The oracle docs mention this about TreeMaps: This implementation provides guaranteed log(n) time cost for the containsKey, get, put and remove operations.
tagged with: java
tagged with: sortedmap
has comment: http://stackoverflow.com/comment/43181629
has title: TreeMap lastKey lookup time
score: 9
type: Question
has comment: http://stackoverflow.com/comment/43181736
has comment: http://stackoverflow.com/comment/43181663
possible better answer: http://stackoverflow.com/a/27364986
upvote count: 9
has answer: http://stackoverflow.com/a/27364986
has comment: http://stackoverflow.com/comment/43181908
tagged with: treemap
accepted answer: http://stackoverflow.com/a/27364997
answer count: 2
downvote count: 0

http://stackoverflow.com/a/27390621
answers question: http://stackoverflow.com/q/27390485
score: 4
has comment: http://stackoverflow.com/comment/43229227
has comment: http://stackoverflow.com/comment/43229846
type: Answer
upvote count: 4
has body: I said in the comments that you would be better off putting the strings and bitmaps into objects together so you don't need to maintain parallel lists. Here is basically how that would be: class NamedBitmap { String name; Bitmap bitmap; // use privacy modifiers and accessors according to your taste public NamedBitmap(String name, Bitmap bitmap) { this.name = name; this.bitmap = bitmap; } } List&lt;NamedBitmap&gt; namedBitmaps = new ArrayList&lt;NamedBitmap&gt;(); ... Collections.shuffle(namedBitmaps); This way the names are always tied to the bitmaps; you don't have to keep two lists in the same order to keep them associated. Parallel arrays (or lists) are how people had to associate related data in a time before structs and objects provided better options. Edit: Given a List&lt;NamedBitmap&gt; namedBitmaps as described above, you can add stuff into it using: namedBitmaps.add(new NamedBitmap(givenName, givenBitmap)); and you can access the names and bitmaps using namedBitmaps.get(i).name and namedBitmaps.get(i).bitmap.
has comment: http://stackoverflow.com/comment/43229981
downvote count: 0

http://stackoverflow.com/comment/43399030
type: Comment
type: QuestionComment
has text: Really no one? It's a common use case!?
score: 0
comment on: http://stackoverflow.com/q/27418822

http://stackoverflow.com/comment/43298802
type: Comment
comment on: http://stackoverflow.com/q/27415926
has text: @Barodapride I got it working. You were right. The input processor was getting in the way of the touch events meant for the gestures.
score: 0
type: QuestionComment

http://stackoverflow.com/q/27415266
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43277301
tagged with: classpath
type: Question
has comment: http://stackoverflow.com/comment/43276402
downvote count: 0
linked to: http://stackoverflow.com/q/252893
has body: Is there any way to change the classpath or another running Java program using Java code? Is this possible without having access to the other program's code (for example, like adding a messenger or something similar)? Something like "Reflection" except on another program?
tagged with: external
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
has title: Change the Classpath of Another Java Program (Using Java)

http://stackoverflow.com/comment/43303722
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27430975
has text: @CostiCiudatu you can always put your answer on the original question that this one duplicated.
score: 0

http://stackoverflow.com/comment/43194003
has text: Thanks for the advice, but there is a [somewhat similar question](http://programmers.stackexchange.com/questions/178244/in-which-cases-robolectric-is-a-relevant-solution/254149) there, it doesn't have very relevant answers and it's closed. Here I'm asking more for specific use cases that people actually use with code examples.
comment on: http://stackoverflow.com/q/27354441
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43309938
type: Comment
has text: Are you sure `if(items[6].equalsIgnoreCase(items[2] ))` is really what you want to do? And what's the definition for "year 3"?
score: 0
comment on: http://stackoverflow.com/q/27434463
type: QuestionComment

http://stackoverflow.com/comment/43120474
comment on: http://stackoverflow.com/a/27331313
type: AnswerComment
has text: @MangatRai Nope, this is not a comparison for equality - it tells you which bit set is larger, and it does not break when you have more than 63 bits.
score: 0
type: Comment

http://stackoverflow.com/a/38668148
downvote count: 0
has comment: http://stackoverflow.com/comment/74103037
has comment: http://stackoverflow.com/comment/90915542
score: 159
upvote count: 159
type: Answer
has body: Have you tried ApplicationReadyEvent? @Component public class ApplicationStartup implements ApplicationListener&lt;ApplicationReadyEvent&gt; { /** * This event is executed as late as conceivably possible to indicate that * the application is ready to service requests. */ @Override public void onApplicationEvent(final ApplicationReadyEvent event) { // here your code ... return; } } Code from: http://blog.netgloo.com/2014/11/13/run-code-at-spring-boot-startup/ This is what the documentation mentions about the startup events: ... Application events are sent in the following order, as your application runs: An ApplicationStartedEvent is sent at the start of a run, but before any processing except the registration of listeners and initializers. An ApplicationEnvironmentPreparedEvent is sent when the Environment to be used in the context is known, but before the context is created. An ApplicationPreparedEvent is sent just before the refresh is started, but after bean definitions have been loaded. An ApplicationReadyEvent is sent after the refresh and any related callbacks have been processed to indicate the application is ready to service requests. An ApplicationFailedEvent is sent if there is an exception on startup. ...
answers question: http://stackoverflow.com/q/27405713

http://stackoverflow.com/comment/43104157
comment on: http://stackoverflow.com/q/27322235
type: Comment
type: QuestionComment
has text: "Encrypting" with the RSA private key means signing and it doesn't work the same was as actual encryption with an RSA public key. I'm not that versed in the Java intricacies of Signature generation t provide you an answer. You would usually use something like in this question http://stackoverflow.com/questions/521101/using-sha1-and-rsa-with-java-security-signature-vs-messagedigest-and-cipher. Note that SHA1 is not safe anymore. A proper Diffie-Hellman Key Exchange would be more appropriate if you want (perfect) forward secrecy.
score: 0

http://stackoverflow.com/q/27324947
tagged with: android-sqlite
linked to: http://stackoverflow.com/q/433392
type: Question
has comment: http://stackoverflow.com/comment/43109778
has comment: http://stackoverflow.com/comment/43109300
tagged with: java
linked to: http://stackoverflow.com/q/12561173
has title: SQLite apostrophe causes force close - .replace("'", "''") does not resolve the issue
score: 0
accepted answer: http://stackoverflow.com/a/27325329
tagged with: sqlite
answer count: 1
has body: I have a an SQLite query I'm attempting to run however it is force closing due to an apostrophe in my title string. I've attempted to resolve this by using title.replace("'", "''") and title.replace("'", "\\") as well as title.replaceAll("'", "\"); however it is still force closing due to the apostrophe - and when I debug - the apostrophe still exists in title - can anyone point on what I may have done wrong here? Source Snippet: String title = info.get(MeetingInfo.MEETING_TITLE); String selectionClause = Events.DTSTART + " = '" + startTime + "' AND " + Events.DTEND + " = '" + endTime + "' AND " + Events.TITLE + " = '" + title.replace("'", "\\") + "'";
has comment: http://stackoverflow.com/comment/43109260
has comment: http://stackoverflow.com/comment/43110713
has comment: http://stackoverflow.com/comment/43109310
tagged with: android
has comment: http://stackoverflow.com/comment/43109588
has comment: http://stackoverflow.com/comment/43109201
linked to: http://stackoverflow.com/q/25365651
linked to: http://stackoverflow.com/q/12901002
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27325329
has comment: http://stackoverflow.com/comment/43109673

http://stackoverflow.com/comment/43292131
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27401298
has text: below provide sample code for you..try it and give your feedback @MHSN
score: 0

http://stackoverflow.com/q/27390413
favorite count: 0
score: 4
has answer: http://stackoverflow.com/a/27409893
has title: Spring XML handler Mapping
tagged with: spring
answer count: 1
tagged with: spring-mvc
tagged with: java
upvote count: 4
has body: it is possible to specify a request method type in SimpleUrlHandlerMapping or other XML handlerMapper via XML configuration?? And invocation of controller method too?? clinicController // something like <prop key="/welcome.htm" method="GET" controllerMethod="someMethod1 ..." clinicController // something like <prop key="/vets.htm" method=PUT method="GET" controllerMethod="someMethod2 ..." clinicController // something like <prop key="/meds.htm" method=POST method="GET" controllerMethod="someMethod3 ..." i trying to find answer but i cant find nothing. I preffer to use XML configuration instead annotation. But in annotation is possible using @RequestMapping(value = "/welcome.htm", method = RequestMethod.GET)
downvote count: 0
type: UnansweredQuestion
type: Question

http://stackoverflow.com/comment/43210461
type: AnswerComment
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27380285
has text: Thanks @Lutz Horn (+1) - that's actually a bit *shocking* to me. So, would it be safe to say that, based on `acceptsUrl(...)`'s JavaDoc, that the formal grammar/anatomy of a JDBC connection string is: `jdbc:/<driver>:<subprotocol>`?

http://stackoverflow.com/comment/43182339
comment on: http://stackoverflow.com/q/27364452
score: 0
type: Comment
type: QuestionComment
has text: Difficult to believe. Drools 5.x and 6.x run fine using Java 7 and 8. - What are the hard facts supporting your "seems to be"?

http://stackoverflow.com/q/27472001
has title: Android Geofencing with Google Play Services 6.5.87
downvote count: 0
type: UnansweredQuestion
score: 6
type: Question
tagged with: geofencing
has answer: http://stackoverflow.com/a/27477764
tagged with: java
upvote count: 6
tagged with: google-play-services
has body: I have no problem with Google Play Services 6.1.71 (because everything works well) but not the same thing with newer version (6.5.87). I already know LocationClient class is deprecated in 6.5.87 Google Play Services class and I have little problem with converting old GeofenceDetection sample. First issue I have, with new Play Services I haven't find OnAddGeofencesResultListener and OnRemoveGeofencesResultListener that I used to handle errors on console; Second issue (main problem) is adding geofence point. When I try to add one to request I receive a pending indefinite... The code that I have modified is: ReceiveTransitionsIntentService.java public class ReceiveTransitionsIntentService extends IntentService { /** * Sets an identifier for this class' background thread */ public ReceiveTransitionsIntentService() { super("ReceiveTransitionsIntentService"); } /** * Handles incoming intents * * @param intent The Intent sent by Location Services. This Intent is provided * to Location Services (inside a PendingIntent) when you call addGeofences() */ @Override protected void onHandleIntent(Intent intent) { // Create a local broadcast Intent Intent broadcastIntent = new Intent(); // Give it the category for all intents sent by the Intent Service broadcastIntent.addCategory(GeofenceUtils.CATEGORY_LOCATION_SERVICES); GeofencingEvent geoFenceEvent = GeofencingEvent.fromIntent(intent); // First check for errors if (geoFenceEvent.hasError()) { // Get the error code int errorCode = geoFenceEvent.getErrorCode(); // Get the error message String errorMessage = LocationServiceErrorMessages.getErrorString(this, errorCode); // Log the error Log.e(GeofenceUtils.APPTAG, getString(R.string.geofence_transition_error_detail, errorMessage)); // Set the action and error message for the broadcast intent broadcastIntent.setAction(GeofenceUtils.ACTION_GEOFENCE_ERROR).putExtra(GeofenceUtils.EXTRA_GEOFENCE_STATUS, errorMessage); // Broadcast the error *locally* to other components in this app Local…
tagged with: google-api-client
answer count: 1
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/44739081

http://stackoverflow.com/q/27334528
type: Question
tagged with: jackson
tagged with: glassfish
has answer: http://stackoverflow.com/a/28538314
upvote count: 7
answer count: 1
has body: I am using GlassFish 4.1, which includes Jackson 2.3.2. I would like to upgrade to the newest version of Jackson (currently 2.4.4). Is the procedure for upgrading Jackson in GlassFish 4.1 as simple as: a) stopping GlassFish b) deleting the osgi-cache c) replacing the Jackson 2.3.2 jars in the glassfish/modules directory with newer versions d) starting GlassFish Thanks.
favorite count: 0
type: UnansweredQuestion
has title: Upgrading Jackson in GlassFish 4.1
downvote count: 0
score: 7
tagged with: java
tagged with: glassfish-4
tagged with: glassfish-4.1

http://stackoverflow.com/a/27528806
type: Answer
accepted answer of: http://stackoverflow.com/q/27405195
upvote count: 6
answers question: http://stackoverflow.com/q/27405195
has body: You need to register a message converter that is able to do that, pretty much as you have to do for any non trivial conversion. Since you're obviously using the default JmsListerContainerFactory, extend it to register a message converter for your listener, someething like: @Bean public DefaultJmsListenerContainerFactory jmsListenerContainerFactory() { DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory(); factory.setConnectionFactory(connectionFactory()); factory.setMessageConverter(jmsMessageConverter()); return factory; } Your jmsMessageConverter defines how messages are deserialized (you can reuse the same instance on the produce side). Try MarshallingMessageConverter with Jaxb2Marshaller
score: 6
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/a/27409356
type: Answer
has body: String wsdl1Path = request.getParameter("wsdl1path"); String wsdl2Path = request.getParameter("wsdl2path"); WsdlCompare com = new WsdlCompare(); String url = ""; if ( wsdl1Path != null &amp;&amp; wsdl2Path != null ) { url= com.compare(wsdl1Path,wsdl2Path); }else{ //Handle NPE } Try this... if wsdl1Path or wsdl2Path became null you will able to handle the exception. And also try passing your two parameters via GET or POST methods, if its GET load page with above two parameters. Eg: index.jsp?wsdl1Path=wsdl1_path&amp;wsdl2Path=wsdl2_path
score: 0
answers question: http://stackoverflow.com/q/27408906

http://stackoverflow.com/q/27346012
has comment: http://stackoverflow.com/comment/43147210
type: Question
answer count: 2
has answer: http://stackoverflow.com/a/27346194
tagged with: find
tagged with: string
has comment: http://stackoverflow.com/comment/43147416
score: 0
has title: add every Nth character to string
has comment: http://stackoverflow.com/comment/43149937
tagged with: character
possible better answer: http://stackoverflow.com/a/27346194
has body: The task is to get every nth character and put it in a string. I got this problem halfway solved. If Miracle is the string typed in and the int = 2, i will get the following output: "Mrc", while it should be "Mrce". Why is it missing out on the last character? The logic part seems reasonable to me. public String everyNth(String str, int n) { String firstletter = str.substring(0,1); // We store the first letter as well. String secondhalf = ""; while(str.length() &gt; n) { // Run as long as n reaches the end of the string. secondhalf += str.substring(n, n+1); // Add Nth character to string. n+=n; } return firstletter+secondhalf; } EDIT: Added a separate counter, int counter = n; so it doesnt double the value all the time.
accepted answer: http://stackoverflow.com/a/27346052
type: AnsweredQuestion
tagged with: java
has answer: http://stackoverflow.com/a/27346052
has comment: http://stackoverflow.com/comment/43147201

http://stackoverflow.com/comment/43212414
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27381326
has text: Yup, session is mocked. when(mockEntityManager.getDelegate()).thenReturn(mockSession);

http://stackoverflow.com/comment/43319818
has text: Tell that to Batik's bugzilla bug tracker.
comment on: http://stackoverflow.com/q/27439359
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27360131
has comment: http://stackoverflow.com/comment/43172865
tagged with: android-activity
favorite count: 0
tagged with: cordova
has comment: http://stackoverflow.com/comment/123690499
has comment: http://stackoverflow.com/comment/43172646
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43172445
has comment: http://stackoverflow.com/comment/43172357
score: 2
answer count: 0
downvote count: 0
has comment: http://stackoverflow.com/comment/43172751
tagged with: java
type: Question
upvote count: 2
has comment: http://stackoverflow.com/comment/43204848
has title: Pressing home button on Android - white screen when resuming app
has body: I'm creating an Android app using phonegap. Whenever I press the home button whilst I'm in my app and then try and open the app back up I get a white blank screen - which only disappears when the screen is touched. Looking in logcat I get a message saying blockWebkitDraw lockedfalse after I touch the screen. If I press the back button to get out of the app and then return - it works fine, so really unsure why it doesn't work for the home button. This is my activity in the manifest: &lt;activity android:name=".PhoneGapActivity" android:launchMode="singleTop" android:configChanges="orientation|keyboardHidden|screenLayout|screenSize"&gt; &lt;intent-filter&gt; &lt;action android:name="com.matt.android.theAppName.MESSAGE"/&gt; &lt;category android:name="android.intent.category.DEFAULT"/&gt; &lt;/intent-filter&gt; &lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;/activity&gt; One thing that does work is to override the onpause method: @Override public void onPause() { super.onPause(); this.finish(); } But this makes the activity restart - which is not ideal. If anyone has any idea why this is I'd really appreciate any input, thanks. EDIT: The onCreate method: @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Log.d(TAG, "onCreate"); int splashImageResourceIdentifier = getResources().getIdentifier("splash", "drawable", getPackageName()); if (splashImageResourceIdentifier != 0) { super.setIntegerProperty("splashscreen", splashImageResourceIdentifier); super.loadUrl(WORK_DIR + getStartFileName(), 10000); } else { super.loadUrl(WORK_DIR + getStartFileName()); } super.setIntegerProperty("loadUrlTimeoutValue", 60000); this.appView.clearCache(false); this.appView.clearHistory(); // Set some defaults this.appView.setHorizontalScrollBarEnabled(false); this.appView.setHorizontalScrollbarOverlay(false); this.appVie…
tagged with: android

http://stackoverflow.com/q/27314197
tagged with: gradle
type: Question
tagged with: jar
has answer: http://stackoverflow.com/a/27314420
answer count: 1
downvote count: 0
favorite count: 0
tagged with: jetty
tagged with: maven
upvote count: 1
accepted answer: http://stackoverflow.com/a/27314420
has body: I am trying to follow this SO question which uses a Jetty ServletTester class. I have spent all morning trying to locate the JAR that houses ServletTester to no avail. Even pulling down the aggregated "all JAR" doesn't turn up a *.testing package with that class in it. See for yourself, do a Maven/Gradle resolve for: compile 'org.eclipse.jetty.aggregate:jetty-all-server:8.1.14.v20131031' Even in their source code on GitHub it looks like there isn't a testing subproject, yet, in those JavaDocs above, it seems to exists somewhere... Does anybody know where I can find the JAR that houses this class? If so, what is it, where/how do I acquire this JAR, and what did you do to figure this out (so I don't need to ask these types of questions again!)?
linked to: http://stackoverflow.com/q/1593016
type: AnsweredQuestion
score: 1
tagged with: java
has title: Where is the Jetty ServletTester class packaged?

wsdl
tags question: http://stackoverflow.com/q/27374546
tags question: http://stackoverflow.com/q/27441363
tags question: http://stackoverflow.com/q/27433099
tags question: http://stackoverflow.com/q/27398060
tags question: http://stackoverflow.com/q/27327018
type: Tag
tag name: wsdl

http://stackoverflow.com/comment/48561029
type: AnswerComment
score: 0
type: Comment
has text: @Nonos - Instead of creating a custom layout manager, why don't you use LinearLayoutManager and call setOrientation(LinearLayoutManager.HORIZONTAL) on it. Then catch the click on the item like I explained in my answer. Now you can figure out the location of the view by using findViewHolderForAdapterPosition() on the recycler view and finally do the math and scroll via scrollHorizontallyBy() on the layout manager.
comment on: http://stackoverflow.com/a/28617619

http://stackoverflow.com/q/27446761
has title: SimpleDateFormat adding 7 hours?
score: 4
has body: I'm trying to do a simple subtraction of dates and getting odd results. For some reason when I format it with SimpleDateFormat, there are 7 extra hours difference. package timedemo; import java.text.SimpleDateFormat; import java.util.Date; public class Timedemo { public static void main(String[] args) { Date start = new Date(); // time right now Date stop = new Date(); long startTime = start.getTime()-1000; // introduce a second of skew long stopTime = stop.getTime(); SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss"); // First one shows up prior to 1970 epoch. Okay, except for 5 hour variance. // Probably a timezone thing, as I'm in EST (-5). System.out.println("New date is "+new Date(stopTime - startTime)); System.out.println("Raw Start is "+startTime); // fine System.out.println("Raw Stop is "+stopTime); // fine System.out.println("Raw Difference is "+(stopTime-startTime)); System.out.println("Formatted Start is "+sdf.format(startTime)); System.out.println("Formatted Stop is "+sdf.format(stopTime)); System.out.println("Formatted Difference is "+sdf.format(stopTime-startTime)); } } And the results are: New date is Wed Dec 31 19:00:01 EST 1969 Raw Start is 1418397344360 Raw Stop is 1418397345360 Raw Difference is 1000 Formatted Start is 10:15:44 Formatted Stop is 10:15:45 Formatted Difference is 07:00:01 I had thought it was a timezone thing, but I'm in EST (-5), not MST (-7). I would suspect Daylight Savings, but it's 7 hours, not 1. 12/24 hour difference? 12-7=5 which is my timezone offset... not sure what to make of it though. Kind of out of ideas at this point. Why the seven hour shift on the last line?
has answer: http://stackoverflow.com/a/27446847
accepted answer: http://stackoverflow.com/a/27446847
answer count: 1
favorite count: 0
tagged with: time
upvote count: 4
linked to: http://stackoverflow.com/q/1555262
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43368283
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43402635
tagged with: date
type: Question

http://stackoverflow.com/comment/43257780
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27406288
has text: @JonSkeet I edited the horizontal issue. The output is simply supposed to show which numbers in the array are greather than (N). When i use the System.out.print(greaterNums) in the second method, the output is strange. Also, when i try to add greaterNums to my final output it says the variable cannot be found, assuming it's not returning correctly to the main method.

http://stackoverflow.com/comment/43354715
type: Comment
comment on: http://stackoverflow.com/a/27458200
score: 2
type: AnswerComment
has text: I'd edit to point `DocumentFilter` as primary solution, if you want to highlight the other methods as been "out-of-date" it would help the OP recognise bad recommendations ;)

http://stackoverflow.com/q/27444986
type: Question
has title: hibernate.properties not found, bytecode provider name : cglib
has body: Hibernate Annotations 3.3.0.GA Hibernate 3.2.6 hibernate.properties not found Bytecode provider name : cglib using JDK 1.4 java.sql.Timestamp handling configuring from resource: /hibernate.cfg.xml Configuration resource: /hibernate.cfg.xml Property [hibernate.cglib.use_reflection_optimizer] has been renamed to [hibernate.bytecode.use_reflection_optimizer]; update your properties appropriately Configured SessionFactory: null
score: 0
has comment: http://stackoverflow.com/comment/43641467
has comment: http://stackoverflow.com/comment/43328867
tagged with: console
type: UnansweredQuestion
answer count: 0
tagged with: java
tagged with: hibernate

http://stackoverflow.com/q/27370662
answer count: 0
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43193470
tagged with: sprite
has title: Issues with my Android custom sprite Class
tagged with: java
has comment: http://stackoverflow.com/comment/43193491
has comment: http://stackoverflow.com/comment/43193061
type: Question
has comment: http://stackoverflow.com/comment/43193074
has body: I am currently designing a basic sprite class for java for android because for I don't wish to use a 2d engine and Google doesn't provide any sprite APIs for some reason... Anyways, my question is in regards to my Classes I have designed. I have a Sprite Class that takes a bitmap and turns it into a "sprite". This sprite can then be passed to a custom view I have created when the user creates a new "SpriteContainer" My code for the DynamicSpriteContainer is as follows: package com.me.spriteGraphics; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Canvas; import android.view.SurfaceHolder; import android.view.SurfaceView; public class DynamicSpriteContainer extends SurfaceView implements SurfaceHolder.Callback { private SurfaceHolder holder; public int x, y; private Bitmap b; public Sprite sprite; private Canvas c = new Canvas(); private boolean bool = false; public DynamicSpriteContainer(Context context, Sprite spriteImage) { //public ImageView(Context context) { super(context); //get sprite b = spriteImage.getBitmap(); //set holder holder = getHolder(); holder.addCallback(this); //set position x = y = 0; update(); } public void surfaceCreated(SurfaceHolder holder) { c = holder.lockCanvas(); c.drawARGB(255, 150, 150, 10); //set up bitmap image c.drawBitmap(b, x, y, null); holder.unlockCanvasAndPost(c); update(); } public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { } public void surfaceDestroyed(SurfaceHolder holder) { } private void update() { //this code will alter the character in the way the developer specifies (per frame) Thread repeat = new Thread( new Runnable() { public void run() { try { //move sprite in constant motion while (bool) { //redraw c = holder.lockCanvas(); c.drawARGB(255, 150, 150, 10); //set up bitmap image c.drawBitmap(b, x, y, null); holder.unlockCanvasAndPost(c); } } catch (Error e) { e.printStackTrace(); bool = false; } } }); repeat.start(); } public void setX(int x) …
score: 0
tagged with: android

http://stackoverflow.com/comment/43280703
comment on: http://stackoverflow.com/a/27414093
has text: Thank you for taking the time to respond, I was hoping there would be another way as I would have loved to use the DrawerLayout Template which is also not working at the moment :/
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27314589
has body: I need to restrict the users from entering more than one space between words. Is there any way to limit the user with only one space per word??? if (validateStatus &amp;&amp; RegistraionRequestType.RegisterationCompleteReq.descdet.trim() .length() &lt; 50) { Log.e("Validate---------------------- ",RegistraionRequestType.RegisterationCompleteReq.descdet+ " --ValidateXCalled"); warning = getResources().getString(R.string.description_msg); registeration_frm_et_id_description.requestFocus(); validateStatus = false; }
downvote count: 0
has answer: http://stackoverflow.com/a/27314768
favorite count: 0
answer count: 5
tagged with: spacing
type: UnansweredQuestion
has title: filter more than one space in EditText (Android)
tagged with: android
has answer: http://stackoverflow.com/a/27314720
has answer: http://stackoverflow.com/a/27314796
has answer: http://stackoverflow.com/a/55333073
score: 1
tagged with: java
upvote count: 1
has answer: http://stackoverflow.com/a/27314917
type: Question

http://stackoverflow.com/a/27438504
upvote count: 2
type: Answer
has comment: http://stackoverflow.com/comment/43317128
score: 2
answers question: http://stackoverflow.com/q/27438291
accepted answer of: http://stackoverflow.com/q/27438291
downvote count: 0
type: AcceptedAnswer
has body: you can write as String csvdata[][]= null; if(Some Condition) { csvdata = ParseCSV.CSVTextToArray(file); } System.out.println(csvdata[0][0]);

http://stackoverflow.com/comment/43308179
comment on: http://stackoverflow.com/a/27433440
type: Comment
score: 0
type: AnswerComment
has text: right, and could you explain/ show me how to specify the type of progress value?

http://stackoverflow.com/comment/43277922
comment on: http://stackoverflow.com/q/27417091
type: Comment
type: QuestionComment
has text: Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/66628/discussion-between-vijay-shinde-and-scary-wombat).
score: 0

http://stackoverflow.com/comment/43208305
type: QuestionComment
has text: if(addWhereClause) {query.from(address).where(address.company.isNotNull())} else {query.from(address);}
score: 0
comment on: http://stackoverflow.com/q/27379482
type: Comment

http://stackoverflow.com/comment/43343617
has text: `PreparedStatements` are good. They way you're *using* them is bad.
type: Comment
score: 0
comment on: http://stackoverflow.com/q/27452012
type: QuestionComment

http://stackoverflow.com/q/27436608
has body: Scanner sc=new Scanner("Berries are red"); sc.skip("...");//what does this mean? System.out.print(sc.next); What does ... Mean? This was showed to us in a computer science class but never explained.
upvote count: 2
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27436649
has title: What does this mean? java
type: Question
linked to: http://stackoverflow.com/q/20390507
downvote count: 9
tagged with: java
has answer: http://stackoverflow.com/a/27436636
has comment: http://stackoverflow.com/comment/43313902
has comment: http://stackoverflow.com/comment/43313949
answer count: 2
score: -7
favorite count: 0

http://stackoverflow.com/q/27388111
has answer: http://stackoverflow.com/a/28137844
answer count: 1
downvote count: 0
favorite count: 0
linked to: http://stackoverflow.com/q/14722873
tagged with: objectify
tagged with: google-app-engine
linked to: http://stackoverflow.com/q/4000039
linked to: http://stackoverflow.com/q/3390346
score: 5
accepted answer: http://stackoverflow.com/a/28137844
has title: Can Google App Engine Modules share source code just like Maven Modules?
tagged with: java
tagged with: maven
linked to: http://stackoverflow.com/q/6189426
type: Question
type: AnsweredQuestion
upvote count: 5
has body: I'm using Google App Engine to create a project consisting of multiple Google Modules. How do I set up my project (using Maven) so that I can share source code such as Objectify object model definitions, shared utility code, and unit test code across the modules? I'm hoping the answer is simple and that I can just use Maven as suggested in answers such as these: How do you use Maven to share source code for two projects? How to create shared source folder across multiple projects in Eclipse? For test code: Sharing src/test classes between modules in a multi-module maven project For test code: Share test resources between maven projects Eclipse Linked Resources: https://stackoverflow.com/a/7585095/2848676. Is this compatible with Maven though? However, I'm concerned there might be something special about Google App Engine modules that makes them different from Maven modules. And then maybe the approaches above won't work. As an example of why I'm concerned, notice that Google says "Although Java EE supports WAR files, module configuration uses unpacked WAR directories only." yet some of the solutions given above suggest packaging the shared code into JAR files. I realize WAR and JAR are different but I'm worried I'll waste my time trying to make something work that can't. Any advice on how to share code among Google App Engine modules?
tagged with: eclipse
linked to: http://stackoverflow.com/q/2247199

http://stackoverflow.com/a/27538379
has body: I've finally solved it by limiting the Google Play service in gradle dependency. The problem however was caused by the Google Play service, and by simply change it to a specific library, it is now solved. com.google.android.gms:play-services-base:6.5.87 UPDATE More info on android guides
upvote count: 10
type: Answer
accepted answer of: http://stackoverflow.com/q/27438145
answers question: http://stackoverflow.com/q/27438145
downvote count: 0
score: 10
type: AcceptedAnswer

ldap
tags question: http://stackoverflow.com/q/27394900
tags question: http://stackoverflow.com/q/27378821
tag name: ldap
type: Tag
tags question: http://stackoverflow.com/q/27424409

http://stackoverflow.com/comment/43235162
type: QuestionComment
type: Comment
has text: @AndrewThompson,sorry for the inconvenience as you mentioned i don want to include any GUI classes in my project
comment on: http://stackoverflow.com/q/27372623
score: 0

http://stackoverflow.com/a/27317980
type: AcceptedAnswer
downvote count: 0
type: Answer
upvote count: 1
answers question: http://stackoverflow.com/q/27317055
score: 1
accepted answer of: http://stackoverflow.com/q/27317055
has body: Two things to do (generally speaking): 1) change your main class - you are checking winner before first move and after last move... So game for should looks like this: for (i = 0; i &lt; 9; i++) { if (KollaVinst(spelplan)) { break; } else { CheckMove(spelplan, rad, kolumn); } if (i % 2 == 0) { spelare = 'X'; } else { spelare = 'O'; } System.out.println("Spelare 1 skriv vilken rad: 1-3"); int x = new Scanner(System.in).nextInt(); System.out.println("Spelare 1 skriv vilken kolumn: 1-3"); int y = new Scanner(System.in).nextInt(); if (CheckMove(spelplan, x, y) == true) { MakeMove(spelplan, spelare, x, y); } System.out.println(" "); SkrivUtSpelplan(spelplan); } 2) Checking winner - I upgraded your functions (see below). You don't need to iterate over everything (especially fileds[0][x]), because beyond field you aer checking, there only two other fields ;) So in horizontal and vertical checking one for is enough (moreover, you can check both this possibilities in one for). And for checking diagonals, for is not needed - its only two possibilities to win game this way. public static boolean isHorizontalSolved(char[][] spelplan) { boolean solved = false; for (int y = 1; y &lt; spelplan.length; y++) { if ((spelplan[y][1] == spelplan[y][2]) &amp;&amp; (spelplan[y][1] == spelplan[y][3]) &amp;&amp; (spelplan[y][1] != ' ')) { solved = true; } } return solved; } public static boolean isVerticalSolved(char[][] spelplan) { boolean solved = false; for (int y = 1; y &lt; spelplan.length; y++) { if ((spelplan[1][y] == spelplan[2][y]) &amp;&amp; (spelplan[1][y] == spelplan[3][y]) &amp;&amp; (spelplan[1][y] != ' ')) { solved = true; } } return solved; } public static boolean isDiagonalSolved(char[][] spelplan) { boolean solved = false; if ((spelplan[1][1] == spelplan[2][2]) &amp;&amp; (spelplan[1][1] == spelplan[3][3]) &amp;&amp; (spelplan[1][1] != ' ')) { solved = true; } if ((spelplan[1][3] == spelplan[2][2]) &amp;&amp; (spelplan[1][3] == spelplan[3][1]) &amp;&amp; (spelplan[1][3] !=…

http://stackoverflow.com/a/27428026
answers question: http://stackoverflow.com/q/27427302
upvote count: 1
type: AcceptedAnswer
has body: In my experience, the speed at which you scroll through a scroll pane does not (and should not) change dynamically based on the pane's size (e.g. how many elements are in a view port's list or something.) That said, if you need to, try this: int getNewScrollSpeed( int scrollPaneHeight ){ // you'll have to play around with the multiplier value to make it work for you // here I just chose 0.5 as an example return (int) ( scrollPaneHeight * 0.5 ); } Then call this routine like this, whenever the scrollPane's or window's (etc.) height changes. /* scrollPane height changes occur here */ scrollPane.getVerticalScrollBar().setUnitIncrement( getNewScrollSpeed ( scrollPane.getHeight() );
type: Answer
downvote count: 0
score: 1
accepted answer of: http://stackoverflow.com/q/27427302

http://stackoverflow.com/q/27316473
has answer: http://stackoverflow.com/a/27321962
tagged with: java
tagged with: hibernate
has body: I just started creating project in Hibernate, and I have problem at the begining. While I try create a simple table I get these errors: Dec 05, 2014 1:50:09 PM org.hibernate.ejb.HibernatePersistence logDeprecation WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead. Dec 05, 2014 1:50:09 PM org.hibernate.ejb.HibernatePersistence logDeprecation WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead. Dec 05, 2014 1:50:09 PM org.hibernate.ejb.HibernatePersistence logDeprecation WARN: HHH015016: Encountered a deprecated javax.persistence.spi.PersistenceProvider [org.hibernate.ejb.HibernatePersistence]; use [org.hibernate.jpa.HibernatePersistenceProvider] instead. Dec 05, 2014 1:50:09 PM org.hibernate.jpa.internal.util.LogHelper logPersistenceUnitInformation INFO: HHH000204: Processing PersistenceUnitInfo [ name: NewPersistenceUnit ...] Dec 05, 2014 1:50:09 PM org.hibernate.Version logVersion INFO: HHH000412: Hibernate Core {4.3.7.Final} Dec 05, 2014 1:50:09 PM org.hibernate.cfg.Environment <clinit> INFO: HHH000206: hibernate.properties not found Dec 05, 2014 1:50:09 PM org.hibernate.cfg.Environment buildBytecodeProvider INFO: HHH000021: Bytecode provider name : javassist Dec 05, 2014 1:50:10 PM org.hibernate.annotations.common.reflection.java.JavaReflectionManager <clinit> INFO: HCANN000001: Hibernate Commons Annotations {4.0.5.Final} Dec 05, 2014 1:50:10 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure WARN: HHH000402: Using Hibernate built-in connection pool (not for production use!) Dec 05, 2014 1:50:10 PM org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl buildCreator INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL…
type: Question
tagged with: intellij-idea
tagged with: jpa
linked to: http://stackoverflow.com/q/438146
has answer: http://stackoverflow.com/a/27319517
has title: Hibernate exception when create table
score: 0
has answer: http://stackoverflow.com/a/27316860
answer count: 5
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43103676
has answer: http://stackoverflow.com/a/27316938
has answer: http://stackoverflow.com/a/27316863

mockito
tags question: http://stackoverflow.com/q/27421417
tags question: http://stackoverflow.com/q/27326570
tags question: http://stackoverflow.com/q/27462966
tags question: http://stackoverflow.com/q/27447035
tag name: mockito
tags question: http://stackoverflow.com/q/27381326
tags question: http://stackoverflow.com/q/27457044
tags question: http://stackoverflow.com/q/27383684
type: Tag
tags question: http://stackoverflow.com/q/27352503
tags question: http://stackoverflow.com/q/27323117
tags question: http://stackoverflow.com/q/27351797

http://stackoverflow.com/comment/43204700
type: Comment
score: 2
has text: @Angew It's still redundant in recent versions of Java since unboxing happens automatically, at least in a majority of cases.
type: AnswerComment
comment on: http://stackoverflow.com/a/27371089

http://stackoverflow.com/comment/43264382
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27410004
has text: Try defining `String inLine;` before the while loop. Also, your function is called `doReadWriteTextFile`, but you're calling `doReadTextFile`.

http://stackoverflow.com/a/27329334
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43119856
answers question: http://stackoverflow.com/q/27328015
has body: Your mapping uses mappedBy, which among other settings, does inject the inverse="true" setting to the one-to-many end. Read more about this here: inverse = “true” example and explanation by mkyong In a nutshell, that means, that Hibernate is instructed: the other (many-to-one) end will care about persisting. Also, try to go through this example in documentation 23.2. Bidirectional one-to-many This example shows inverse in action, some essential cites: ... Now that the Child entity is managing the state of the link, we tell the collection not to update the link. We use the inverse attribute to do this: &lt;set name="children" inverse="true"&gt; &lt;key column="parent_id"/&gt; &lt;one-to-many class="Child"/&gt; &lt;/set&gt; The following code would be used to add a new Child: Parent p = (Parent) session.load(Parent.class, pid); Child c = new Child(); c.setParent(p); p.getChildren().add(c); session.save(c); session.flush(); Only one SQL INSERT would now be issued. So what we see there? inverse setting is what we need. It improves performance (and we have it due to mappedBy) but it is not enough to set the relation on the one-to-many side. We MUST set a parent to each child. So, you should extend this: UserGroup userGroup = new UserGroup(kode, nama); userGroup.setHakAksesSet(new HashSet&lt;HakAkses&gt;(hakAksesList)); // this is not enough - we also MUST // FOR each HakAkses in the list // SET a Parent, i.e hakAksses.setUserGroup(userGroup) Finally, there (almost) always should be cascading turned on. One should not care about that manually: @OneToMany(mappedBy = "userGroup", cascade = CascadeType.ALL)
accepted answer of: http://stackoverflow.com/q/27328015
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43119814

http://stackoverflow.com/q/27394939
has comment: http://stackoverflow.com/comment/43236570
tagged with: swing
has answer: http://stackoverflow.com/a/27395060
type: Question
has body: I am trying to display username after user Login to the system in Java. There have any way? login.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // JDBC driver name and database URL final String JDBC_DRIVER = "com.mysql.jdbc.Driver"; final String DB_URL = "jdbc:mysql://localhost/unimas"; // Database credentials final String USER = "root"; final String PASS = "shojib420"; Connection conn = null; Statement stmt = null; try { dec(); } catch (NoSuchAlgorithmException e2) { // TODO Auto-generated catch block e2.printStackTrace(); } //String name=name2.getText(); String username=user1.getText(); //String faculty=fac1.getText(); if(username.equalsIgnoreCase("") || password.equalsIgnoreCase("")) { JOptionPane.showMessageDialog(contentPane, "OOPS You miss some filed"); } else { try { Class.forName("com.mysql.jdbc.Driver"); conn = (Connection) DriverManager.getConnection(DB_URL, USER, PASS); stmt = (Statement) conn.createStatement(); /* String sql="INSERT INTO useruser " + "VALUES (username,password, name,faculty)";*/ String sql="SELECT * FROM useruser WHERE username='"+username+"' and password='"+password+"' "; ResultSet rs=stmt.executeQuery(sql); if(rs.next()) { dashboard d=new dashboard(); d.setVisible(true); d.name=username; dispose(); } else { JOptionPane.showMessageDialog(contentPane, "Sorry "+password); } }catch(SQLException se){ //Handle errors for JDBC se.printStackTrace(); }catch(Exception e1){ //Handle errors for Class.forName e1.printStackTrace(); } } } }); Here d.name=username; name is in the dashboard class where I am trying to set d.name=username; , But i am not able to get the value of username JTextArea showName = new JTextArea(); showName.setBounds(29, 25, 105, 22); contentPane.add(showName); showName.setName(name); I am calling that name in dashboard class. Any idea where I am doing wrong or better suggestion?
score: 0
has title: How can I get the username after successful login?
answer count: 1
accepted answer: http://stackoverflow.com/a/27395060
has comment: http://stackoverflow.com/comment/43236613
type: AnsweredQuestion
tagged with: oop
tagged with: java

http://stackoverflow.com/q/27403758
tagged with: eclipse
type: Question
has answer: http://stackoverflow.com/a/27424383
score: 0
answer count: 2
tagged with: oracle-database
tagged with: windows
has title: Runnable Jar Files slow compared to Eclipse
type: UnansweredQuestion
has body: I have found only a small number of Threats about this Problem, but nothing seems to solve it. My code runs in Eclipse under 10 seconds. If I extract this Project into a runnable jar file it takes over 5-10 minutes. What I do: I read two .txt files, combine them, sort them, separate them and save them. This is my code: package de.***.timcooparser; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List; import javax.swing.JOptionPane; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import com.google.code.externalsorting.ExternalSort; public class TimCooParser { private static List&lt;String&gt; listCoordinates = new ArrayList&lt;String&gt;(); private static List&lt;String&gt; listTimestamps = new ArrayList&lt;String&gt;(); private static List&lt;String&gt; listTimeCoord = new ArrayList&lt;String&gt;(); public static void main(String[ ] args) throws IOException { //Start Time long d1 = System.currentTimeMillis(); //Create Path String path = new File("").getAbsolutePath(); //Readfiles File fileTimeCoord = new File (path+"\\TimestampsCoordinates.txt"); File fileTimeCoord2 = new File (path+"\\TimestampsCoordinates2.txt"); File fileCoordinates = new File (path+"\\Coordinates.txt"); File fileTimestamps = new File (path+"\\Timestamps.txt"); try{ if (fileTimeCoord.exists()){ fileTimeCoord.delete(); } fileCoordinates.createNewFile(); //Read Coordinates an Timestamps and merge them InputStream is1 = new FileInputStream(fileTimestamps); InputStreamReader instrm1 = new InputStreamReader(is1); BufferedReader br1 = new BufferedReader(instrm1); InputStream is2 = new FileInputStream(fileCoordinates); InputStreamReader instrm2 = new InputStreamReader(is2); BufferedReader br2 = new BufferedReader(instrm2); …
has answer: http://stackoverflow.com/a/27403959
tagged with: java

http://stackoverflow.com/comment/43143212
comment on: http://stackoverflow.com/a/27341355
type: AnswerComment
has text: Many thanks but i want you to know i'm a beginner in android and I want to improve my skills from the other experience
score: 0
type: Comment

http://stackoverflow.com/comment/43282528
comment on: http://stackoverflow.com/q/27419590
has text: I think that getClickCount() returns a classic double click. In my case, i can click wait for a while and only if i click again the cell becomes editable
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43364681
type: Comment
comment on: http://stackoverflow.com/a/27464087
type: AnswerComment
has text: I've added an example to my original answer.
score: 0

http://stackoverflow.com/comment/54341703
score: 1
type: AnswerComment
has text: @JochenDB Actually we think that loading statically the variable would do the thrick. I would do it on on a static block. Something like this: public class Mask extends UDF { static{ clave = getFirstLine( arch_clave ); } }
type: Comment
comment on: http://stackoverflow.com/a/27424131

http://stackoverflow.com/a/28194616
has body: Your current code is the equivalent of trying to set the value of the column to the string "geometry::STGeomFromText('POINT (30 -20)',4326)" which obviously doesn't work as a string value of a function call is not the same as a function call itself. UpdateString can only be used to set a value, not call a function. Based on the error message, you need to use a hex string with the already encoded coordinate. I don't know if there is a method available in Java to calculate this, so I fear your existing workaround using UPDATE might be the only solution available to you.
accepted answer of: http://stackoverflow.com/q/27315366
answers question: http://stackoverflow.com/q/27315366
score: 0
type: AcceptedAnswer
type: Answer

http://stackoverflow.com/comment/43220567
comment on: http://stackoverflow.com/a/27386096
type: Comment
score: 0
has text: Need for naps and misreading `String[]args` as `String[args` are strongly connected.
type: AnswerComment

http://stackoverflow.com/a/27363989
has comment: http://stackoverflow.com/comment/43200065
has body: Server side seems ok. I write this few line of code: I write a simple class test @JsonIgnoreProperties(ignoreUnknown = true) public class Test { String text; int number; public int getNumber() { return number; } public String getText() { return text; } public Test(String text, int number) { super(); this.text = text; this.number = number; } public Test() { super(); } } And a simple client public class Application { public static void main(String args[]) { RestTemplate restTemplate = new RestTemplate(); List&lt;Test&gt; list = new ArrayList&lt;Test&gt;(); Test request = new Test(); request.number = 1; request.text = "txt1"; Test request2 = new Test(); request2.number = 2; request2.text = "txt2"; list.add(request); list.add(request2); @SuppressWarnings("rawtypes") ResponseEntity&lt;ArrayList&gt; test = restTemplate.postForEntity("http://localhost:8080/postevent", list, ArrayList.class); System.out.println(test.getBody().toString());//show json for(int i =0; i&lt;list.size();i++){ System.out.println("number "+list.get(i).number +" text "+ list.get(i).text); } } } Server side: @RestController @RequestMapping(value = "/postevent") public class PostEvent { @RequestMapping(method = RequestMethod.POST, consumes= "application/json", produces = "application/json") public @ResponseBody List&lt;Test&gt; getTickets(@RequestBody List&lt;Test&gt; list) { for(int i =0; i&lt;list.size();i++){ System.out.println("number "+list.get(i).number +" text "+ list.get(i).text); } return list; } }
score: 0
has comment: http://stackoverflow.com/comment/43313729
type: Answer
answers question: http://stackoverflow.com/q/27362328

vaadin
tags question: http://stackoverflow.com/q/27344048
tags question: http://stackoverflow.com/q/27421350
tags question: http://stackoverflow.com/q/27439227
tag name: vaadin
type: Tag
tags question: http://stackoverflow.com/q/27387629
tags question: http://stackoverflow.com/q/27333960
tags question: http://stackoverflow.com/q/27363314
tags question: http://stackoverflow.com/q/27410868
tags question: http://stackoverflow.com/q/27375745
tags question: http://stackoverflow.com/q/27474418
tags question: http://stackoverflow.com/q/27316356
tags question: http://stackoverflow.com/q/27376820
tags question: http://stackoverflow.com/q/27386012
tags question: http://stackoverflow.com/q/27352525
tags question: http://stackoverflow.com/q/27462728
tags question: http://stackoverflow.com/q/27342061

http://stackoverflow.com/comment/43335585
comment on: http://stackoverflow.com/a/27445931
has text: Is RAND_MAX inclusive or exclusive? If it is inclusive, you appear to have a very small chance of getting RAND_MAX, and thus `limit` inclusive.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43332640
type: Comment
type: QuestionComment
score: 0
has text: it's because it's a reserved character, and so you need to escape it with \\ [double backslash])
comment on: http://stackoverflow.com/q/27446851

http://stackoverflow.com/comment/43102817
score: 1
has text: The code in the comment at the top of the pastebin is not initializing the ReadDataMember classes with a type. use "new ReadDataMembers<Member>("member.dat");" as the constructor. You can also remove the <T> from the method signature. I thought we working with making a generic method, but not a generic class.
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27320916

http://stackoverflow.com/comment/43266653
type: QuestionComment
has text: @EJP `netstat -pant` reports it's in a `TIME_WAIT` state just before I get the connection error.
score: 0
comment on: http://stackoverflow.com/q/27410995
type: Comment

http://stackoverflow.com/q/27369013
type: Question
tagged with: graph
has answer: http://stackoverflow.com/a/27369051
tagged with: arrays
accepted answer: http://stackoverflow.com/a/27369051
has title: How to make this output backwards
tagged with: while-loop
score: 2
answer count: 1
downvote count: 0
favorite count: 0
type: AnsweredQuestion
has body: So I have written a program that implements graphs in java and have gotten everything how i want it to work minus printing my path array in the correct order. public void printThePaths(int v) { for(int i = 0; i &lt; path.length;i++){ System.out.println("From " + v + " to " + i); int n = i; while(n != -1) { System.out.print(n); n = path[n]; } System.out.println(); //System.out.print(path[i] + ", "); } System.out.println(); }//end At this point the paths array looks like this: path[] = {3,5,4,-1,4} So when I run my printThePaths method it outputs like this: From 4 to 0 0324 From 4 to 1 154 From 4 to 2 24 From 4 to 3 324 From 4 to 4 4 From 4 to 5 54 Well the paths are printing in reverse order and I'm wondering what the best approach would be to print them in the opposite direction (aka from 4 to 0 would be : 4, 3, 2 , 0). Just so everyone understands, the number inside the index is that index's parent.
upvote count: 2
tagged with: java

http://stackoverflow.com/a/27345013
has body: JPanels don't support ActionListeners because they don't have a natural action. For buttons, the natural action is clicking on them, so it makes sense to have an ActionListener that fires when they are clicked. JPanels are not buttons. If you want to detect clicks on a JPanel, you need to add a MouseListener, not an ActionListener.
accepted answer of: http://stackoverflow.com/q/27344947
type: AcceptedAnswer
answers question: http://stackoverflow.com/q/27344947
upvote count: 5
type: Answer
downvote count: 0
score: 5

http://stackoverflow.com/a/27387356
has body: Try this: OrthographicCamera cam = new OrthographicCamera(1000, 800); SpriteBatch batch = new SpriteBatch(); Maps map = new Maps(); in your render/update method: batch.setProjectionMatrix(cam.combined); batch.begin(); map.renderBackground(batch); batch.end(); in your Maps render method: batch.draw(backgroundTexture, 0, 0, 1000, 800); //x, y, width, height
has comment: http://stackoverflow.com/comment/43229275
score: 0
type: AcceptedAnswer
type: Answer
accepted answer of: http://stackoverflow.com/q/27378963
answers question: http://stackoverflow.com/q/27378963

http://stackoverflow.com/a/27362801
accepted answer of: http://stackoverflow.com/q/27362563
answers question: http://stackoverflow.com/q/27362563
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43178071
has comment: http://stackoverflow.com/comment/43177879
has comment: http://stackoverflow.com/comment/43178179
type: Answer
has comment: http://stackoverflow.com/comment/43178043
score: 2
has comment: http://stackoverflow.com/comment/43178193
upvote count: 2
has body: You should never pass around connected result sets: A CachedRowSet object is special in that it can operate without being connected to its data source, that is, it is a disconnected RowSet object. It gets its name from the fact that it stores (caches) its data in memory so that it can operate on its own data rather than on the data stored in a database. The CachedRowSet interface is the superinterface for all disconnected RowSet objects, so everything demonstrated here also applies to WebRowSet, JoinRowSet, and FilteredRowSet objects. Convert the connected resultset to a disconnected RowSet and close the Statement/PreparedStatement and Connection before you return the RowSet. Using CachedRowSets Tutorial If you are doing it wrong already this is the correct way to deal with it: You must call .close() in a finally block to guarantee that the code is run! public void badFormPassingAroundConnectedResultSets(@Nonnull final ResultSet rs) { try { while (rs.next()) { /* do something */ } } catch (final SQLException e) { throw new RuntimeException(e); // or log.error() but NEVER empty } finally { try { rs.getStatement().getConnection().close(); } catch (final SQLException e) { LOG.error(e.getMessage(), e); } } } } Note: Calling .close() on a Connection object will call .close() on all the child objects that have a reference to it as well.

http://stackoverflow.com/a/27410142
downvote count: 0
has comment: http://stackoverflow.com/comment/43265139
has comment: http://stackoverflow.com/comment/43281353
type: Answer
has comment: http://stackoverflow.com/comment/43264979
has comment: http://stackoverflow.com/comment/43265125
has comment: http://stackoverflow.com/comment/43294376
upvote count: 3
score: 3
has body: There are actually more than 2 options. All of them are described in the docs (see http://docs.groovy-lang.org/2.3.8/html/documentation/#_integrating_groovy_in_a_java_application), but in any case, I wouldn't recommand using JSR-223 (javax.script) because it is a very poor integration mechanism. Using for example a GroovyShell or a GroovyClassLoader, you can set your own base script class which would let you set your foo instance very easily, but you could also call any method from your base script class. BTW, the method that all Groovy scripts will implement is not do but run. So imagine you have the following base class: public abstract class MyDSL extends groovy.lang.Script { Object fooObj public void setFooObj(Object foo) { fooObj = foo; } public Object getFooObj() { return fooObj; } } and a holder class for Foo like this: public class FooHolder { def getFoo() { return 1234; } } then you can create a script this way: CompilerConfiguration config = new CompilerConfiguration(); config.setScriptBaseClass("test.MyDSL"); GroovyClassLoader gcl = new GroovyClassLoader(this.getClass().getClassLoader(),config); Class&lt;? extends MyDSL&gt; scriptClass = gcl.parseClass("return (fooObj.getFoo()==1234)"); MyDSL v1 = scriptClass.newInstance(); v1.setFooObj(new FooHolder()); Object result = v1.run(); Note that this is really one way to do this, but not necessarily the best one given your needs. Maybe you could describe a bit more what you want to achieve but Groovy has a lot of options, from compiling scripts like this, to compiling classes which extend your own classes or interfaces. Take a look at the docs and let us know.
answers question: http://stackoverflow.com/q/27408972

http://stackoverflow.com/q/27439706
has title: Concurrent processing of dataset
type: Question
type: AnsweredQuestion
score: -1
tagged with: concurrency
answer count: 1
downvote count: 1
favorite count: 0
has body: I've got the following scenario: There are two SQL-databases. I have to read a bunch of rows from the first DB, extract an XML field from a row, transform it with XSLT and some other logic, and insert it into the second DB. XSLT transformation is rather expensive (300 ms per row approximately), and I assume that concurrent processing of this transformation would speed up my migration. The question is: how to manage the read process from the first DB? To read all rows into collection as a bulk and following concurrent processing looks like bad idea. Is there some kind of pattern here?
has answer: http://stackoverflow.com/a/27439801
accepted answer: http://stackoverflow.com/a/27439801
upvote count: 0
tagged with: java

http://stackoverflow.com/q/27348768
has answer: http://stackoverflow.com/a/27348852
has title: How do I name and get my listall() method to be called on my program?
type: UnansweredQuestion
upvote count: 0
linked to: http://stackoverflow.com/q/19241187
favorite count: 0
duplicate of: http://stackoverflow.com/q/19241187
type: Question
has body: I am new to coding, and I am doing a class project, I am suppose to write a main class that reads from the file and then do several stuff with it. I am having trouble getting my listall() method to work, I am not sure how to name is or what the parameters (if any) should be. I am trying to get a value from the keyboard and depending on a value call a certain method, for now I only have the listall() method and I want the user to input l or L and that would make the listall() method be called. However I have been trying since the morning and looking through various tutorials but I don't understand how I am suppose to set this up. Help? I have already tested a lot with my program, I can use it to get certain attributes that I want from my 'candidate class' I created. Here is my code for my main class, i have commented out certain lines to work on specific parts of the program. please help, I am lost. import java.io.*; import java.util.Scanner; public class appl { public static void main (String [] args) throws IOException { String fileName = "C:/Users/mrodri34/Documents/cipcs115.txt"; File candidates = new File(fileName); Scanner scan = new Scanner(candidates); Scanner user = new Scanner(System.in); String state = scan.next(); int numOfCan = scan.nextInt(); String what = scan.nextLine(); //System.out.println(what); int count = 1; int i; int o = 1; Candidate [] candi = new Candidate[3]; for ( i=0; i&lt;numOfCan; i++) { String three = scan.next(); String four = scan.next(); String five = scan.next(); int six = scan.nextInt(); double seven = scan.nextDouble(); String eight = scan.nextLine(); //String nine = scan.nextLine(); Candidate night = new Candidate (three,four,five,six,seven,eight); candi [i] = night ; System.out.println(night.getName() + " " + night.getMotto()); } System.out.println(candi[0].getName()); System.out.println(candi[1].getName()); //Candidate [] candi = new Candidate[3]; //Candidate night = new Candidate (three,four,five,six,seven,eight); //candi [0] …
score: -1
tagged with: java
downvote count: 1
answer count: 1
has comment: http://stackoverflow.com/comment/43152349

http://stackoverflow.com/a/27314949
type: Answer
has body: I want you to just change the end indeces of the substring() methods as given below String convertedDate = dataPar.substring(0,4) + dataPar.substring(5,7) + dataPar.substring(8,10); I tested, It works Fine as you requested :)
score: 0
answers question: http://stackoverflow.com/q/27314682

http://stackoverflow.com/comment/43307532
type: QuestionComment
score: 5
comment on: http://stackoverflow.com/q/27433222
has text: You're ***really*** not supposed to close the STDIN stream, anyway...
type: Comment

http://stackoverflow.com/q/27351199
tagged with: java
tagged with: image-processing
has title: Why is my text-to-image method returning a fully-black image?
type: Question
has comment: http://stackoverflow.com/comment/43156599
has comment: http://stackoverflow.com/comment/43156590
score: 0
answer count: 1
has body: I'm trying to make a method that converts a given String (and Font) into a BufferedImage. However, every time I run it, it returns a fully black image. The exact size of the image seems to be correct, but all pixels are perfectly black. Here's the code: static final GraphicsEnvironment GE; static { GE = GraphicsEnvironment.getLocalGraphicsEnvironment(); } public static BufferedImage textToImage(String text, Font font) { if (font == null) font = Font.getFont("Courier New"); FontRenderContext frc = new FontRenderContext(new AffineTransform(), false, false); Rectangle2D bounds = font.getStringBounds(text, frc); BufferedImage bi = new BufferedImage( (int)(bounds.getWidth() + .5), (int)(bounds.getHeight() + .5), BufferedImage.TYPE_BYTE_BINARY ); Graphics2D g = GE.createGraphics(bi); g.setFont(font); g.drawString(text, 0, 0); return bi; } Here's "Hello World" in the default JOptionPane font displayed as a JOptionPane's icon:
has answer: http://stackoverflow.com/a/27351342
accepted answer: http://stackoverflow.com/a/27351342
type: AnsweredQuestion
tagged with: fonts

http://stackoverflow.com/comment/46922903
has text: The current snapshot of Spring Batch Admin (and I believe 2.0.0.M1) both have the fix so that if you don't use `@EnableBatchProcessing`, everything should work (you get the builders, etc automatically configured)
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27406555
score: 1

http://stackoverflow.com/q/27423061
downvote count: 0
has body: When using synchronized block or method, we synchronized by mutable object. But I don't understand how to use Locks with Conditions from j.u.c.. I'm trying to solve puzzle with two workers and a cart with lock and conditions. When first worker add weight to the cart - second wait. When cart is full, than first worker wait and second releases the cart. I create two threads for each worker and use one cart. But in reality only one thread performs (worker, that add weight) until cart is full. Than program blocks. What I'm doing wrong and what I misunderstand? That's my implementation of this puzzle. package puzzles.workers; public enum WorkerType { ADDER, REDUCER; } Cart class package puzzles.workers; public class Cart { private static final int INITIAL_CAPACITY = 10; private static final int INITIAL_WEIGHT = 0; private int capacity; private int weight; public Cart() { this(INITIAL_CAPACITY); } public Cart(int capacity) { this.capacity = capacity; weight = INITIAL_WEIGHT; } public void addWeight() { weight++; } public void reduceWeight() { weight--; } public int getCapacity() { return capacity; } public int getWeight() { return weight; } } Worker class. package puzzles.workers; import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantLock; public class WorkerWithLock implements Runnable { private final Cart cart; private WorkerType workerType; final Lock lock = new ReentrantLock(); final Condition whenEmpty = lock.newCondition(); final Condition whenFull = lock.newCondition(); public WorkerWithLock(Cart cart, WorkerType workerType) { this.cart = cart; this.workerType = workerType; } @Override public void run() { while (true) { if (workerType == WorkerType.ADDER) { try { addWeight(); } catch (InterruptedException e) { e.printStackTrace(); Thread.currentThread().interrupt(); } } else { try { reduceWeight(); } catch (InterruptedException e) { e.printStackTrace(); Thread.currentThread().interrupt(); } }…
has answer: http://stackoverflow.com/a/27424458
answer count: 1
favorite count: 0
upvote count: 2
tagged with: locks
tagged with: multithreading
has title: Puzzle about two workers and a cart. Usage lock and conditions doesn't work
accepted answer: http://stackoverflow.com/a/27424458
type: AnsweredQuestion
score: 2
tagged with: conditional-statements
tagged with: java
type: Question

http://stackoverflow.com/a/27394358
has body: this.textfile is most likely null, ensure you initialise it properly: this.textfile = new String[your_size]; Or, as suggested, rather use a List implementation such as ArrayList: private final List&lt;String&gt; textFile = new ArrayList&lt;String&gt;();
score: 1
upvote count: 1
has comment: http://stackoverflow.com/comment/43235715
downvote count: 0
answers question: http://stackoverflow.com/q/27394290
type: Answer
has comment: http://stackoverflow.com/comment/43235731

http://stackoverflow.com/q/27418426
tagged with: java
score: -1
has answer: http://stackoverflow.com/a/27418662
type: Question
linked to: http://stackoverflow.com/q/17439683
answer count: 2
upvote count: 0
has answer: http://stackoverflow.com/a/27419101
favorite count: 0
has title: How to change tge height of the system bar (footer bar) in my android application?
linked to: http://stackoverflow.com/q/12605266
tagged with: android
has body: I m working in an android project. This project contains many activities. I m trying to remove the system bar (footer bar) from one fo the existing activities. But it is not possible according to this link. My idea now is to decrease the height of the system bar as much as possible. I make some research and I found that I could change the height of the system bar via the xml file res/values/dimens.xml I could not find this file on my source code. I do not know how to create a such file (syntax) and I do not know how to mention the new dimension of the system bar. And I m looking to change the height of the system bar for only a giving activity and not for all activities of my android application
tagged with: http://stackoverflow.com/tag/xml
type: UnansweredQuestion
downvote count: 1

http://stackoverflow.com/comment/43219816
type: Comment
comment on: http://stackoverflow.com/q/27385692
type: QuestionComment
has text: What do you mean a mutual parameter?
score: 0

http://stackoverflow.com/q/27395604
has title: Calender in java returning the same date when changing the time zone?
tagged with: java
has answer: http://stackoverflow.com/a/27395704
type: UnansweredQuestion
type: Question
has body: I am working on a project where I have to manipulate the dates. Here is the code snipper I have My time zone is IST and the conversion time zone is CST. public class Sample { public static Long time = 1418187600l; public static TimeZone tz1 = TimeZone.getTimeZone("US/Central"); public static void main(String[] args) { Calendar c1 = Calendar.getInstance(); System.out.println(c1.getTime()); // output1 c1.setTimeInMillis(time*1000); System.out.println(c1.getTime());//output 2 System.out.println(c1.get(Calendar.DATE)); c1.setTimeZone(tz1);; System.out.println(c1.getTime()); //output 3 System.out.println(c1.get(Calendar.DATE)); } } When I ran the program, I got Wed Dec 10 13:03:42 IST 2014 for line which was correct. Then set the time to 1418187600, this output was also correct. Wed Dec 10 10:30:00 IST 2014 However when the set the timezone to CST, and tried outputting the date, it returned the same Wed Dec 10 10:30:00 IST 2014 while it should have returned Dec 09 2014 23:00:00. However when I tried Calendar.data, it showed the correct date. can anyone explain to me why this is the case?
tagged with: datetime
score: 0
answer count: 1

http://stackoverflow.com/a/27369288
type: Answer
score: 3
has comment: http://stackoverflow.com/comment/43190314
has body: Question[] must be either: declared outside any method, as a class static member (since both methods are static) or be passed as a parameter to CheckIfCorrect. Note that if you do option 1, then all instances of the class will share the same value and some concurrency errors could happen. Also: According to universally accepted Java name conventions, Question[] should be called question[], and Questions() should be named something like askQuestions() ( a verb in camelcase ). CheckIfCorrect should be called checkIfCorrect ( method and variable name begin with lowercase ). Example 1 public class ThisClass { private static String[] question = new String [5]; //declaration public static void ask(){ question[0] = ""; question[1] = ""; &lt;---- these actually contain stuff in them, I just filtered them out. for (int i=0; i&lt;=4; i++){ JOptionPane.showInputDialog(question[i]); } } public static int check(){ int score = 0; if (question[0].equals("a")) { score++; } } } Example 2 public class ThisClass { public static void ask(){ String[] question = new String[5]; question[0] = ""; question[1] = ""; &lt;---- these actually contain stuff in them, I just filtered them out. for (int i=0; i&lt;=4; i++){ JOptionPane.showInputDialog(question[i]); } } public static int check(String[] param){ int score = 0; if (param[0].equals("a")) { score++; } } }
upvote count: 3
has comment: http://stackoverflow.com/comment/43206082
downvote count: 0
answers question: http://stackoverflow.com/q/27369287
has comment: http://stackoverflow.com/comment/43202241

while-loop
tags question: http://stackoverflow.com/q/27348322
tags question: http://stackoverflow.com/q/27369013
type: Tag
tags question: http://stackoverflow.com/q/27366438
tags question: http://stackoverflow.com/q/27363689
tags question: http://stackoverflow.com/q/27340064
tags question: http://stackoverflow.com/q/27440038
tags question: http://stackoverflow.com/q/27369952
tags question: http://stackoverflow.com/q/27344693
tags question: http://stackoverflow.com/q/27348662
tags question: http://stackoverflow.com/q/27387404
tags question: http://stackoverflow.com/q/27373201
tags question: http://stackoverflow.com/q/27435380
tags question: http://stackoverflow.com/q/27444293
tags question: http://stackoverflow.com/q/27441425
tags question: http://stackoverflow.com/q/27468820
tags question: http://stackoverflow.com/q/27436188
tags question: http://stackoverflow.com/q/27447304
tags question: http://stackoverflow.com/q/27391319
tags question: http://stackoverflow.com/q/27345550
tags question: http://stackoverflow.com/q/27462218
tags question: http://stackoverflow.com/q/27334455
tags question: http://stackoverflow.com/q/27338254
tags question: http://stackoverflow.com/q/27338732
tags question: http://stackoverflow.com/q/27386626
tags question: http://stackoverflow.com/q/27339609
tags question: http://stackoverflow.com/q/27455293
tags question: http://stackoverflow.com/q/27346907
tags question: http://stackoverflow.com/q/27434276
tag name: while-loop
tags question: http://stackoverflow.com/q/27453057
tags question: http://stackoverflow.com/q/27468879

http://stackoverflow.com/comment/43503721
comment on: http://stackoverflow.com/a/27519323
has text: Now how i check login user session is writing a separated jag file to do the checking, all the other jag files will include this file.
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/a/27354930
has body: Default type of Java integer literals is int thats why integer method is getting invoked.
answers question: http://stackoverflow.com/q/27354857
score: 0
type: Answer

fold
tags question: http://stackoverflow.com/q/27379968
type: Tag
tag name: fold

http://stackoverflow.com/comment/43378010
comment on: http://stackoverflow.com/q/27471583
has text: You said that you was talking about the three vrtical dots (aka action overflow). Ok, maybe you was talking about the manu that appears when you click on the action overflow
score: 0
type: QuestionComment
type: Comment

http://stackoverflow.com/comment/43231815
comment on: http://stackoverflow.com/a/27389492
type: AnswerComment
has text: Because you are still using println("winner = " + cNameA[winner]), outside the function call. You set winner to 0 and it is not changed by the function call. Use the return value from the function call.
score: 0
type: Comment

http://stackoverflow.com/q/27466212
score: 0
answer count: 1
tagged with: security
accepted answer: http://stackoverflow.com/a/27466709
type: AnsweredQuestion
has body: Is it possible for a web site that uses either Java or Javascript to accomplish the installation (meaning: not just forced download) of an executable on a client Windows system (Windows 7 or newer) when user clicks on only one link on the website? So in this scenario, the user clicks on a link (e.g. some click-bait link) that is supposed to display some article or a video, on a website. Can this sole single click lead to both a forced download and actual installation of an executable on the users machine? I do not need, nor am I looking for, explicit detail on how this is done. I am more curious of whether this is even possible with the current Windows OS. In this case the user would be using a recent version of one of the following browsers: IE, FF, Chrome, or Opera.
has comment: http://stackoverflow.com/comment/43368462
has title: About a website installing an executable by using Java or JavaScript
type: Question
tagged with: java
has answer: http://stackoverflow.com/a/27466709
tagged with: javascript
tagged with: browser

http://stackoverflow.com/comment/43133279
comment on: http://stackoverflow.com/a/27338303
type: AnswerComment
score: 0
has text: Oh okay wow. I thought it was a while loop instead of an if statement in the flowchart. Thank you!
type: Comment

http://stackoverflow.com/q/27447406
tagged with: java
tagged with: jaxb
type: Question
has title: JAXB Marshalling generic Tree
has body: I have a generic Tree with a rather classical implementation: package tree; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import tree.persistence.EdgesAdapter; import tree.persistence.NodesAdapter; @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class Tree&lt;N, E&gt; { @XmlElement protected N root; /** * Map of nodes to adjacency outgoing of neighboring nodes to incident edges */ @XmlJavaTypeAdapter(NodesAdapter.class) protected Map&lt;N, Set&lt;E&gt;&gt; nodes; /** * Map of edges to incident nodes pairs */ @XmlJavaTypeAdapter(EdgesAdapter.class) protected Map&lt;E, Pair&lt;N&gt;&gt; edges; @SuppressWarnings("unused") private Tree() { } /** * */ public Tree(N root) { this.root = root; nodes = new HashMap&lt;N, Set&lt;E&gt;&gt;(); edges = new HashMap&lt;E, Pair&lt;N&gt;&gt;(); nodes.put(root, new HashSet&lt;E&gt;()); } public boolean addEdge(E edge, N parent, N child) { //code to add edge and child node here... } } and Pair class: package tree; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement(name = "pair") @XmlAccessorType(XmlAccessType.FIELD) public class Pair&lt;N&gt; { @XmlAttribute private N first; @XmlAttribute private N second; public Pair(N value1, N value2) { if (value1 == null || value2 == null) throw new IllegalArgumentException( "Pair cannot contain null values"); first = value1; second = value2; } @SuppressWarnings("unused") private Pair() { } public N getFirst() { return first; } public N getSecond() { return second; } } I have developped adapters so as to not have problems with stru…
has answer: http://stackoverflow.com/a/27462115
has comment: http://stackoverflow.com/comment/43333835
score: 0
answer count: 1
type: UnansweredQuestion

http://stackoverflow.com/q/27457565
has comment: http://stackoverflow.com/comment/43352579
has comment: http://stackoverflow.com/comment/43352348
linked to: http://stackoverflow.com/q/9512603
score: 0
has comment: http://stackoverflow.com/comment/43352417
has answer: http://stackoverflow.com/a/27457884
has comment: http://stackoverflow.com/comment/43352393
type: UnansweredQuestion
linked to: http://stackoverflow.com/q/15827430
has title: Running a 32-bit JVM is not supported in this platform in Intellij
tagged with: java
has body: While compiling my project, I'm getting error as 'Running a 32-bit JVM is not supported in this platform'. When I get this error: And I get this error when I change my JDK home path to '64-bit JDK' under Project structure -> Platform settings -> SDKs. Current Solution : Now if I change my SDK back to 32-bit JDK, it works fine. But when I have my SDK as 64-bit JDK, I'm getting the error as Running a 32-bit JVM is not supported in this platform. My Question Instead of changing my JDK, how to get out of this problem. More than that, my question is in, "Running a 32-bit JVM is not supported". Actually I'm not running any JVM here in Intellj. I'm just compiling my Java Source to get a .class files. What is the word running mean here...
has comment: http://stackoverflow.com/comment/43352368
type: Question
has comment: http://stackoverflow.com/comment/43352460
tagged with: intellij-idea
answer count: 1
tagged with: 32-bit
tagged with: compilation
has comment: http://stackoverflow.com/comment/43352519

http://stackoverflow.com/comment/43145886
type: Comment
has text: Your expectation is flawed. You should look up an ascii table.
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27345289

http://stackoverflow.com/q/27451001
tagged with: rootbeer
has comment: http://stackoverflow.com/comment/43342885
has comment: http://stackoverflow.com/comment/43344991
type: Question
score: 0
has comment: http://stackoverflow.com/comment/43342974
has body: I'm learning to use Rootbeer, so I did the following things : [1] Downloaded Rootbeer-1.2.3.jar [2] Installed CUDA Toolkit and CUDA Driver from : http://www.nvidia.com/content/cuda/cuda-downloads.html [3] Compiled the following sample program. [4] Ran ArrayMultApp from NetBeans 8.0.2 import java.util.List; import java.util.ArrayList; import org.trifort.rootbeer.runtime.Kernel; import org.trifort.rootbeer.runtime.Rootbeer; public class ArrayMultApp { public void multArray(int[] array) { List&lt;Kernel&gt; jobs=new ArrayList(); for (int i=0;i&lt;array.length;++i) jobs.add(new ArrayMult(array,i)); Rootbeer rootbeer=new Rootbeer(); rootbeer.run(jobs); } public static void main(String[] args) { ArrayMultApp app=new ArrayMultApp(); int[] array=new int[10]; for (int i=0;i&lt;array.length;++i) array[i]=i; for (int i=0;i&lt;array.length;++i) System.out.println("start array["+i+"]: "+array[i]); app.multArray(array); for (int i=0;i&lt;array.length;++i) System.out.println("final array["+i+"]: "+array[i]); } } class ArrayMult implements Kernel { private int[] m_source; private int m_index; public ArrayMult(int[] source,int index) { m_source=source; m_index=index; } public void gpuMethod() { m_source[m_index]*=11; } } But I got the following error message : start array[0]: 0 start array[1]: 1 start array[2]: 2 start array[3]: 3 start array[4]: 4 start array[5]: 5 start array[6]: 6 start array[7]: 7 start array[8]: 8 start array[9]: 9 Exception in thread "main" java.lang.ClassCastException: ArrayMult cannot be cast to org.trifort.rootbeer.runtime.CompiledKernel at org.trifort.rootbeer.runtime.CUDAContext.setKernel(CUDAContext.java:119)Java Result: 1 I have Intel Core i7 x 980, NVIDA GeForce GTX 780, and Java 8 on Win 7 64 bit. I copied the sample app from the Rootbeer site, why did I get the error message, and how to fix it ? Edit : I forgot to mention one thing, during the installation, it said I didn't have Microsoft Visual Studio, something like that and said some parts about t…
tagged with: runtime-error
has comment: http://stackoverflow.com/comment/43344217
has comment: http://stackoverflow.com/comment/43343047
has comment: http://stackoverflow.com/comment/43343214
has comment: http://stackoverflow.com/comment/43343263
answer count: 0
type: UnansweredQuestion
has title: Rootbeer runtime error, how to fix?
has comment: http://stackoverflow.com/comment/43351449
tagged with: java

merge
tags question: http://stackoverflow.com/q/27335073
tags question: http://stackoverflow.com/q/27444044
tags question: http://stackoverflow.com/q/27407958
tags question: http://stackoverflow.com/q/27346064
type: Tag
tags question: http://stackoverflow.com/q/27376189
tags question: http://stackoverflow.com/q/27368715
tag name: merge
tags question: http://stackoverflow.com/q/27331743

http://stackoverflow.com/comment/43456251
has text: If you decide to contact the developers and they provide an answer, could you come back here and share that answer, so others with a similar problem can also benefit?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27471807
score: 0

http://stackoverflow.com/comment/43220054
has text: @niiraj874u: If you “know the significance of load factor very well” your question doesn’t make much sense. After all, it’s the *only* purpose of the `load factor` to determine the `threshold` as `threshold = capacity * load factor`. Having a `threshold==capacity` is equivalent to having a `load factor` of one.
score: 1
type: AnswerComment
comment on: http://stackoverflow.com/a/27384645
type: Comment

http://stackoverflow.com/comment/43098812
type: Comment
type: QuestionComment
has text: A side note: package names should be clear and concise.
comment on: http://stackoverflow.com/q/27319776
score: 0

http://stackoverflow.com/q/27407522
tagged with: abstract
upvote count: 1
has comment: http://stackoverflow.com/comment/43259682
has body: On one hand, I have an abstract class with an abstract method. On the other hand, I have a child class which overrides the abstract method and specifies the "public" access modifier to it. Is it meaningful at all what visibility I give to my original abstract class' abstract method?
answer count: 1
tagged with: polymorphism
favorite count: 0
has comment: http://stackoverflow.com/comment/43260898
has comment: http://stackoverflow.com/comment/43260138
type: AnsweredQuestion
downvote count: 0
score: 1
tagged with: java
has answer: http://stackoverflow.com/a/27407614
accepted answer: http://stackoverflow.com/a/27407614
tagged with: methods
type: Question
has title: Access modifiers inheritance: on abstract methods
tagged with: inheritance

http://stackoverflow.com/q/27318336
has comment: http://stackoverflow.com/comment/43100282
tagged with: java
has body: I have a dialog box from where I have given a option to upload a file but its not working. I mean request in not going to controller. my code is shown below: My JSP Div content: Content of dialog Box is : Please select a file to upload : Java Script function: Now how i have to use form data to send this request to controller and again i should get a string response in success like uploaded succesfully. I have tried like this but its not working: Because i am not sure what should be the controller code as i got it from a site. if i use what i have mention here i am getting error like incorrect syntax i mean the data send by ajax call to controller is not correct syntactically to accept the form data i.e. so problem with what ajax call is sending and what controller code is expecting. Pls let me know what should be the correct way to implement how to send a file request in ajax call so the controller should get proper data. As saving file code is working fine if i will not use this ajax call files are getting saved properly. Now my controller code: private static final String KDC_FILE_UPLOAD_LOCATION_FOLDER = "/root/Desktop/Upload_Files/"; @RequestMapping(value= "/fileUploadForm",method = RequestMethod.POST) public String handleFileUpload(HttpServletRequest request, @RequestParam CommonsMultipartFile[] fileUpload) throws Exception { System.out.println("finally in controller "); if (fileUpload != null && fileUpload.length > 0) { for (CommonsMultipartFile aFile : fileUpload){ System.out.println("Saving file: " + aFile.getOriginalFilename()); if (!aFile.getOriginalFilename().equals("")) { aFile.transferTo(new File(FILE_UPLOAD_LOCATION_FOLDER + aFile.getOriginalFilename())); } } } // returns to the view "Result" return "File has been Uploaded Successfully"; } Changes in my spring Dispatcher servlet xml file is: i have added below line only as to use multipart Please let me know what is wrong in my code and if we can achieve the same results using some other approach. Spri…
type: Question
answer count: 1
tagged with: jsp
tagged with: javascript
has answer: http://stackoverflow.com/a/27322141
score: 0
has comment: http://stackoverflow.com/comment/43101047
has comment: http://stackoverflow.com/comment/43100500
has title: how to upload any file and save it to a specfic folder in spring mvc
has comment: http://stackoverflow.com/comment/43101754
has comment: http://stackoverflow.com/comment/43098958
has comment: http://stackoverflow.com/comment/43100326
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43101730
tagged with: spring
tagged with: spring-mvc

http://stackoverflow.com/q/27324527
has comment: http://stackoverflow.com/comment/43108799
score: 0
has comment: http://stackoverflow.com/comment/43108370
answer count: 2
has comment: http://stackoverflow.com/comment/43108480
has answer: http://stackoverflow.com/a/27324689
has comment: http://stackoverflow.com/comment/43108406
has answer: http://stackoverflow.com/a/27324734
tagged with: simpledateformat
tagged with: java
accepted answer: http://stackoverflow.com/a/27324689
possible better answer: http://stackoverflow.com/a/27324734
has body: I use below code in Java and works perfect! SimpleDateFormat format = new SimpleDateFormat("E, dd MMM yyyy HH:mm:ss z"); Date date = format.parse("Sun, 11 May 2014 23:11:51 +0430"); but in Android I got exception ! java.text.ParseException: Unparseable date: "Sun, 11 May 2014 23:11:51 +0430" (at offset 0) what's wrong ?!
type: AnsweredQuestion
type: Question
tagged with: android
has title: is SimpleDateFormat different in Java & Android?

http://stackoverflow.com/a/27395494
score: -1
has body: Try using two JVMs. From the kernel's point of view, the packets are sent by the JVM, and why should a sender's packets be echoed back to the very same process?
has comment: http://stackoverflow.com/comment/43237453
type: Answer
downvote count: 1
answers question: http://stackoverflow.com/q/27388115
has comment: http://stackoverflow.com/comment/43241137
upvote count: 0

http://stackoverflow.com/comment/43088834
score: 1
has text: No code, only hint, read the line, use StringTokenizer to get the tokens, try to convert them into integer with Integer.parseInt, the text part will not parse and throw NumberFormatException, handle that and move on to the next token. It there is no NFE, its an integer and add it to whatever variable you are using. And yes, you should first attempt to solve this, homework or not, before asking for help.
comment on: http://stackoverflow.com/q/27314326
type: Comment
type: QuestionComment

http://stackoverflow.com/q/27374618
score: 0
tagged with: java
answer count: 1
has body: I have two class, @Document public class PracticeQuestion { private int userId; private List&lt;Question&gt; questions; // Getters and setters } public class Question { private int questionID; private String type; // Getters and setters } My JSON doc is like this, { "_id" : ObjectId("506d9c0ce4b005cb478c2e97"), "userId" : 1, "questions" : [ { "questionID" : 1, "type" : "optional" }, { "questionID" : 3, "type" : "mandatory" } ] } How should I write the query method to find PracticeQuestion by userId and questionID using @Query annotation. Thanks for any suggestion.
has answer: http://stackoverflow.com/a/27395571
type: UnansweredQuestion
has title: Spring Data elasticsearch @Query annotation for nested objects
tagged with: spring-data-elasticsearch
type: Question
tagged with: elasticsearch

http://stackoverflow.com/q/27374954
type: UnansweredQuestion
tagged with: scala
has comment: http://stackoverflow.com/comment/43200257
has comment: http://stackoverflow.com/comment/43200211
has comment: http://stackoverflow.com/comment/43208082
tagged with: java
has body: Hi I am actually trying to deploy my application on AWS EC2 instance. For that I have my tomcat server running there. And I want to create a war file out of this play project. And there is no error that is shown in eclipse. My project directory is play-userReg : C:\playdemo&gt;play war play-userReg -o myapp.war ~ _ _ ~ _ __ | | __ _ _ _| | ~ | '_ \| |/ _' | || |_| ~ | __/|_|\____|\__ (_) ~ |_| |__/ ~ ~ play! 1.3.x-1.3.0RC1, http://www.playframework.org ~ ~ Warning: no application.mode defined in you conf/application.conf. Using DEV mode. Listening for transport dt_socket at address: 8000 14:25:36,029 INFO ~ Starting C:\playdemo\play-userReg 14:25:36,431 INFO ~ Precompiling ... 14:25:37,969 ERROR ~ @6keg3pk9m Cannot start in PROD mode with errors Compilation error (In /app/Global.java around line 8) The file /app/Global.java could not be compiled. Error raised is : GlobalSettings cannot be resolved to a type play.exceptions.CompilationException: GlobalSettings cannot be resolved to a type at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:256) at org.eclipse.jdt.internal.compiler.Compiler.handleInternalException(Compiler.java:679) at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:523) at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:292) at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:427) at play.Play.preCompile(Play.java:604) at play.Play.init(Play.java:308) at play.server.Server.main(Server.java:160) ~ Please fix compilation errors before packaging WAR ~ My build.sbt file is : name := """play-userReg""" version := "1.0-SNAPSHOT" libraryDependencies ++= Seq( "com.typesafe.play" %% "play" % "2.3.0" % "provided", "org.springframework" % "spring-core" % "3.2.2.RELEASE", "org.springframework" % "spring-context" % "3.2.2.RELEASE", "org.mongodb" % "mongo-java-driver" % "2.11.0", "org.springframework.data" % "spring-data-mongodb" % "1.2.0.RELEASE", "cglib" % "cgl…
has answer: http://stackoverflow.com/a/27387483
type: Question
has comment: http://stackoverflow.com/comment/43223055
has comment: http://stackoverflow.com/comment/43244261
tagged with: amazon-ec2
tagged with: amazon-web-services
score: 0
tagged with: playframework
has title: Not able to package Play framework with java project into war
has comment: http://stackoverflow.com/comment/43244310
answer count: 1
has comment: http://stackoverflow.com/comment/43261913

http://stackoverflow.com/q/27434168
has body: IN order to test couchbase, I am trying to create 30K-specific documents in 15 minutes. During the test, 6563 documents are created and then hangs. I have seen that it takes 2 minutes to create 0-3K thousand; 5 minutes to create between 3K-6K; and 5 minutes to create the final 6K -6.5K documents. Example here. I would appreciate help in understanding what I am doing wrong. The code is below: public class ConnectionManager { Logger logger = Logger.getLogger(getClass().getName()); private CouchbaseClient client; public ConnectionManager() { init(); } public void init() { try { logger.info("Opening base connection."); List&lt;URI&gt; hosts = Arrays.asList(new URI("http://127.0.0.1:8091/pools")); String bucket = "default"; String password = ""; client = new CouchbaseClient(hosts, bucket, password); } catch (Exception e) { client = null; throw new IllegalStateException(e); } } @PreDestroy public void destroy() { logger.info("Closing base connection."); if (client != null) { client.shutdown(); client = null; } } public CouchbaseClient getClient() { return client; } } public class DatabaseManager { ConnectionManager cm; public DatabaseManager() { cm = new ConnectionManager(); } public String addDocument(String result) { CouchbaseClient c = cm.getClient(); JSONParameters j = new JSONParameters(); String id = UUID.randomUUID().toString(); Date today = new Date(); SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss.SSSZ"); String date = DATE_FORMAT.format(today); j.setTime(date); j.setData(UUID.randomUUID().toString()); j.setSender_id(result); j.setFlag(false); Gson gson = new Gson(); String json = gson.toJson(j); c.add(result, json); return json; } public class DataBaseAddServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { for (int k = 0; k &lt; 30000; k++) { String id = UUID.randomUUID().toString(); DatabaseManager dbManager = new DatabaseManager(); d…
accepted answer: http://stackoverflow.com/a/27445119
has title: servlet not working in CouchBase server
tagged with: caching
tagged with: servlets
score: 2
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27445119
type: AnsweredQuestion
upvote count: 2
tagged with: java
tagged with: couchbase
has comment: http://stackoverflow.com/comment/43315894
type: Question

http://stackoverflow.com/a/27356599
score: 1
has body: The syntax error is pretty straight-forward. It says that there is a ; missing after a statement and that’s in no ways other than with statements outside lambda expressions. If you write (num) -&gt; { return 4 }, there must be a semicolon after return 4 as it would have to be at every place where you can write return 4 (I’m astounded why nobody else was capable of telling you that). You can write a lambda expression returning an int in two ways, either like (num) -&gt; { return 4; } or, much simpler, as num -&gt; 4 (here, without semicolon). But, of course, you can’t call returnNumber(int num) with a lambda expression as parameter as it expects an int and not a functional interface. Your compiler will tell you that once you fixed the structural syntax error of the missing semicolon.
upvote count: 1
type: Answer
answers question: http://stackoverflow.com/q/27321884
downvote count: 0

http://stackoverflow.com/comment/43307314
type: QuestionComment
has text: "I have a empty keys in map but I can catch them." - this sentence makes no sense. What are you trying to do, and what's happening instead of what you were trying to make happen?
comment on: http://stackoverflow.com/q/27433072
score: 0
type: Comment

http://stackoverflow.com/comment/43187497
has text: That is partially correct. Implementing the `Serializable` interface will allow your class to be written to an ObjectOutputStream. However, you can go a step further in simplifying your code. You have a Package that holds an array of Objects. Instead, what you should do is make each object you want to send serializable. Something like this: `class cat implements Serializable{`const int numLegs=4; String name; cat(){name="Garfield";} ... }` Then you can send it with: `Cat c = new Cat(); out.writeObject(c);` and receive with: `Cat o = in.readObject();`
type: Comment
comment on: http://stackoverflow.com/a/27367533
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43205021
comment on: http://stackoverflow.com/a/27371089
type: Comment
has text: @tchrist: except for `int x = -2147483648` which can *not* expressed as `int x = 0-2147483648`…
score: 1
type: AnswerComment

http://stackoverflow.com/comment/43383982
type: QuestionComment
comment on: http://stackoverflow.com/q/27474418
has text: I found that the problem was given by adding the "v-ddwrapper-over" style to the components. Could someone explain me why?
score: 0
type: Comment

http://stackoverflow.com/a/27405321
has body: You could do any number of tricks to avoid explicitly typing if. The existing answer using switch works, as would using a while loop and breaking or returning unconditionally inside of it. If your interviewer really wants to see how you can write unpleasant code that's your answer. If you're interested in real ways to restrict a HashMap's keys, you should use Guava's ForwardingMap and extend its .put*() and .putAll() methods, throwing an IllegalArgumentException "if some property of the specified key or value prevents it from being stored in this map". Even if you don't use Guava, you should prefer the decorator pattern over extending HashMap directly (Effective Java: Item 16). Alternatively, you may find it easier to use a dedicated type for your keys, e.g. a RestrictedString class that does your sanitization. Then you can create a Map&lt;RestrictedString, String&gt; and trust that only valid keys are in the map. This avoids using a conditional (if/switch/etc.) in the Map code, instead moving it to the RestrictedString class. Even if an interviewer is asking a puzzler-style question, responding with real-world solutions (while still acknowledging their stipulations) can only score you points with any legitimate employer.
has comment: http://stackoverflow.com/comment/43257072
downvote count: 0
has comment: http://stackoverflow.com/comment/43256278
has comment: http://stackoverflow.com/comment/43274230
upvote count: 2
has comment: http://stackoverflow.com/comment/43255672
has comment: http://stackoverflow.com/comment/43256891
type: Answer
answers question: http://stackoverflow.com/q/27405169
score: 2

http://stackoverflow.com/a/27330091
answers question: http://stackoverflow.com/q/27327829
type: Answer
has body: This worked: private static class MyOutputFormat&lt;K, V&gt; extends TextOutputFormat&lt;K, V&gt;{ @Override public Path getDefaultWorkFile(TaskAttemptContext context, String extension) throws IOException { FileOutputCommitter committer = (FileOutputCommitter) getOutputCommitter(context); return new Path(committer.getWorkPath(), "my-file-name.txt"); } }
score: 0

http://stackoverflow.com/q/27404611
has comment: http://stackoverflow.com/comment/43254336
tagged with: rcp
accepted answer: http://stackoverflow.com/a/27405256
has comment: http://stackoverflow.com/comment/43257599
type: Question
tagged with: eclipse-rcp
score: 0
has body: I have created a preference page in eclipse the preference page has two fields server url store location If the user open this preferences dialog, change the value of url and apply it the product is restarted and after restart when I check the value in the url field it is changed as expected. When I change the values of both url and directory only one of them is updated depends on which one is changed later. Here is my init method which initialize the preferences public class DataStorePreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { public static final String SERVER_URL = "prefs_server_url"; public static final String WORKSPACE_DIR = "prefs_workspace_dir"; public static final String KEEP_LOCKS = "prefs_keep_locks"; //public static final String RELEASE = "prefs_release"; public DataStorePreferencePage() { super(GRID); } @Override public void init(IWorkbench workbench) { setPreferenceStore(Activator.getDefault().getPreferenceStore()); getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { String property = event.getProperty(); System.setProperty("datastoreserver_url", property); if (property.equals(DataStorePreferencePage.WORKSPACE_DIR) || property.equals(DataStorePreferencePage.SERVER_URL)) { if(MessageDialog.openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Information", "New settings will be applied after a restart.\nRestart now?")) PlatformUI.getWorkbench().restart(); } } }); } @Override protected void createFieldEditors() { StringFieldEditor urlEditor = new StringFieldEditor(SERVER_URL, "DataStore Server URL", getFieldEditorParent()); StringFieldEditor workspaceDirEditor = new DirectoryFieldEditor(WORKSPACE_DIR, "Workspace directory:", getFieldEditorParent()); BooleanFieldEditor keepLocksEditor = new BooleanFieldEditor(KEEP_LOCKS, "Keep locks (default setting):", getFieldEditorParent()); //BooleanFieldEditor r…
tagged with: preferences
answer count: 1
has comment: http://stackoverflow.com/comment/43254314
has answer: http://stackoverflow.com/a/27405256
has comment: http://stackoverflow.com/comment/43254214
has comment: http://stackoverflow.com/comment/43257474
has title: Eclipse Preference Pages
type: AnsweredQuestion
tagged with: java

http://stackoverflow.com/a/27399301
has comment: http://stackoverflow.com/comment/43474964
has comment: http://stackoverflow.com/comment/104233572
has comment: http://stackoverflow.com/comment/43277343
has comment: http://stackoverflow.com/comment/43479192
upvote count: 2
has comment: http://stackoverflow.com/comment/43318266
type: Answer
has comment: http://stackoverflow.com/comment/43268085
has body: The OAuth2 Spec has a section on refreshing access tokens. It's implemented in a pretty standard way in Spring OAuth (you just post the refresh token to the /token endpoint). BTW for SSO you don't normally need a Resource Server. But that's a different question.
answers question: http://stackoverflow.com/q/27392999
has comment: http://stackoverflow.com/comment/43440856
has comment: http://stackoverflow.com/comment/43465179
has comment: http://stackoverflow.com/comment/43328756
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/43268268
has comment: http://stackoverflow.com/comment/43443480
has comment: http://stackoverflow.com/comment/104186707
has comment: http://stackoverflow.com/comment/43479338

http://stackoverflow.com/q/27331041
type: Question
tagged with: tablelayout
answer count: 1
has title: Table layout grouping
score: 0
has comment: http://stackoverflow.com/comment/43120157
tagged with: android
has comment: http://stackoverflow.com/comment/43120176
has answer: http://stackoverflow.com/a/27332325
has comment: http://stackoverflow.com/comment/43120787
has comment: http://stackoverflow.com/comment/43119964
has body: I am using table layout and my code is below. I need help for grouping rows together to a check box. Second problem, I need help in passing a selected checkbox to another page. Third, I need help in putting the button at bottom, so that is will not be covered and need to be scroll to find it. <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:background="#FFFFF0" android:text="Opp SAFRA Tampines" android:textSize="22dp" android:textStyle="bold" android:width="1000dp" /> <View android:layout_height="2dip" android:background="#FF0000" /> <TextView android:background="#E7FEFF" android:text=" 5" android:textSize="18dp" /> <TextView android:id="@+id/text02" android:background="#E7FEFF" android:text=" Pasir Ris Int" android:textSize="15dp" android:width="850px" /> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="20" android:background="#E7FEFF" android:checked="false" /> <TextView android:background="#E7FEFF" android:text=" 15:25 15:36 15:47" android:textSize="13dp" /> <View android:layout_height="2dip" android:background="#FF0000" /> <TextView android:background="#E7FEFF" android:stretchColumns="2" android:text=" 8" android:textSize="18dp" /> <TextView android:background="#E7FEFF" android:text=" Tampines Int" android:textSize="15dp" android:width="850px" /> <CheckBox android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="20" android:background="#E7FEFF" android:checked="false" /> <TextView android:background="#E7FEFF" android:text=" 15:26 15:27 15:36" android:textSize="13dp" /> <View android:layout_height="2dip" android:background="#FF0000" /> <TextView android:background="#E7FEFF" android:stretchColumns="2" android:text=" 15" android:textSize="18dp" /> <TextView android:background="#E7FEFF" android:text=" Tampines Int" android:textSize="15dp" android:width="850px" /> <CheckBox android:layout_width="wrap…
tagged with: checkbox
has comment: http://stackoverflow.com/comment/43120094
type: AnsweredQuestion
tagged with: java
accepted answer: http://stackoverflow.com/a/27332325
tagged with: eclipse

http://stackoverflow.com/q/27384561
score: -1
accepted answer: http://stackoverflow.com/a/27384919
has body: Consider this code: private static Context myContext; public static Context getInstance() { myContext = myContext == null ? new Context() : myContext; return myContext; } After refactoring like this, my app started to throw NullPointers: private static Context myContext; public static Context getInstance() { return myContext == null ? new Context() : myContext; } Is it returning myContext and ignoring all after '=='? Can somebody explain? EDIT: Did a bit more research on this, turns out that it was my mistake: seems that refactored code failed to assign the value to a Context class field. Sorry for inconvenience. If someone is still interested, here is the working code snippet: package pckg; import org.junit.Test; public class TernaryTest { @Test public void testOK(){ Context.getInstance().initialize(); Context.getInstance().setReport(new Report()); Context.getInstance().getReport(); } @Test public void testFail(){ Context.getInstanceRefactored().initialize(); Context.getInstanceRefactored().setReport(new Report()); Context.getInstanceRefactored().getReport(); } } class Context{ private static Context myContext; private boolean isInitialized; private Report report; public static Context getInstance() { myContext = myContext == null ? new Context() : myContext; return myContext; } public static Context getInstanceRefactored() { return myContext == null ? new Context() : myContext; } private void checkInitialized() { if (!isInitialized) { throw new IllegalStateException("Not initialized."); } } public void initialize() { if (isInitialized) { throw new IllegalStateException("Not initialized."); } isInitialized = true; } public void setReport(Report report) { this.report = report; } public Report getReport() { checkInitialized(); return report; } } class Report{}
has comment: http://stackoverflow.com/comment/43218080
answer count: 1
has comment: http://stackoverflow.com/comment/43217793
favorite count: 0
has comment: http://stackoverflow.com/comment/43217820
has comment: http://stackoverflow.com/comment/43217686
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27384919
has comment: http://stackoverflow.com/comment/43217662
has comment: http://stackoverflow.com/comment/43299658
tagged with: java
downvote count: 2
upvote count: 1
has title: Why cant I return the result of ternary operator?
has comment: http://stackoverflow.com/comment/43217632
type: Question
tagged with: ternary

http://stackoverflow.com/q/27357092
has comment: http://stackoverflow.com/comment/43166782
upvote count: 5
has answer: http://stackoverflow.com/a/27357165
has body: my tomcat server is not starting in eclipse which was working fine before but now its showing the following exception. although its working quite fine outside eclipse. but whenever i try to start the server, the following exception occurs and it shows the message = " starting Tomcat server v8.0 server at localhost has encountered a problem" Dec 08, 2014 4:35:16 PM org.apache.coyote.AbstractProtocol destroy INFO: Destroying ProtocolHandler ["ajp-nio-8009"] Dec 08, 2014 4:35:16 PM org.apache.coyote.AbstractProtocol destroy SEVERE: Failed to destroy end point associated with ProtocolHandler ["ajp-nio-8009"] java.lang.NullPointerException at org.apache.tomcat.util.net.NioEndpoint.releaseCaches(NioEndpoint.java:307) at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:482) at org.apache.tomcat.util.net.AbstractEndpoint.destroy(AbstractEndpoint.java:795) at org.apache.coyote.AbstractProtocol.destroy(AbstractProtocol.java:531) at org.apache.catalina.connector.Connector.destroyInternal(Connector.java:1023) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305) at org.apache.catalina.core.StandardService.destroyInternal(StandardService.java:588) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305) at org.apache.catalina.core.StandardServer.destroyInternal(StandardServer.java:850) at org.apache.catalina.util.LifecycleBase.destroy(LifecycleBase.java:305) at org.apache.catalina.startup.Catalina.start(Catalina.java:629) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:351) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:485)
downvote count: 0
has answer: http://stackoverflow.com/a/38021667
tagged with: tomcat
favorite count: 0
has comment: http://stackoverflow.com/comment/43167237
type: UnansweredQuestion
has title: nullpointer exception in starting tomcat
has comment: http://stackoverflow.com/comment/43166634
tagged with: java
tagged with: eclipse
type: Question
answer count: 2
score: 5

http://stackoverflow.com/comment/43263452
has text: Then the only thing you can try is to [reinstall console](http://www-01.ibm.com/support/knowledgecenter/SSAW57_8.5.5/com.ibm.websphere.nd.multiplatform.doc/ae/tcon_console_inst_uninst.html?lang=en) - first try to remove, then try to install.
score: 0
type: Comment
comment on: http://stackoverflow.com/q/27367411
type: QuestionComment

http://stackoverflow.com/a/27440090
has body: The value is held as number, and toString conversions in java follow the programmer's notation with a dot. Locale locale = new Locale(...); String repr = String.format(locale, "%.2f", mycell.getNumericCellValue()); Fancy with NumberFormat: NumberFormat format = NumberFormat.getInstance(locale); String repr = format.format(mycell.getNumericCellValue());
answers question: http://stackoverflow.com/q/27439836
downvote count: 0
upvote count: 2
type: Answer
score: 2

http://stackoverflow.com/comment/43374676
type: Comment
type: QuestionComment
has text: In Java, you can't have a method inside a method.
score: 4
comment on: http://stackoverflow.com/q/27469881

http://stackoverflow.com/comment/43257398
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27406299
has text: @kuporific I don't understand - won't there be the same problem ? Can you explain ?
score: 0

http://stackoverflow.com/q/27377965
linked to: http://stackoverflow.com/q/11010224
tagged with: jpa
linked to: http://stackoverflow.com/q/2088743
has title: Does a JPA persist() operation always include all the mapped entity fields in the generated INSERT statement?
tagged with: eclipselink
downvote count: 0
favorite count: 0
answer count: 0
type: UnansweredQuestion
upvote count: 1
score: 1
tagged with: java
has body: My question is related to Is there a way to prevent null values from being persisted while allowing others through? and Is it necessary to set all the fields of the entity classes when using JPA to persist?, but goes in the opposite direction. Instead of preventing null values from being persisted, I would like to be sure that null values are consistently used in the generated INSERT INTO statement of a persist operation so that I can detect NOT NULL constraint violations in my application code. The reason is because my team has a convention on the underlying database (Postgres) that demands that every NOT NULL column also uses a DEFAULT value, which is needed for an automatic migration script we're using. Due to the problems described in the first linked thread, I want to assure that my JPA (EclipseLink) cache does not get out of sync with the DB due to default values automatically being used upon an INSERT INTO. This could happen if the INSERT INTO completely omits a column - in that case the defined DEFAULT value would be used by the DB to fill the row. I've observed that EclipseLink always seems to use all the mapped columns in the INSERT INTO statement, explicitly setting null values. This triggers the constraint violation as desired. But is this guaranteed to happen or could the JPA provider decide to completely omit a column in the INSERT INTO statement that is mapped to a Java field containing a null value (leaving insertable = false annotations aside)?
type: Question

http://stackoverflow.com/comment/43346957
comment on: http://stackoverflow.com/q/27454475
score: 2
has text: Put the buttons in a panel and add the panel to the scroll pane. *"Also, how do I add an action listener?"* SO is not a help-desk, but a Q&A site. As such, that should be on a separate question.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43195411
has text: i i imported java-json.jar into my project and now only one error showing 'jParser cannot be resolved'
type: Comment
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27371748

http://stackoverflow.com/a/27333564
type: Answer
answers question: http://stackoverflow.com/q/27331990
has body: I am not sure how you want to handle "A12" or anything that is part alpha and part numeric. This code will return "A" for "A12" package lexical; public class Tokenizer { int pos; char[] expression; Tokenizer(String expression) { this.expression = expression.toCharArray(); this.pos = 0; } enum Type { OPERATOR, ALPHA, UNKNOWN, LITTER, ERROR } class Lexeme { String type, token; Lexeme(String type, String token) { this.type = type; this.token = token; } } Lexeme getNextToken() { StringBuilder token = new StringBuilder(); boolean endOfToken = false; Type type = Type.UNKNOWN; // skip whitespace while (expression[pos] == ' ' &amp;&amp; hasMoreTokens()) { pos++; } while (!endOfToken &amp;&amp; hasMoreTokens()) { switch (expression[pos]) { case ' ': { endOfToken = true; pos++; break; } default: if (Character.isAlphabetic(expression[pos])) { token.append(expression[pos]); type = Type.ALPHA; } else { System.out.println("Systax error at position: " + pos); } pos++; break; } } return new Lexeme(type.name().toLowerCase(), token.toString()); } boolean hasMoreTokens() { return pos &lt; expression.length; } public static void main(String[] args) { expression = "Hello World"; Tokenizer tokenizer = new Tokenizer(expression); while (tokenizer.hasMoreTokens()) { Lexeme nextToken = tokenizer.getNextToken(); System.out.print("Type: " + nextToken.type + "\tLexeme: " + nextToken.token + "\n"); } expression = "123 ABC A12"; tokenizer = new Tokenizer(expression); while (tokenizer.hasMoreTokens()) { Lexeme nextToken = tokenizer.getNextToken(); System.out.print("Type: " + nextToken.type + "\tLexeme: " + nextToken.token + "\n"); } } } Outputs: Type: alpha Lexeme: Hello Type: alpha Lexeme: World Systax error at position: 0 Systax error at position: 1 Systax error at position: 2 Type: unknown Lexeme: Type: alpha Lexeme: ABC Systax error at position: 9 Systax error at position: 10 Type: alpha Lexeme: A
score: 0

http://stackoverflow.com/a/27375673
type: Answer
answers question: http://stackoverflow.com/q/27375230
accepted answer of: http://stackoverflow.com/q/27375230
type: AcceptedAnswer
has body: Get and post methods are almost the same, the only difference between these two methods is that: in post, query strings (name/value pairs) is sent in the HTTP message body of a POST request and in get, query strings (name/value pairs) is sent in the URL. Why is this done this way, obviously, security reasons. You do not want to see your login credentials in the url.
score: 0

http://stackoverflow.com/a/27430536
has comment: http://stackoverflow.com/comment/43306034
has comment: http://stackoverflow.com/comment/43302646
type: AcceptedAnswer
downvote count: 0
answers question: http://stackoverflow.com/q/27430340
has comment: http://stackoverflow.com/comment/43303225
has comment: http://stackoverflow.com/comment/43304528
has comment: http://stackoverflow.com/comment/43305649
type: Answer
has body: Immediately after your first for (not in for body!!) loop: PrintWriter writer = null; try { writer = new PrintWriter("VectorDump", "UTF-8"); } catch (Exception e) { break; } Iterator it = vector.iterator(); while(it.hasNext()) { writer.print( it.next() + " " ); } writer.close();
accepted answer of: http://stackoverflow.com/q/27430340
upvote count: 1
score: 1
has comment: http://stackoverflow.com/comment/43303672
has comment: http://stackoverflow.com/comment/43304473
has comment: http://stackoverflow.com/comment/43302674

http://stackoverflow.com/a/27433604
type: AcceptedAnswer
downvote count: 0
accepted answer of: http://stackoverflow.com/q/27433515
has comment: http://stackoverflow.com/comment/43308415
score: 6
answers question: http://stackoverflow.com/q/27433515
has comment: http://stackoverflow.com/comment/43308462
type: Answer
upvote count: 6
has comment: http://stackoverflow.com/comment/43308685
has body: You are missing a semicolon at the end of this line: public static HashMap&lt;String, List&lt;String&gt;&gt; getInfo() Which makes the code analysed go crazy and not see your objects correctly as their types. Just add the semicolon. Also, you will probably want to remove the parenthesis at the end of the line, as it suggests it it a method. So do something like this: public static HashMap&lt;String, List&lt;String&gt;&gt; getInfo; Or this: public static HashMap&lt;String, List&lt;String&gt;&gt; getInfo(){ //Some actual code here, which returns a HashMap }; Now I see that your whole class tructure is messed up. Try the below code: import java.util.ArrayList; import java.util.HashMap; import java.util.List; public class DataProvider { public static HashMap&lt;String, List&lt;String&gt;&gt; getInfo; public DataProvider() { HashMap&lt;String, List&lt;String&gt;&gt; MoviesDetails = new HashMap&lt;String, List&lt;String&gt;&gt;(); List&lt;String&gt; Action_Movies = new ArrayList&lt;String&gt;(); Action_Movies.add(""); List&lt;String&gt; Romantic_Movies = new ArrayList&lt;String&gt;(); Romantic_Movies.add(""); List&lt;String&gt; Horror_Movies = new ArrayList&lt;String&gt;(); Horror_Movies.add(""); List&lt;String&gt; Comedy_Movies = new ArrayList&lt;String&gt;(); Comedy_Movies.add(""); } }
has comment: http://stackoverflow.com/comment/43308514

http://stackoverflow.com/comment/43106749
score: 1
comment on: http://stackoverflow.com/a/27323545
type: AnswerComment
has text: @kinbiko I reformulated it a bit. Looks perfectly fine to me now.
type: Comment

http://stackoverflow.com/a/27326566
has body: Would something like this work for you? import json import copy a = json.load(open("your_data.json", "r")) b = copy.deepcopy(a) t = a.get('data').get('Response').get('products') b['data']['Response']['products'] = t.values() # Originally was: [t[i] for i in t] You can give back JSON with json.dumps(b)
has comment: http://stackoverflow.com/comment/43112588
type: Answer
answers question: http://stackoverflow.com/q/27326393
has comment: http://stackoverflow.com/comment/43112563
score: 0
has comment: http://stackoverflow.com/comment/43113242

http://stackoverflow.com/a/27464442
has body: Well, the abstract factory itself doesn't have to specify any concrete classes, because it's abstract -- it has no implementation code. The implementations of the abstract factory do, of course. but: They don't have to tell the user of the factory what they're going to be, nor does the user of the factory have to care what they're going to be. If you ask for a Sauce, then you are guaranteed to receive something which can be used as a Sauce. Because of the former, the actual concrete classes produced by the factory implementation are an implementation detail, and can be changed without having to change the using code. The code that creates the factory isn't the (only) code that uses the factory. So the choice of factory implementation is itself a separated concern.
answers question: http://stackoverflow.com/q/27464425
has comment: http://stackoverflow.com/comment/43365194
upvote count: 2
score: 2
type: AcceptedAnswer
downvote count: 0
has comment: http://stackoverflow.com/comment/43365681
accepted answer of: http://stackoverflow.com/q/27464425
type: Answer

http://stackoverflow.com/q/27365377
type: UnansweredQuestion
tagged with: swing
tagged with: java
type: Question
has body: Here is my code. Trully i am trying to learn java but i don't get it. import java.awt.BorderLayout; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.DefaultListModel; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JScrollPane; public class Dual{ public static JFrame myframe; public JPanel mypanel; private JList sourceList; private DefaultListModel sourceListModel; private JList destList; private DefaultListModel destListModel; private JButton addButton; private JButton removeButton; public Dual(){ myframe = new JFrame("Dual List Box"); myframe.setDefaultCloseOperation(myframe.EXIT_ON_CLOSE); myframe.setSize(400, 300); myframe.setResizable(false); mypanel = new JPanel(); myframe.getContentPane().add(mypanel); initScreen(); data(); } private void initScreen() { mypanel.setLayout(new GridLayout(0, 2)); sourceListModel = new DefaultListModel(); sourceList = new JList(sourceListModel); addButton = new JButton("&gt;&gt;"); addButton.addActionListener(new AddListener()); removeButton = new JButton("&lt;&lt;"); //removeButton.addActionListener(new RemoveListener()); destListModel = new DefaultListModel(); destList = new JList(destListModel); JPanel leftPanel = new JPanel(new BorderLayout()); leftPanel.add(new JLabel("Available Elements:"), BorderLayout.NORTH); leftPanel.add(new JScrollPane(sourceList), BorderLayout.CENTER); leftPanel.add(addButton, BorderLayout.SOUTH); JPanel rightPanel = new JPanel(new BorderLayout()); rightPanel.add(new JLabel("Selected Elements:"), BorderLayout.NORTH); rightPanel.add(new JScrollPane(destList), BorderLayout.CENTER); rightPanel.add(removeButton, BorderLayout.SOUTH); mypanel.add(leftPanel); mypanel.add(rightPanel); } private void data(){ //sourceListModel.firstElement(request.getParameter("t" + i)); sourceListModel.addElement("ABC"); sourceListModel.addElement(new S…
score: 0
has title: Java, how to make duallist
has answer: http://stackoverflow.com/a/27365554
upvote count: 1
answer count: 1
downvote count: 1
favorite count: 0

http://stackoverflow.com/a/27460293
has comment: http://stackoverflow.com/comment/43370334
type: Answer
has comment: http://stackoverflow.com/comment/43369937
downvote count: 0
has comment: http://stackoverflow.com/comment/43575967
has body: EDIT 2 So, if you're not comfortable with threads/runnables/Handlers and not comfortable with android AsyncTask, I would just go straight to HttpUrlConnection (drop the entire excercise with Apache HttpClient because, basically Google says that HttpUrlConnection will support streamed response and it does work!) It may not be as easy instrumenting all the details like dumping headers. But with a normal streamed response Object, I think that it should just work.... see edit 3 for HttpsUrlConnection code sample EndEdit2 Not clear from the question what 'stream' protocol is being used (progressive download or HTTP streaming) OR how you are actually managing the streamed response on your client. Recommended to dump the headers from the connection to see exactly what the client and server are agreeing on?? I'm assuming that you are OFF the UI thread (either in AsyncTask or in the callback portion of a Handler); if that's not accurate you may have to refactor a little bit. Assuming HTTP stream in use with Apache HttpClient 4.3.5+ If there is no length in the headers of the response, then you are doing a 'chunked' response on HTTP 1.1 where you have to read a buffer until you get a 'last-chunk' or decide to CLOSE either the stream or the Connection: The server just starts sending (streaming) and the client should handle the 'input-stream' that it gets from the HTTP response by employing a buffer as per the detailed Apache notes on producing entity content. I don't remember offhand if socket timeout of 30 seconds will pre-empt an active stream? Remember in Apache, separate settings exist in the builder for socket timeout, and read timeout. Don't want socket to close on you and don't want to timeout waiting on a readable stream's available bytes while server is providing the response. Anyway, the client-side handler just needs to be aware of how the stream ends by inspection of what's read into the buffer... If the protocol in place is "continue" & "chunked" then the response…
has comment: http://stackoverflow.com/comment/43370419
upvote count: 8
has comment: http://stackoverflow.com/comment/43576177
accepted answer of: http://stackoverflow.com/q/27371201
has comment: http://stackoverflow.com/comment/128710366
answers question: http://stackoverflow.com/q/27371201
has comment: http://stackoverflow.com/comment/43367876
has comment: http://stackoverflow.com/comment/43576453
has comment: http://stackoverflow.com/comment/43363345
type: AcceptedAnswer
score: 8

http://stackoverflow.com/comment/43265460
score: 2
has text: also don't post code in a reply comment, update your post with the details.
comment on: http://stackoverflow.com/q/27410530
type: QuestionComment
type: Comment

http://stackoverflow.com/q/27330081
has comment: http://stackoverflow.com/comment/43118338
has comment: http://stackoverflow.com/comment/43118285
tagged with: eclipse
has answer: http://stackoverflow.com/a/27330120
linked to: http://stackoverflow.com/q/8167088
type: Question
has answer: http://stackoverflow.com/a/27330119
has comment: http://stackoverflow.com/comment/43118269
score: 0
answer count: 3
has comment: http://stackoverflow.com/comment/43118258
has title: How to pass selected data over to next activity android
has body: Im creating a simple app which is for example i got 10 table row with check box and user click on 3 box and press next, i wan to print out only the 3 row the use clicked and adding extra button/icon beside it. Is it possible? please help ! Thank you !
possible better answer: http://stackoverflow.com/a/27330119
linked to: http://stackoverflow.com/q/2091465
linked to: http://stackoverflow.com/q/6998564
tagged with: android
has answer: http://stackoverflow.com/a/27330116
accepted answer: http://stackoverflow.com/a/27330116
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43118279
tagged with: java

http://stackoverflow.com/q/27461697
answer count: 1
downvote count: 0
tagged with: data-structures
has answer: http://stackoverflow.com/a/27461896
accepted answer: http://stackoverflow.com/a/27461896
tagged with: android
favorite count: 0
has title: How to move objects from one ArrayList to another, avoiding GC problems
tagged with: garbage-collection
type: AnsweredQuestion
score: 2
tagged with: performance
tagged with: java
has body: Using LibGdx, I recently implemented a grid system(spatial partitioning) to optimize performance for collision detection. I spawned 2000 entities on the board, and had them move around, recalculating their new tile location on the grid, and transferring the entity to the correct Collection whenever necessary. Problem: GC_FOR_ALLOC freed 3068K (65765), 45% free 3925K/7124K, paused 36ms, total 36ms occurs on Android around once a second, causing the rendering to stutter. Code: This is run by each entity: if(newgridy!=currentgridy||newgridx!=currentgridy){ try { my_tile.remove(this); my_tile = grid[newgridy][newgridx]; my_tile.add(this); }catch (ArrayIndexOutOfBoundsException e){ } } newgridy,newgridx,currentgridy,currentygridx are tile coordinates(not render coords) my_tile is an ArrayList grid is a 2D array of ArrayLists My Attempts: I know that this is the problematic block of code, because the GC calls go away when I comment it out. I think that the repetitive remove and add calls results in fragmented memory, and the ArrayList grows too large to fit in any contiguous location in memory, so the GC has to compact when my Entities enter a new tile. I thought I should preallocate space for each tile, but each tile could potentially contain 1000+ ships at once, and sometimes be completely empty. Then I would have to allocate the 1000 to accommodate for when it is full, but then that would be an enormous waste when the tile is empty. Questions Is fragmented memory my issue? If so, is there a Collection in Java that can be non-contiguous? Or other ways to fix it? Would switching to a Quadtree for optimization help? Sorry for multiple questions and being a bit broad.
type: Question
upvote count: 2

http://stackoverflow.com/comment/43227207
type: QuestionComment
has text: I didn't want to delete object unless I absolutely had to. Modifying seemed like a better path. However, if that won't work, I'll create a new List.
comment on: http://stackoverflow.com/q/27389561
score: 0
type: Comment

mouseevent
tags question: http://stackoverflow.com/q/27434745
tags question: http://stackoverflow.com/q/27322623
type: Tag
tags question: http://stackoverflow.com/q/27387407
tag name: mouseevent
tags question: http://stackoverflow.com/q/27430156

http://stackoverflow.com/q/27316047
has comment: http://stackoverflow.com/comment/43092109
type: Question
favorite count: 0
has body: public enum Apple { Jonathan,GoldenDel,RedDel,Winesap,Cortland } class EnumDemo{ public static void main(String args[]){ Apple ap; ap=Apple.RedDel; System.out.println("Value of ap:" + ap); System.out.println(); ap=Apple.GoldenDel; if(ap==Apple.GoldenDel) System.out.println("ap contains GoldenDel.\n"); } } I can't have any outputs when ı use enum type.Why?
score: 0
answer count: 2
accepted answer: http://stackoverflow.com/a/27316892
upvote count: 1
has title: Enumeration Output Error
has comment: http://stackoverflow.com/comment/43092636
downvote count: 1
has comment: http://stackoverflow.com/comment/43092240
tagged with: enums
tagged with: java
has comment: http://stackoverflow.com/comment/43092461
has comment: http://stackoverflow.com/comment/43092071
has comment: http://stackoverflow.com/comment/43092135
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27316708
has answer: http://stackoverflow.com/a/27316708
has answer: http://stackoverflow.com/a/27316892

http://stackoverflow.com/q/27411856
upvote count: 1
has comment: http://stackoverflow.com/comment/43268585
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43268718
has comment: http://stackoverflow.com/comment/43268575
type: Question
has comment: http://stackoverflow.com/comment/43268128
has comment: http://stackoverflow.com/comment/43268037
downvote count: 0
has comment: http://stackoverflow.com/comment/43268405
has body: I have made a function that takes x amount of parameters. Each parameter, represents a file. I want every single of these files to be assigned a thread, for counting the words of the files as fast as possible. Currently I have done something that seems to work, however I find myself in trouble of checking the threads as they are all just assigned with the name "t" It would be nice to somehow increment the name of the threads. The first thread would be t1 and would be assigned to the first file and so on. for (File file : fileList) { final File f = file; Thread t = null; ThreadGroup test = null; Runnable r = new Runnable() { public void run() { Scanner fileScan; try { fileScan = new Scanner(f); } catch(FileNotFoundException e){ System.out.println("Something went wrong while accessing the file"); return; } int words = 0; while (fileScan.hasNext()) { words++; fileScan.next(); } System.out.println(f.getName() + ": " + words + " words"); System.out.println(Thread.activeCount() + ": "); } }; t = new Thread(r); t.start(); } The threadcount goes up as it is supposed when checking with Thread.activeCount(), but I have no clue how to ever contact them as I have assigned all with the name t, which makes it hard to make yet another thread that shall wait for their output. I hope my explaination clearified the problem :/ Edit: The idea is that I will count the amount of words in different files, every file needs to be assigned a thread for itself to speed it up. Other than that, I want one thread waiting for the output from all the other threads ( meaning I will have to wait for them to finish, hence why I would appriciate accessing the name of the threads ). At the end that last thread that has been waiting will use the collected data for it's own actions before closing the program down.
has comment: http://stackoverflow.com/comment/43268195
tagged with: increment
answer count: 1
has title: Incrementing Thread Name
favorite count: 0
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27411970
tagged with: multithreading

http://stackoverflow.com/a/27435660
downvote count: 0
score: 1
has comment: http://stackoverflow.com/comment/43312244
upvote count: 1
has body: This is mainly because of overflow from long (64bit signed). You can look up BigDecimal or BigInteger for use in this case.
type: Answer
answers question: http://stackoverflow.com/q/27435575
has comment: http://stackoverflow.com/comment/43312270
has comment: http://stackoverflow.com/comment/43312233

http://stackoverflow.com/comment/43189229
comment on: http://stackoverflow.com/a/27368442
score: 1
type: AnswerComment
has text: @GáborBakos, Seems like function return enumeration with used iterator
type: Comment

http://stackoverflow.com/q/27345460
tagged with: arrays
downvote count: 0
favorite count: 0
possible better answer: http://stackoverflow.com/a/27345587
has comment: http://stackoverflow.com/comment/43146412
has answer: http://stackoverflow.com/a/27345587
has title: searching an array with boolean
accepted answer: http://stackoverflow.com/a/27345636
score: 1
tagged with: java
upvote count: 1
type: Question
type: AnsweredQuestion
tagged with: boolean
answer count: 2
has body: really stuck on this so any help appreciated i am just a beginner basically i have 3 classes called Account, Address &amp; AccountCollection within the AccountCollection i have got to create a boolean search which will print a single account given a account number utilising a method of the Account class. If this is invalid it should output "Account with account number: [ accountNumber] not found." the code i have so far is public boolean getAccount(String accountNumber) { for (Account account : accounts) { if (account.getAccountNumber().equals(accountNumber)) { account.printAccountDetails(); System.out.println(); return true; } } return false; } which seems to work until i put in a wrong value then it gives me a null pointer exception 61 any help would be brilliant thanks
has answer: http://stackoverflow.com/a/27345636
has comment: http://stackoverflow.com/comment/43146253
has comment: http://stackoverflow.com/comment/43146211

http://stackoverflow.com/a/27356925
type: Answer
has comment: http://stackoverflow.com/comment/43166568
answers question: http://stackoverflow.com/q/27356658
has body: The condition you are having is while (fileScanner.hasNextInt()). As the name says, hasNextInt() will check if the next value is int or not. When it encounters ss then it will return false and exit from loop. More Info You need to revise your logic by using say, hasNext() EDIT: There will be an exception when you will try to parse the string ss to integer, in the line, number = fileScanner.nextInt(); Better you try this statement with try-catch. try{ number = fileScanner.nextInt(); }catch(NumberFormatException e){ }
score: 0
has comment: http://stackoverflow.com/comment/43166496

http://stackoverflow.com/q/27428265
has title: Running integration tests with Spring boot (NoSuchBeanDefinitionException)
has answer: http://stackoverflow.com/a/27428696
tagged with: intellij-idea
possible better answer: http://stackoverflow.com/a/27428696
has answer: http://stackoverflow.com/a/27431695
accepted answer: http://stackoverflow.com/a/27431695
linked to: http://stackoverflow.com/q/4377699
has body: I am trying to sort out the following issue. I've created a Spring Boot application which is also using Spring Data. To do integration tests, I want to power up an H2 database. I configured the test with @ContextConfiguration and referenced my applicationContext.xml file. When I am running the tests out of the IDE (intelliJ) everything is fine, and the test is getting grean. But as soon as I run the test on my build server or in the console with gradle, I get NoSuchBeanDefinitionException. It seems like the applicationContext is not considered at all... Actually I have no clue anymore what to do.. My applicationContext-test.xml: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:data="http://www.springframework.org/schema/data/jpa" xmlns="http://www.springframework.org/schema/beans" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:annotation-config/> <context:component-scan base-package="de.company.project"/> </beans> My persistenc-test.xml: <?xml version="1.0" encoding="UTF-8" standalone="no"?> de.company.project.server.model.Entity The database.properties just contains the defaults for an H2 database. And last but not least my Testclass @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("classpath:*META-INF/applicationContext-test.xml") public class EntityServiceTest { @Test public void doSomeStuff(){ } . . } I hope somebody has a clue what I am doing wrong?! BR Edit: Missed to add the exception and the respository: @Repository public interface EntityRepository extends JpaRepository<Entity, Integer> { } Exception: Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [de.company.project.serve…
type: AnsweredQuestion
tagged with: spring-boot
tagged with: java
tagged with: integration-testing
tagged with: gradle
type: Question
score: 0
answer count: 2

http://stackoverflow.com/comment/43302335
type: QuestionComment
score: 0
has text: @runDOSrun This is not overloading. The answer in the Q&A you linked to is wrong to call it that.
comment on: http://stackoverflow.com/q/27430484
type: Comment

http://stackoverflow.com/a/27408302
type: Answer
answers question: http://stackoverflow.com/q/27407987
has body: The output should be: Input the your choice in all lower case letters, choose from rock, paper, scissors, lizard, spock spock You won, you picked spock and the computer picked scissors Correct ? then, the code is correct, but System.out.println is the last instruction before the JVM terminates. So the program 'can' end without writing out the last text Simply write System.out.flush() after System.out.println.
score: 0
has comment: http://stackoverflow.com/comment/43262314

http://stackoverflow.com/comment/56574742
type: Comment
comment on: http://stackoverflow.com/a/27467279
has text: Thanks! I logged a bug report.
type: AnswerComment
score: 0

http://stackoverflow.com/a/27421778
has body: According to this link: For android 4.4 + Try out immersive mode https://developer.android.com/training/system-ui/immersive.html Fast snippet: @SuppressLint("NewApi") protected void onCreate(Bundle savedInstanceState) { currentApiVersion = android.os.Build.VERSION.SDK_INT; final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY; // This work only for android 4.4+ if (currentApiVersion &gt;= 19) { getWindow().getDecorView().setSystemUiVisibility(flags); // Code below is for case when you press Volume up or Volume down. // Without this after pressing valume buttons navigation bar will // show up and don't hide final View decorView = getWindow().getDecorView(); decorView .setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() { @Override public void onSystemUiVisibilityChange(int visibility) { if ((visibility &amp; View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) { decorView.setSystemUiVisibility(flags); } } }); } } @SuppressLint("NewApi") @Override public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if (currentApiVersion &gt;= 19 &amp;&amp; hasFocus) { getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); } } If there is problems when pressing Volume up or Volume down that your navigation bar show. Should added code in onCreate see setOnSystemUiVisibilityChangeListener Here is also related question: Immersive mode navigation becomes sticky after volume press or minimise-restore
answers question: http://stackoverflow.com/q/27407371
type: Answer
score: 1
upvote count: 1
accepted answer of: http://stackoverflow.com/q/27407371
type: AcceptedAnswer
downvote count: 0

http://stackoverflow.com/q/27364271
upvote count: 2
tagged with: java
answer count: 1
tagged with: http://stackoverflow.com/tag/json
type: UnansweredQuestion
tagged with: jackson
has body: I have a json structure I am trying to parse with jackson which at the top level consists of a heterogenous array: [ { "machineuuid": "e74f75b9-d819-4377-b5cd-8bc0bd02dee2", "version": 5, "flags": 10 }, [ { "ma": [ { "arr": [ 3, 7, 0 ], "ts": "2014-12-02T18:56:50.514Z", "u": "74e4d525-ae1a-5406-8b4b-0166d03bf2a4" } ], "u": "46e800d6-2e8c-469c-9d39-9f985bf19728", "web": [ { "arr": [ 3, 1, 0 ], "cc": [ "7a26ff80-6a42-4648-bdbc-0076e7e31088" ], "p": 100, "t": "Disney.com | The official home for all things Disney", "ts": "2014-12-02T18:56:55.173Z", "u": "http://disney.com/" } ] } ] ] The top level java looks like: public class ActivityUpload { @JsonProperty(index = 0) MachineInfo machineInfo; @JsonProperty(index = 1) List&lt;UserUpload&gt; userUploads; } The inner portions of the parsing work fine with unit tests (e.g. MachineInfo, UserUpload), it is just the top level where the outer array contains a MachineInfo json object in array[0], and the array of UserUpload json objects is in array[1]. The exception that is thrown is: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of com.myapp.domain.ActivityUpload out of START_ARRAY token at [Source: [ { "machineuuid": "e74f75b9-d819-4377-b5cd-8bc0bd02dee2", "version": 5, "flags": 10 }, [ { "ma": [ { "arr": [ 3, 7, 0 ], "ts": "2014-12-02T18:56:50.514Z", "u": "74e4d525-ae1a-5406-8b4b-0166d03bf2a4" .... lines omitted ]; line: 1, column: 1] at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148) at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:749) at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:745) at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromArray(BeanDeserializerBase.java:1203) at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(BeanDeserializer.java:147) at com.fasterxml.jackson.databind.deser.BeanD…
score: 2
downvote count: 0
has answer: http://stackoverflow.com/a/27371338
has title: Heterogeneous JSON array not parsing with jackson
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/43186024
has comment: http://stackoverflow.com/comment/43187750

http://stackoverflow.com/comment/43231543
comment on: http://stackoverflow.com/q/27390392
score: 0
type: Comment
has text: I somehow can't imagine "null" being printed when the String is too long. While I am still not sure what the real problem is, I suspect that you meant to call `Cruise.add(sb.toString)` instead of `Cruise.add(sb)` as the latter will add the `StringBuilder` instance. Maybe you could add the generic parameters to `Cruise` to clarify the type - both for the sake of helping SO-fellows and for the sake of clean code. Is `Cruise` supposed to be an `ArrayList<Object>` or an `ArrayList<String>` (to which you could not add `sb`)?
type: QuestionComment

http://stackoverflow.com/a/27416043
has comment: http://stackoverflow.com/comment/43276324
has comment: http://stackoverflow.com/comment/43276138
score: 0
has comment: http://stackoverflow.com/comment/43277210
type: Answer
has body: first set row to zero int row = 0;// instead of num - 1; ... then further down change the way col is updated for (int i = 2; i &lt;= num * num; i++) { int newColumn = ((col - 1)+num) % num; int newRow = ((row - 1)+num) % num; if (magic[newRow][newColumn] == 0) { row = newRow; col = newColumn; } else { row = (row + 1) % num; }
answers question: http://stackoverflow.com/q/27415779

http://stackoverflow.com/comment/43136559
type: Comment
comment on: http://stackoverflow.com/a/27334760
type: AnswerComment
has text: Oh man! I downloaded NetBeans. It is way easier to work with! Thank you for the advice!
score: 0

http://stackoverflow.com/comment/43348834
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27455203
type: AnswerComment
has text: do what, exactly, for the other fields?

http://stackoverflow.com/q/27453820
has answer: http://stackoverflow.com/a/27454163
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43345901
has body: Here is the Die Class you asked for... Alex could you explain further about using .getValue in my Die Class? public class Die { private final int MAX = 6; // maximum face value private int faceValue; // current value showing on the die //----------------------------------------------------------------- // Constructor: Sets the initial face value. //----------------------------------------------------------------- public Die() { faceValue = 1; } //----------------------------------------------------------------- // Rolls the die and returns the result. //----------------------------------------------------------------- public int roll() { faceValue = (int)(Math.random() * MAX) + 1; return faceValue; } //----------------------------------------------------------------- // Face value mutator. //----------------------------------------------------------------- public void setFaceValue (int value) { faceValue = value; } //----------------------------------------------------------------- // Face value accessor. //----------------------------------------------------------------- public int getFaceValue() { return faceValue; } //----------------------------------------------------------------- // Returns a string representation of this die. //----------------------------------------------------------------- public String toString() { String result = Integer.toString(faceValue); return result; } } I've tried using different code to find the sum of my Array and ArrayList... here is my code. Could someone please tell me how to solve the end. import java.util.ArrayList; public class Driver { public static void main(String[] args) { // TODO Auto-generated method stub final int SIZE = 10; Die sumArray; Die sumArrayList; Die[] DieList = new Die[SIZE]; ArrayList&lt;Die&gt; DieList2 = new ArrayList&lt;Die&gt;(); for (int i = 0; i &lt; SIZE; i++) { DieList[i] = new Die(); } for (int i = 0; i &lt; SIZE; i++) { DieList2.add(new Die()); } for (int i = 0; i &lt; SIZE; i++) { DieList[i].r…
tagged with: java
has comment: http://stackoverflow.com/comment/43345914
has answer: http://stackoverflow.com/a/27488180
has comment: http://stackoverflow.com/comment/43383347
type: Question
has comment: http://stackoverflow.com/comment/43383299
tagged with: for-loop
tagged with: arrays
has title: Sum of an Array & ArrayClass List
has comment: http://stackoverflow.com/comment/43345952
tagged with: arraylist
score: 0
answer count: 2

http://stackoverflow.com/q/27387635
score: -1
accepted answer: http://stackoverflow.com/a/27387792
tagged with: arraylist
tagged with: element
has comment: http://stackoverflow.com/comment/43223518
upvote count: 0
has body: I'm a fairly new programmer and I have a problem. Im making a dog register, which has to have at least two classes (one for the dogs and one for the actual program) and the attributes for the dogs have to be private. The dog register also have to use an arraylist to store the dogs information and to add/remove dogs and so on. My problem is that I can't figure out how to get the dogs attributes to be listen correctly when I want to show all the elements of the list to the user. This is (scaled down) what it looks like now: public class Dog { private String name; public Hund(String name) { this.name = name; } public String getName() { return name; } public void setName(String name) { setName(name); } public void writeOut() { System.out.print(getName()) } And then there's this class: The main program import java.util.ArrayList; public class DogRegister { private static ArrayList&lt;Dog&gt; dogs = new ArrayList&lt;Dog&gt;(); //The part with the program and menus and such for(int ix = 0; ix &lt; dogs.size(); ix++){ String elementName = dogs.get(ix); elementName.writeOut(); } } What Im trying to do in the last part is to use the "writeOut" method so that the actual name (and other attributes) for the dogs is being written out instead of the "Dog@2ad1e832" I got when I tested it with: System.out.println(dogs.get(ix));
possible better answer: http://stackoverflow.com/a/27387735
favorite count: 0
has answer: http://stackoverflow.com/a/27387735
tagged with: private
has answer: http://stackoverflow.com/a/27387741
answer count: 4
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27387792
has answer: http://stackoverflow.com/a/27387747
tagged with: java
downvote count: 1
type: Question
has title: Need help getting private attributes from another class when using Arraylist
tagged with: arrays

http://stackoverflow.com/comment/43378464
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27471665
has text: moving to answer section
score: 0

http://stackoverflow.com/comment/43183848
comment on: http://stackoverflow.com/a/27362707
has text: The title is being parsed from the subject of the email so it could contain user's admin's basically any word with an apostrophe in it - so I need to be able to remove any instance of an apostrophe - which is why your answer seemed logical - I just don't understand why it isn't working as such http://pastebin.com/sgDU9DTe
type: Comment
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43354136
type: AnswerComment
has text: He can use infoOrderedList to print data while getLow/getHigh with o(1) on map?
score: 0
comment on: http://stackoverflow.com/a/27458547
type: Comment

http://stackoverflow.com/q/27350059
answer count: 1
has comment: http://stackoverflow.com/comment/43154688
favorite count: 0
has title: GCD input number
has comment: http://stackoverflow.com/comment/43154705
has body: I would need help to where i can manually add the input numbers within the script. If you see that a= 273 and b=108 I would like that to print the actually GCD but I am not actually getting the correct input. I am doing something simple but it is still not working. Also would this put in absolute terms, meaning if i put a negative will it make it a positive. Edit: I am not trying to use a scanner class. public class Divisor { private static int a; private static int b; { a= 273; b=108; } private static int returnNumber(int a, int b) { if (b == 0) { return a; } return returnNumber(b, a % b); } public static void main(String[] args) { System.out.println(returnNumber(a, b)); } }
accepted answer: http://stackoverflow.com/a/27350095
type: AnsweredQuestion
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/43154830
tagged with: eclipse
downvote count: 1
type: Question
has comment: http://stackoverflow.com/comment/43154829
tagged with: greatest-common-divisor
has answer: http://stackoverflow.com/a/27350095
score: 0

http://stackoverflow.com/comment/43296815
has text: If you use a Designer Version 8.5, then this is a known bug. As soon as the database is in a Subfolder and not directly in Data- Directory, then this will happen after every change you do in an XPage or a custom control. You can either put the database directly in data- directory during development or update your designer to 9.0.1.
type: QuestionComment
type: Comment
score: 2
comment on: http://stackoverflow.com/q/27427499

http://stackoverflow.com/comment/43231298
comment on: http://stackoverflow.com/a/27391830
score: 0
has text: thanks. Sorry about this. First time using PrintWriter.
type: Comment
type: AnswerComment

http://stackoverflow.com/q/27398533
has comment: http://stackoverflow.com/comment/43243529
answer count: 1
type: UnansweredQuestion
tagged with: servlet-filters
has comment: http://stackoverflow.com/comment/43242747
has title: Is it possible to have load on start up Servlet and a normal Request, Response Servlet in same web.xml?
tagged with: java
has comment: http://stackoverflow.com/comment/43242888
type: Question
tagged with: servlet-listeners
has answer: http://stackoverflow.com/a/27398719
tagged with: servlets
has comment: http://stackoverflow.com/comment/43242830
score: 0
has body: For an implementation of client and server, I need to have on servlet to be started soon after deploying, another one should wait for the request. Is it possible? If what is right way to implement it. <?xml version="1.0" encoding="UTF-8"?> index.html index.jsp WiCodeRedeemRequest WiCodeRedeemRequest com.wicode.redeem.WiCodeRedeemRequest WiCode com.wicode.redeem.WiCode Group 1 Instance 1 1 WiCodeRedeemRequest /WiCode Above is my web.xml. I have seen somewhere usage of listener. I am new to servlet. Need help please.

http://stackoverflow.com/a/27469433
type: Answer
has comment: http://stackoverflow.com/comment/43374478
answers question: http://stackoverflow.com/q/27469334
has comment: http://stackoverflow.com/comment/43374263
has body: Adding to the Swing UI freeze problem, you are also deviding two integers which always rounds down to the nearest integer, so you're setting the progress bar to 0*100 every time except the last time when o == 20, so additionally to using a thread, typecasting o to float and deviding by 20.0f should do the trick: private String performTest(...) { Thread t = new Thread(new Runnable() { @Override public void run() { int o = 1; while (o &lt;= 20) { try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } //Notice typecasts progressBar.setValue((int) (((float) o / 20.0f) * 100)); o++; } } }); t.run(); }
score: 0

http://stackoverflow.com/comment/43198785
comment on: http://stackoverflow.com/a/27373211
score: 0
type: Comment
has text: Sorry I misread the doc, you have to subclass here, see my edit
type: AnswerComment

http://stackoverflow.com/comment/43268738
comment on: http://stackoverflow.com/a/27412214
score: 0
has text: Wrong this also applies to references. The trick to understand is that references are passed by value. Furthermore, Integer is immutable.
type: AnswerComment
type: Comment

http://stackoverflow.com/comment/43114355
type: Comment
type: QuestionComment
has text: For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete Verifiable Example) or [SSCCE](http://www.sscce.org/) (Short, Self Contained, Correct Example).
comment on: http://stackoverflow.com/q/27323421
score: 0

http://stackoverflow.com/a/27419213
accepted answer of: http://stackoverflow.com/q/27419036
answers question: http://stackoverflow.com/q/27419036
type: AcceptedAnswer
downvote count: 0
type: Answer
has body: The Javadoc for TextAttribute.TRACKING says: The tracking value is multiplied by the font point size and passed through the font transform to determine an additional amount to add to the advance of each glyph cluster. Positive tracking values will inhibit formation of optional ligatures. Tracking values are typically between -0.1 and 0.3; values outside this range are generally not desireable. You're pushing your luck slightly with -0.12. But basically there's not much you can do if you're trying to draw text with so few pixels. It will always look bad if you zoom in to text drawn that small. You ought to turn on subpixel rendering, though: that will make it look better, assuming you're on a screen that supports it. You've got greyscale at the moment.
score: 3
upvote count: 3

http://stackoverflow.com/q/27357035
accepted answer: http://stackoverflow.com/a/27357266
has comment: http://stackoverflow.com/comment/43166702
upvote count: 1
has body: I use foursquare API and in order to search some places i have to pass as parameter a string with latitude and longitude like this: 37.963790,23.683090. I also want to add some values to latitude and longitude if i want. After trying with doubles and bigDecimals with no success, i tried : Long lat1 = Long.valueOf("37"); Long lat2 = Long.valueOf("963790"); Long long1 = Long.valueOf("23"); Long long2 = Long.valueOf("683090"); StringBuilder sb = new StringBuilder(); sb.append(lat1); sb.append("."); sb.append(lat2); sb.append(","); sb.append(long1); sb.append("."); sb.append(long2); String ll = sb.toString(); I have tried all these longs as strings sb.append(lat1.toString()). The string i get in every case seems to be what i want, but the result is not. I don't get an error. If this this parameter is not correctly set you get this error: Error occured: [0m[0m13:25:34,463 INFO [stdout] (http-/0.0.0.0:8080-1) code: 400 [0m[0m13:25:34,463 INFO [stdout] (http-/0.0.0.0:8080-1) type: param_error [0m[0m13:25:34,463 INFO [stdout] (http-/0.0.0.0:8080-1) detail: ll must be of the form XX.XX,YY.YY (received java.nio.HeapByteBuffer[pos=0 lim=19 cap=20]) This error appeared when i tried to add utf-8: ByteBuffer a =Charset.forName("UTF-8").encode(sb.toString()); String ll = a.toString(); Any suggestions?
type: AnsweredQuestion
score: 1
tagged with: java
has title: How to build a string with map coordinates?
type: Question
has answer: http://stackoverflow.com/a/27357266
has comment: http://stackoverflow.com/comment/43166592
answer count: 1
downvote count: 0
tagged with: string
favorite count: 0
tagged with: foursquare

http://stackoverflow.com/q/27371733
upvote count: 1
tagged with: swing
has comment: http://stackoverflow.com/comment/43195844
tagged with: java
has body: So I'm making a game with 3 difficulties: Beginner Intermediate Expert In the Expert level I want to close the JFrame after 60 seconds, either clicking a button to start or any other way, doesn't need to be fancy. I've tried many ways but I keep not getting what I want. This is my code: package battleship; import static battleship.Countdown.interval; import static battleship.Countdown.timer; import java.util.Timer; import java.util.TimerTask; import java.awt.Dimension; import java.awt.EventQueue; import java.awt.GridBagLayout; import java.awt.Image; import java.awt.Toolkit; import java.io.IOException; import java.util.Scanner; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.JToggleButton; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; public class Test { static int interval; static Timer timer; public static void main(String[] args) { new Test(); Scanner sc = new Scanner(System.in); System.out.print("Input seconds =&gt; : "); String secs = sc.nextLine(); int delay = 1000; int period = 1000; timer = new Timer(); interval = Integer.parseInt(secs); System.out.println(secs); timer.scheduleAtFixedRate(new TimerTask() { public void run() { System.out.println(setInterval()); } }, delay, period); } private void setIcon1() { setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("ramboo.png"))); } public Test() { EventQueue.invokeLater(new Runnable() { @Override public void run() { setInterval(); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { ex.printStackTrace(); } JFrame frame = new JFrame("BATALLA NAVAL - NIVEL PRINCIPIANTE" ); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.getContentPane().setPreferredSize(new Dime…
type: Question
downvote count: 0
has comment: http://stackoverflow.com/comment/43195201
favorite count: 0
score: 1
has title: Close JFrame after certain time
has comment: http://stackoverflow.com/comment/43195717
tagged with: timer
answer count: 0
tagged with: jframe
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43195166

http://stackoverflow.com/comment/43389357
comment on: http://stackoverflow.com/a/27401839
has text: Actually I have solved that problem.Now what I want to achieve is...I want to check at my jsp page that from what type of device the HTTP request is coming..means whether its from android phone or IOS phone or the system web-browser ??
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/comment/43322963
score: 0
has text: FixedThreadPool will give me fixed parallel execution but can I add request to the pool for processing after executor.submit() method? Also at some point of time pool is blank and if I add request it should start process automatically.
comment on: http://stackoverflow.com/q/27441232
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/80897425
type: QuestionComment
comment on: http://stackoverflow.com/q/27364531
has text: ScrollableResults works like ScrollableResultSet of Jdbc. It fetches data one by one.
score: 0
type: Comment

http://stackoverflow.com/comment/43256082
comment on: http://stackoverflow.com/a/27404390
type: AnswerComment
type: Comment
has text: (In that case, I'd write `Multimap.entries().stream().collect(Collectors.groupingBy(Entry::getValue, Collectors.summingLong(Entry::getKey)))`.)
score: 1

http://stackoverflow.com/comment/43134966
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27339097
has text: Thank you, I have shortened it to what is more relevant.
score: 0

http://stackoverflow.com/q/27363310
has body: I'm trying to use JUnit in a makefile but I can't get it to work. My folder structure is as follows (makefile is in myProject): myProject |--bin |--main |--org |--myPackage |--test |--org | |--myPackage | |--lib where /main contains main files, /test contains test files and /lib contains hamcrest-core-1.3.jar and junit-4.12.jar My makefile is as follows: JAVAC = javac JVM = java JAVADOC = javadoc MKBIN = mkdir -p bin JAVAC_FLAGS = -g -d bin/ JAVAC_CP = -cp SRC = main/ SRCTEST = test/ LIB = lib/*.jar PACKAGE = org/myPackage/*.java TARGET = bin MAIN = org.myPackage.Main .SUFFIXES : .class .java all: $(MKBIN) | $(JAVAC) $(JAVAC_FLAGS) $(SRC)$(PACKAGE) test: $(MKBIN) | $(JAVAC) $(JAVAC_CP) $(LIB) $(SRCTEST)$(PACKAGE) clean: rm -rf $(TARGET) run: $(JVM) $(JAVAC_CP) $(TARGET) $(MAIN) .PHONY: all test clean When I'm running make test I get the following: ~/myProject | 18:07:29&gt;make test mkdir -p bin | javac -cp lib/*.jar test/org/myPackage/*.java test/org/myPackage/MyClass.java:3: error: package org.junit does not exist import static org.junit.Assert.*; ... In Eclipse the tests work perfectly fine. What am I doing wrong?
linked to: http://stackoverflow.com/q/219585
has answer: http://stackoverflow.com/a/27376721
tagged with: java
has comment: http://stackoverflow.com/comment/43178626
type: AnsweredQuestion
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/27376721
has comment: http://stackoverflow.com/comment/43199260
type: Question
tagged with: javac
tagged with: junit
has title: javac junit gives "error: package org.junit does not exist"
has comment: http://stackoverflow.com/comment/43199186
has comment: http://stackoverflow.com/comment/43178598
score: 9
has comment: http://stackoverflow.com/comment/106945057
tagged with: makefile
answer count: 1
upvote count: 9

http://stackoverflow.com/comment/43214228
score: 0
type: AnswerComment
has text: Yep, made my way through the Program with breakpoints.... is there a way to change that or to unlimit the size of an url? There must be a possibility to write more than 1600 characters into an email from a program....
type: Comment
comment on: http://stackoverflow.com/a/27382132

http://stackoverflow.com/q/27322530
answer count: 1
tagged with: url
tagged with: jframe
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27327754
has body: So, when I try the following code: //Main Class package com.mgflow58.Main; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import javax.imageio.ImageIO; import javax.swing.ImageIcon; import javax.swing.JFrame; public class Game { public static void main(String[] args) { BufferedImage mainicon = null; JFrame window = new JFrame("Guppy's Adventure"); window.add(new GamePanel()); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setResizable(false); window.pack(); window.setLocationRelativeTo(null); window.setVisible(true); try { String mainurlstring = "icon.gif"; URL mainurl = new URL(mainurlstring); try { mainicon = ImageIO.read(mainurl); window.setIconImage(new ImageIcon(mainicon).getImage()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (MalformedURLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } I get the following error: java.net.MalformedURLException: no protocol: icon.gif at java.net.URL.&lt;init&gt;(Unknown Source) at java.net.URL.&lt;init&gt;(Unknown Source) at java.net.URL.&lt;init&gt;(Unknown Source) at com.mgflow58.Main.Game.main(Game.java:28) The file icon.gif is in the root folder, and I even tried copying it into src/com/mgflow58/Main where the class executing the code is in. What am I doing wrong? I simply can not set an image icon no matter which methods I try and I have been trying to find an answer for a while already.
tagged with: java
has title: Url loading error for image in runnable jar
type: Question
tagged with: icons
score: 0

http://stackoverflow.com/a/27342322
type: Answer
has comment: http://stackoverflow.com/comment/43154326
answers question: http://stackoverflow.com/q/27335505
has comment: http://stackoverflow.com/comment/43172216
has body: So after a lot of searching I have come up with the following solution for a CSS based approach. Works perfectly List&lt;WebElement&gt; channels = driver.findElements(By.tagName("span")); for(WebElement channel : channels){ String selectedChannel = channel.getText(); if (selectedChannel.equalsIgnoreCase(channelId)){ channel.click(); break; } }
score: 0

double
tags question: http://stackoverflow.com/q/27332239
tags question: http://stackoverflow.com/q/27381737
tags question: http://stackoverflow.com/q/27405726
tag name: double
tags question: http://stackoverflow.com/q/27389574
type: Tag
tags question: http://stackoverflow.com/q/27433900
tags question: http://stackoverflow.com/q/27442112
tags question: http://stackoverflow.com/q/27459780
tags question: http://stackoverflow.com/q/27470757
tags question: http://stackoverflow.com/q/27368422
tags question: http://stackoverflow.com/q/27455662
tags question: http://stackoverflow.com/q/27431296

http://stackoverflow.com/comment/43168364
comment on: http://stackoverflow.com/q/27355904
score: 0
has text: That's great, but just because VFS understands a RAM filesystem doesn't mean that standard Java URL is ever going to understand it. Most likely your code is not using VFS properly at all and right now it works by accident. You'd need to post more code to say that for certain.
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43211612
has text: @DenisHartwood, how do you know there is a ~1500 character cut-off? Have you printed the string to console or did you in fact email the string?
score: 0
comment on: http://stackoverflow.com/q/27381360
type: Comment
type: QuestionComment

http://stackoverflow.com/a/27427991
has body: Eh you can look at this if it helps. Easy to read. public class ExampleTextEdit { public static String APPLICATION_LOCATION; public static File textFile; public static BufferedReader reader; public static void main(String[] args) { APPLICATION_LOCATION = ExampleTextEdit.class.getProtectionDomain() .getCodeSource().getLocation().getPath(); textFile = new File(APPLICATION_LOCATION + File.separator + "mytextfile.txt"); try { if ( !textFile.exists()) { textFile.createNewFile(); BufferedWriter writer = new BufferedWriter(new FileWriter( textFile)); for (int i = 0; i &lt; 20; i++) { writer.write("this that " + i); writer.newLine(); } writer.flush(); writer.close(); } else { loadText(); File f = new File(APPLICATION_LOCATION + File.separator + "temp.txt"); f.createNewFile(); String temp; BufferedWriter writeNew = new BufferedWriter(new FileWriter(f)); reader = new BufferedReader(new FileReader(textFile)); while ((temp = reader.readLine()) != null) { if (temp.contains("" + 14)) writeNew.write("lol changed"); else writeNew.write(temp); writeNew.newLine(); } writeNew.flush(); writeNew.close(); reader.close(); textFile.delete(); f.renameTo(textFile); } } catch (Exception e) { e.printStackTrace(); } } public static void loadText() throws Exception { String line; reader = new BufferedReader(new FileReader(textFile)); while ((line = reader.readLine()) != null) { System.out.println(line); } } } You don't need to be too fancy with stuff until you get more familiar with the libraries stick to what you know.
upvote count: 0
score: -1
has comment: http://stackoverflow.com/comment/43297625
has comment: http://stackoverflow.com/comment/43297478
has comment: http://stackoverflow.com/comment/43297564
answers question: http://stackoverflow.com/q/27427225
type: Answer
downvote count: 1

http://stackoverflow.com/a/33109696
has body: Here is the code for it. Build.Gradle file dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:23.0.1' } styles.xml Create a new layout file toolbar.xml <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:id="@+id/toolbar" android:minHeight="?attr/actionBarSize" android:background="@color/primary" android:layout_width="match_parent" android:layout_height="wrap_content" app:popupTheme="@style/ThemeOverlay.AppCompat.Light" app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"/> activity_main.xml <include layout="@layout/toolbar"/> <TextView android:text="@string/hello_brew" android:layout_width="wrap_content" android:layout_height="wrap_content"/> MainActivity.java @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); } This is how you create a toolbar. The example is from http://www.ahotbrew.com/android-toolbar-example/ If you need to show the toolbar at the bottom then you'll find the code snippet in the link.
answers question: http://stackoverflow.com/q/27389552
type: Answer
score: 0

http://stackoverflow.com/comment/43332573
has text: Because `result |= (b3 | 0x0c)` bitwise-ors `result` against `52` in this instance. From what I can tell you're only trying to set the 2 bits at position 5 and 6.
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27446622
score: 1

http://stackoverflow.com/comment/43254329
score: 0
type: Comment
type: AnswerComment
has text: For some reason it changes the order of the objects but thats ok. Thank you very much!
comment on: http://stackoverflow.com/a/27402084

http://stackoverflow.com/q/27447765
has title: Finding Library Location in Java
favorite count: 0
tagged with: netbeans
has comment: http://stackoverflow.com/comment/43335009
has comment: http://stackoverflow.com/comment/43334979
type: UnansweredQuestion
upvote count: 1
has comment: http://stackoverflow.com/comment/43337681
has comment: http://stackoverflow.com/comment/43335258
answer count: 0
score: 1
tagged with: java
has comment: http://stackoverflow.com/comment/43334502
type: Question
has body: I'm working on a Java project with a native library in question. I believe that another version is being loaded when I try to use it from a non-Netbeans environment- when I debug the file in Netbeans, it works as expected, but when I run it from anywhere else, it hits a "NoSuchMethodError", leading me to believe that there is another instance (in the wrong version) being loaded I've already examined my java.library.path and removed all other instances of the library beyond the dist/lib, but the error persists. Is there an easy way to find the location of a loaded library, so that I might be able to find out what is happening?
downvote count: 0
tagged with: jar

http://stackoverflow.com/comment/43366538
comment on: http://stackoverflow.com/a/27464848
has text: But surely an ArrayList will reserve the space of the size of the HahsSet passed to the constructor and there will be no add operations at all?
type: AnswerComment
type: Comment
score: 1

http://stackoverflow.com/comment/43163414
type: Comment
has text: "Without thread safety" is one answer. See [this answer](http://stackoverflow.com/a/16106598/256196) for one of the standard idioms.
comment on: http://stackoverflow.com/q/27355230
score: 1
type: QuestionComment

faceted-search
tag name: faceted-search
type: Tag
tags question: http://stackoverflow.com/q/27376719

http://stackoverflow.com/comment/43317892
type: Comment
comment on: http://stackoverflow.com/q/27438667
has text: Any code from your side?
score: 0
type: QuestionComment

http://stackoverflow.com/q/27367207
answer count: 1
has answer: http://stackoverflow.com/a/27367733
has body: I am getting data for a particular user id from 14 tables as shown below. As part of data, I am extracting user_id, record_name and record_value and then I get timestamp from record_name (by splitting on it) and then populate my TreeMap with key as timestamp and value as record_value. After that I am extracting 100 most recent record_value from valueTimestampMap and then populating it in my recordValueHolder LinkedList. In my case 100 most recent means by looking at the timestamp not the way they are coming. Below is my code - public List&lt;String&gt; getData(String userId) { List&lt;String&gt; recordValueHolder = new LinkedList&lt;String&gt;(); Map&lt;Long, String&gt; valueTimestampMap = new TreeMap&lt;Long, String&gt;(Collections.reverseOrder()); for (int tableNumber = 0; tableNumber &lt; 14; tableNumber++) { String sql = "select * from table_" + tableNumber + " where user_id='" + userId + "';"; SimpleStatement query = new SimpleStatement(sql); query.setConsistencyLevel(ConsistencyLevel.QUORUM); ResultSet res = session.execute(query); Iterator&lt;Row&gt; rows = res.iterator(); while (rows.hasNext()) { Row r = rows.next(); String user_id = r.getString("user_id"); // get user id String record_name = r.getString("record_name"); // get record name String record_value = r.getString("record_value"); // get record value long timestamp = Long.parseLong(record_name.split("\\.")[1]); // populate my tree map valueTimestampMap.put(timestamp, record_value); } } // now extract 100 most recent record_value since // valueTimestampMap is already sorted basis on key in // descending order for (Map.Entry&lt;Long, String&gt; entry : valueTimestampMap.entrySet()) { if (recordValueHolder.size() &gt; 99) break; recordValueHolder.add(entry.getValue()); } return recordValueHolder; } I am sorting TreeMap in descending order of the keys by using Collections.reverseOrder() so that I have most recent timestamps at the top and then I can simply extract 100 most recent record_value from it and…
tagged with: data-structures
score: 0
tagged with: dictionary
has title: How to make a data structure which can hold 100 most recent record_values basis on timestamp?
accepted answer: http://stackoverflow.com/a/27367733
has comment: http://stackoverflow.com/comment/43187061
type: AnsweredQuestion
tagged with: algorithm
tagged with: java
type: Question

http://stackoverflow.com/q/27404362
type: Question
has title: Custom dialog using JOptionPane API won't dispose
accepted answer: http://stackoverflow.com/a/27404379
has body: I've been just playing with JOptionPane API to show a custom dialog and I've found a strange situation: when I choose either OK or Cancel option or press Esc key this dialog won't dispose as expected. The thing is, instead of using this single line to display a modal dialog: JOptionPane.showConfirmDialog( null , "The quick brown fox jumps over the lazy dog." , "New Dialog" , JOptionPane.OK_CANCEL_OPTION , JOptionPane.PLAIN_MESSAGE); I wanted to use the API, setting all the parameters one by one and displaying a dialog as shown in the docs (see Direct Use section): JOptionPane pane = new JOptionPane(arguments); pane.set.Xxxx(...); // Configure JDialog dialog = pane.createDialog(parentComponent, title); dialog.show(); However, when I close the dialog my application keeps running, even if I set the default close operation to DISPOSE_ON_CLOSE, and it makes me suspect the dialog is not properly disposed. Below is a MCVE to play with: import javax.swing.JDialog; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; public class Demo { public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { JOptionPane optionPane = new JOptionPane(); optionPane.setMessage("The quick brown fox jumps over the lazy dog."); optionPane.setOptionType(JOptionPane.OK_CANCEL_OPTION); optionPane.setMessageType(JOptionPane.PLAIN_MESSAGE); JDialog dialog = optionPane.createDialog("New Dialog"); dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); dialog.setVisible(true); } }); } }
tagged with: dispose
answer count: 1
downvote count: 0
favorite count: 0
has answer: http://stackoverflow.com/a/27404379
tagged with: joptionpane
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: swing

http://stackoverflow.com/comment/43313976
score: 0
has text: what is your output? what kind of error message u get?
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27436643

http://stackoverflow.com/comment/43288553
has text: Ur almost correct but u need to write ft[j] = ft[j-1]. this gives the correct answer
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27386766
score: 1

http://stackoverflow.com/a/27369932
downvote count: 0
has comment: http://stackoverflow.com/comment/43212547
type: Answer
score: 1
accepted answer of: http://stackoverflow.com/q/27369840
answers question: http://stackoverflow.com/q/27369840
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43268932
has body: You need to create servlet mapping in your web.xml. See here as well. So in your web.xml define; hello <package name>.HelloServlet Then create mappings (url patterns) for the servlet. hello /say_hello/* Now in your JSP refernce the servlet like Fibonacci Sequence Length Value [1-100]
upvote count: 1
has comment: http://stackoverflow.com/comment/43221477

http://stackoverflow.com/q/27343416
tagged with: java
type: Question
possible better answer: http://stackoverflow.com/a/27344036
has answer: http://stackoverflow.com/a/27344036
tagged with: struts2
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27344405
linked to: http://stackoverflow.com/q/11262617
tagged with: spring-security
has title: error persistence.xml jpa 2 spring hibernate 3
tagged with: spring
type: AnsweredQuestion
has body: when i try to run my app in Tomcat 7.0 i use hibernate 3 + spring + mysql for DB i receive this exception : Caused by: org.xml.sax.SAXParseException; lineNumber: 5; columnNumber: 19; cvc-complex-type.3.1: Value '2.0' of attribute 'version' of element 'persistence' is not valid with respect to the corresponding attribute use. Attribute 'version' has a fixed value of '1.0'. applicationcontext.xml <tx:annotation-driven proxy-target-class="true" transaction-manager="transactionManager" /> <context:annotation-config></context:annotation-config> persistence_hibernate.xml <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 and this is the dependencies i use org.springframework spring-core 3.2.8.RELEASE org.springframework spring-orm 3.1.1.RELEASE org.hibernate hibernate-entitymanager 3.6.0.Final org.hibernate.javax.persistence hibernate-jpa-2.0-api 1.0.1.Final there is a problem with tomcat, should I use Jboss or something like that ?
accepted answer: http://stackoverflow.com/a/27344405

http://stackoverflow.com/a/27454148
has body: You have a couple options. If you really want just a static initialization of an array of A values, you can do this: A[] arrayOfAs = {new A(), new A(), new A()}; But perhaps better is this: List&lt;A&gt; listOfAs = new ArrayList&lt;&gt;(); listOfAs.add(new A()); listOfAs.add(new A()); // ... listOfAs.add(new A()); // then finally: A[] arrayOfAs = listOfAs.toArray(new A[0]); Which is better will depend on your context. The "new A[0]" may look funny, but it is required in order to tell Java the correct type to return. Having said that, a container class like a List may be preferable.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27454020

http://stackoverflow.com/a/77863617
has body: I had the same experience. Using this command, where java from cmd we can get the java.exe path locations. Removing the java.exe for the old java version resolved my problem.
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27357396

http://stackoverflow.com/comment/43297121
score: 0
type: QuestionComment
has text: Unfortunately that adds the part below the menu/toolbar. I was hoping to place it above it.
type: Comment
comment on: http://stackoverflow.com/q/27425069

http://stackoverflow.com/comment/43164699
type: Comment
score: 1
type: QuestionComment
comment on: http://stackoverflow.com/q/27355827
has text: Here is an article that complains about this feature missing, and presents a solution involving some custom code: http://java.dzone.com/articles/secret-key-import-java

http://stackoverflow.com/a/27439929
answers question: http://stackoverflow.com/q/27439055
score: 0
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27439055
type: Answer
has body: You have to link the hellouniverse stuff into the library. For example g++ -fPIC -shared -I$JAVA_PATH/include -I$JAVA_PATH/include/linux/ -o libhelloworld.so hellworld.cpp hellouniverse.cpp Or g++ -fPIC -I $JAVA_PATH/include -I$JAVA_PATH/include/linux -c helloworld.cpp g++ -fPIC -I $JAVA_PATH/include -I$JAVA_PATH/include/linux -c hellouniverse.cpp g++ -fPIC -shared -o libhelloworld.so helloworld.o hellouniverse.o Consider using a Makefile to automate this.

class-variables
tag name: class-variables
type: Tag
tags question: http://stackoverflow.com/q/27462689

http://stackoverflow.com/q/27404911
answer count: 4
possible better answer: http://stackoverflow.com/a/27405089
tagged with: parameters
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27405089
upvote count: 2
score: 1
has comment: http://stackoverflow.com/comment/43255101
downvote count: 1
type: Question
has answer: http://stackoverflow.com/a/27405154
tagged with: java
has answer: http://stackoverflow.com/a/27405303
has comment: http://stackoverflow.com/comment/43255187
tagged with: typing
has body: I'm trying to implement a Class structure, where I'm able to create Box-Objects of different types. These types are: Squares, Circles, Rectangles and Hexagons. For the abstract father class Box I'd like to specify a setDimensions() method that has to be implemented in all child objects. However, the dimension parameters for all objects are different (Except for the height): Circles have a diameter, Rectangles have a width and length, and Hexagons and Squares have equally sized sides. Is it possible to define a Interface/abstract method that can handle this type of job? //EDIT: This is for a programming assignment. Obviously all classes have suitable constructors, but this program "simulates" a project where the implementation of a design pattern is supposed to be useful. I'm trying to apply the prototype pattern, where you clone a basic box and set the parameters based on another box that I would like to place in the new one. I know it isn't a terribly good example, but we have to solve it that way. Alternatively a factory pattern is also an option, but I would like to avoid having to write too many factory classes.
favorite count: 0
has title: Create an abstract method without fixing the types of its parameters
has answer: http://stackoverflow.com/a/27405790
accepted answer: http://stackoverflow.com/a/27405303

http://stackoverflow.com/q/27448641
type: Question
has body: I want image before textview and want to customize TextView in each row but it is hard for me to implement it because there is already xml such layout file simple_list_item_1 made inbuilt. Please help me how can i implement it. Here is simple_list_item coding &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;!-- Copyright (C) 2006 The Android Open Source Project 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. --&gt; &lt;TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="20sp" android:textStyle="bold" android:textAppearance="?android:attr/textAppearanceListItemSmall" android:gravity="center_vertical" android:paddingStart="?android:attr/listPreferredItemPaddingStart" android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" android:minHeight="?android:attr/listPreferredItemHeightSmall" /&gt; Main Activity public class MainActivity extends ListActivity { private ListActivity activity; final static String ScreenName = "google"; final static String LOG_TAG = "rnc"; ListView listview; TextView text; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.twit_list); listview = this.getListView(); activity = this; downloadTweets(); listview.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { // selected item Stri…
tagged with: java
accepted answer: http://stackoverflow.com/a/27500658
tagged with: listview
score: 0
upvote count: 1
answer count: 1
downvote count: 1
has answer: http://stackoverflow.com/a/27500658
favorite count: 0
tagged with: android
has comment: http://stackoverflow.com/comment/43426867
type: AnsweredQuestion
has title: How to implement CustomAdapter in ListView Acitivity

http://stackoverflow.com/comment/43189635
comment on: http://stackoverflow.com/a/27368905
has text: And this is a limitation of arrays. An ArrayList would be much better, as you don't need to specify the size when you make one.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/q/27438964
type: Question
score: 0
has comment: http://stackoverflow.com/comment/43318146
has comment: http://stackoverflow.com/comment/43318027
has title: Android: read and write data to xml file
has comment: http://stackoverflow.com/comment/43317951
has body: Im very new do android and java development. Im creating an app that allows a user to create multiple and undefined amount of checklists and within each checklist the user can add an undefined amount of items. (Each checklist will have different items the user has added.) The checklists will be displayed in a listView on the MainActivity and the checklist items will be displayed in a listview in the checkListActivity. The the checklists are created by the user entering a ListName into a EditText and presses the AddList Button which are on the MainActivity. The items are added with a similar process but on the CheckListActivity. To achieve this I think I need an xml file. It would look something like this. Example CheckList 1 ExampleItem1 ExampleItem2 ExampleItem3 ExampleItem4 ExampleItem5 ExampleItem6 Example CheckList 2 ExampleItem1 ExampleItem2 ExampleItem3 ExampleItem4 ExampleItem5 ExampleItem6 Example CheckList 3 ExampleItem1 ExampleItem2 ExampleItem3 ExampleItem4 ExampleItem5 ExampleItem6 Example CheckList 4 ExampleItem1 ExampleItem2 ExampleItem3 ExampleItem4 ExampleItem5 ExampleItem6 ...And so on... When the MainActivity loads I need the app to display the current CheckLists in the listview. When the user clicks on a listview item it takes them to the checkListActivity which displays the items for said CheckList in another listview. How would I go about doing this? Any advice, examples and comments are very much appreciated.
tagged with: android
tagged with: http://stackoverflow.com/tag/xml
has comment: http://stackoverflow.com/comment/43317832
answer count: 0
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/43335212
score: 0
type: AnswerComment
has text: What error are you getting? If you're using Java 6 or 5 then you can't use the diamond operator `<>` (but those versions aren't supported anymore anyway).
type: Comment
comment on: http://stackoverflow.com/a/27447839

http://stackoverflow.com/comment/43269854
comment on: http://stackoverflow.com/q/27412682
has text: Make sure jackson-core.jar is exported in your .classpath file
score: 0
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43337904
has text: Why are you passing an `int[]` to a method that takes an `int[][]`?
score: 0
comment on: http://stackoverflow.com/q/27449526
type: Comment
type: QuestionComment

http://stackoverflow.com/comment/43277428
score: 0
type: Comment
has text: thanks for the quick reply, believe it or not i found the same thing and did this in the meanwhile after posting this question, but the problem now is that when i use this in my widget, i get an error and now i get 'problem loading widget' instead of widget
comment on: http://stackoverflow.com/a/27416479
type: AnswerComment

http://stackoverflow.com/comment/43322396
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27441425
has text: How is data stored in the file?
score: 0

http://stackoverflow.com/comment/43272324
has text: @Jonjongot It isn't waiting either. It just skips it and moves on.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27392089

http://stackoverflow.com/q/27394621
type: UnansweredQuestion
tagged with: web-services
tagged with: java
has body: Im using Java HTTP webservice client for requesting to server as POST (using text/xml request format). Actually its working fine in my system. But, in Server side they couldnt get any request from my side. Server is not in our control (its government related server and they are using SSL/TLS handshake for security). Server team provided the keys for handshake. Actually I dont know how to use SSL/TLS and how to add this in my code. Server team told, they will receive the request after handshake success. I'm stuck now. Adding Certificate on my Tomcat server is needed? How to add SSL handshake in my request?? If anyone know SSL/TLS handshake , please help me with hints. Thanks in advance.. My Codes are following : public File sendRequest(File req_xml, String responseFileName) { File xmlFile = new File(responseFileName); try { OutputStream outputStream = new FileOutputStream(xmlFile); HttpClient httpClient = new org.apache.commons.httpclient.HttpClient(); httpClient.getParams().setParameter("http.useragent", "Web Service Test Client"); BufferedReader br = null; PostMethod methodPost = new PostMethod("http://192.168.1.53:8080/MyApplication/service"); try { methodPost.setRequestBody(new FileInputStream(req_xml)); } catch (FileNotFoundException e1) { e1.printStackTrace(); } methodPost.setRequestHeader("Content-Type", "text/xml"); try { int returnCode = httpClient.executeMethod(methodPost); if (returnCode == HttpStatus.SC_NOT_IMPLEMENTED) { System.out .println("The Post method is not implemented by this URI"); methodPost.getResponseBodyAsString(); } else { br = new BufferedReader(new InputStreamReader( methodPost.getResponseBodyAsStream())); int read = 0; byte[] bytes = new byte[1024]; while ((read = methodPost.getResponseBodyAsStream().read( bytes)) != -1) { outputStream.write(bytes, 0, read); } } } catch (Exception e) { e.printStackTrace(); } finally { methodPost.releaseConnection(); if (br != null) try { br.close(); } catch (Exception fe) { fe.printStackTrace(); } } } ca…
type: Question
has answer: http://stackoverflow.com/a/27740815
tagged with: ssl
score: 0
answer count: 2
has answer: http://stackoverflow.com/a/27394744
has title: How to use SSL/TLS handshake in my Java Webservice Client Request

http://stackoverflow.com/comment/43188159
score: 1
comment on: http://stackoverflow.com/q/27368067
type: QuestionComment
type: Comment
has text: well, that really depends on how many bits you use to represent the integer. 6 as an int is actually 00000000..000110.

http://stackoverflow.com/comment/43191916
has text: i changed 1.6* to 1.8* on my mac
type: Comment
comment on: http://stackoverflow.com/a/27369596
score: 15
type: AnswerComment

http://stackoverflow.com/comment/43323436
comment on: http://stackoverflow.com/a/27436250
type: AnswerComment
has text: jsp files use `<jsp-file>` property instead of `<servlet-class>`.
score: 0
type: Comment

http://stackoverflow.com/comment/43290658
score: 1
comment on: http://stackoverflow.com/a/27414305
type: AnswerComment
has text: Yep, that's definitely possible. [Here is a good article](http://cyrilmottier.com/2011/06/20/listview-tips-tricks-1-handle-emptiness/) that describes how to handle empty ListViews. You are looking for the [`setEmptyView(View)`](http://developer.android.com/reference/android/widget/AdapterView.html#setEmptyView(android.view.View)) method of ListView. Copying this comment in to main answer also.
type: Comment

http://stackoverflow.com/a/27393226
has body: timesLopped++ shall be outside the for loop: public static void ascending(int[] array) { int timesLooped = 0; boolean sorted = false; while(!sorted) { sorted = true; for(int i = 0; i &lt; array.length - timesLooped - 1; i++) { if(array[i] &gt; array[i + 1]) { swapElements(array, i, i + 1); sorted = false; } } timesLooped++; } }
upvote count: 3
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27393159
type: Answer
answers question: http://stackoverflow.com/q/27393159
score: 3
downvote count: 0

http://stackoverflow.com/q/27470229
has title: How to test whether input received is not an integer (without using else statement)
score: 0
has comment: http://stackoverflow.com/comment/43375323
tagged with: input
tagged with: integer
has comment: http://stackoverflow.com/comment/43375362
type: UnansweredQuestion
type: Question
has comment: http://stackoverflow.com/comment/43375419
tagged with: testing
tagged with: java
has answer: http://stackoverflow.com/a/27470299
has answer: http://stackoverflow.com/a/27470347
has body: I have just started programming and I have a question. Any help will be greatly appreciated. So I want to test if input received from scanner is not an integer, and if it isn't an integer I would like to System.out.println("The number you have entered is not valid"); It is for a password generator and if they do not enter a valid number for how many characters they would like, it will return by saying that it is not valid. Unfortunately I cannot use else statement, because there are Here is my code: import java.util.Random; import java.util.Scanner; public class pGenerator { public static void main(String[] args) { final String characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; //gives possible character selections final int N = characters.length(); Random r = new Random(); //creates a new random function Scanner input = new Scanner(System.in); //scanner enables user to input something System.out.println("Enter number of characters you would like your password to be:"); //asks user the amount of characters they would like their password to be int passwordcharacters = (int) input.nextDouble(); // while (passwordcharacters &gt;0) { //while the number of characters is more that 0, continue with following code System.out.print(characters.charAt(r.nextInt(N))); //prints out a random character from the String characters --passwordcharacters; //minuses 1 from number inputed and continues with code if it is more that 0 } if (input.nextDouble() &lt; 0) { //tests for if number is less than 0 System.out.println("The number you have entered is less than 0"); } if (input.nextDouble() == 0); { //tests for if number is 0 System.out.println("The number you have entered is 0"); } } } Is there a possible way to do something like this (I know this is wrong, but just an example) if (input.nextDouble() != integer); { //tests for if number is not an integer System.out.println("The number you have entered is invalid"); Thank you for your time :) EDIT:// Hey all…
answer count: 2

http://stackoverflow.com/comment/43233341
type: Comment
comment on: http://stackoverflow.com/q/27393011
score: 1
has text: im not a fan of eclipse or spamming fields either, just pointing out if OP wasn't aware.
type: QuestionComment

otto
tag name: otto
type: Tag
tags question: http://stackoverflow.com/q/27466644

http://stackoverflow.com/q/27393011
has body: I have a class with many (about 100) fields. I want to implement hashCode() and equals() methods for these fields, is there any alternative to doing this manually?
upvote count: 3
downvote count: 1
has answer: http://stackoverflow.com/a/27393236
has comment: http://stackoverflow.com/comment/43233308
favorite count: 0
has answer: http://stackoverflow.com/a/47423640
has comment: http://stackoverflow.com/comment/43233660
has title: Creating .hashcode() and .equals() methods for a large object
has answer: http://stackoverflow.com/a/27393253
answer count: 4
score: 2
tagged with: equals
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43233297
has comment: http://stackoverflow.com/comment/43233431
has comment: http://stackoverflow.com/comment/43233482
type: Question
has comment: http://stackoverflow.com/comment/43233302
tagged with: hashcode
tagged with: java
has comment: http://stackoverflow.com/comment/43233341
has answer: http://stackoverflow.com/a/27393565

conways-game-of-life
tags question: http://stackoverflow.com/q/27339097
tag name: conways-game-of-life
type: Tag

httpsurlconnection
type: Tag
tags question: http://stackoverflow.com/q/27438034
tag name: httpsurlconnection
tags question: http://stackoverflow.com/q/27331486

http://stackoverflow.com/comment/43248935
has text: The error 1 basically tells you that you have a duplicate file...Rename it or delete it.
type: Comment
type: QuestionComment
score: 1
comment on: http://stackoverflow.com/q/27402048

cocos2d-android
type: Tag
tag name: cocos2d-android
tags question: http://stackoverflow.com/q/27397199

http://stackoverflow.com/q/27335792
has answer: http://stackoverflow.com/a/27335840
has comment: http://stackoverflow.com/comment/43131469
has answer: http://stackoverflow.com/a/27336759
type: AnsweredQuestion
downvote count: 0
score: 1
has body: I'm pretty much trying to use a class constant to declare as a file but get an error. import java.awt.*; import java.util.*; import java.io.*; public class BabyNames { public static final Scanner NAME=new Scanner(new File("names.txt")); //specifically this part public static final int YEAR=1900; //generates the error public static final int LS=11; public static final int WIDTH=50; public static void main(String[] args) throws FileNotFoundException{ intro(); personName(); graph(); } // Error contained: // BabyNames.java:6: error: unreported exception FileNotFoundException; must be caught or // declared to be thrown // public static final Scanner NAME=new Scanner(new File("names.txt")); ^ //1 error this is not all of the program but dont think the rest is required. sorry if my method of asking was funky, first time. thanks much.
accepted answer: http://stackoverflow.com/a/27337385
favorite count: 0
type: Question
has comment: http://stackoverflow.com/comment/43128417
answer count: 3
upvote count: 1
has answer: http://stackoverflow.com/a/27337385
has title: class constants and file imports for java
possible better answer: http://stackoverflow.com/a/27335840
tagged with: java

http://stackoverflow.com/a/27379850
answers question: http://stackoverflow.com/q/27379233
has body: Use this method to find distance between two points http://www.geodatasource.com/developers/java private double distance(double lat1, double lon1, double lat2, double lon2, char unit) { double theta = lon1 - lon2; double dist = Math.sin(deg2rad(lat1)) * Math.sin(deg2rad(lat2)) + Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * Math.cos(deg2rad(theta)); dist = Math.acos(dist); dist = rad2deg(dist); dist = dist * 60 * 1.1515; if (unit == "K") { dist = dist * 1.609344; } else if (unit == "N") { dist = dist * 0.8684; } return (dist); } private double deg2rad(double deg) { return (deg * Math.PI / 180.0); } system.println(distance(32.9697, -96.80322, 29.46786, -98.53506, "M") + " Miles\n"); system.println(distance(32.9697, -96.80322, 29.46786, -98.53506, "K") + " Kilometers\n"); system.println(distance(32.9697, -96.80322, 29.46786, -98.53506, "N") + " Nautical Miles\n");
type: Answer
score: 2
downvote count: 0
has comment: http://stackoverflow.com/comment/119184986
upvote count: 2

http://stackoverflow.com/comment/43241403
type: AnswerComment
comment on: http://stackoverflow.com/a/27394733
score: 0
type: Comment
has text: 1- Same application is running on my college's system so i do not think there will be any db port listening issue. 2-I have tried by disable firewall and then running the program but still facing the same error.

http://stackoverflow.com/a/27334216
type: Answer
upvote count: 7
score: 7
has body: Technically you can have such a structure using Unsafe class. with it you can allocate as much memory as you want (as you have actually). To be noted that this is native memory and not heap memory. Because of this, there are downsides as compared to typical arrays, though: the memory isn't garbage collected (you'll need to manually deallocate memory) and there aren't bound checks so without being careful you can have seg fault and crash your JVM. See example here, at Big Array section: http://mishadoff.com/blog/java-magic-part-4-sun-dot-misc-dot-unsafe/ Also there are rumors that future versions of JVM and the language will have support arrays of size long.
downvote count: 0
answers question: http://stackoverflow.com/q/27333879

http://stackoverflow.com/comment/43093144
score: 0
has text: remove the Project PortalCommon from the Classpath - tomcat. Then go to project PotralLogin properties - java build path - > projects , add project PortalCommon. Build Clean, Stop tomcat and the Start it
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27315809

http://stackoverflow.com/comment/43231678
score: 0
type: Comment
has text: From what I know, or i could be completely wrong. My Array Class is considered top-down since you have a row of results equal to a specific integer (or index) and they are seen as a "table" results. While a left-right array comparison is just comparing the value that is left and right of a specific row of arrays (for example Array[0][1] Compared to Array[0][2])
type: QuestionComment
comment on: http://stackoverflow.com/q/27391959

http://stackoverflow.com/q/27371680
tagged with: jsf
tagged with: primefaces
tagged with: java
tagged with: hibernate
score: -1
type: Question
tagged with: jsf-2
has body: so the intention was jsf+hibernate integration .so when every time we run the program hibernate should execute the select from table name and that values should be populated in the primefaces data table import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name="solodemo") public class solodemo { public String getFname() { return fname; } public void setFname(String fname) { this.fname = fname; } public solodemo(String fname, String lanme) { this.fname = fname; this.lanme = lanme; } public String getLanme() { return lanme; } public void setLanme(String lanme) { this.lanme = lanme; } solodemo(){} @Column(name="fname") @Id private String fname; @Column(name="lname") private String lanme; } hibernate pojo class import java.util.ArrayList; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; import org.hibernate.Query; import org.hibernate.Session; import hibernate.Util; @ManagedBean(name="datafromtable") @RequestScoped public class Solomain { private ArrayList<solodemo> list; public ArrayList<solodemo> getList() { return list; } public void setList(ArrayList<solodemo> list) { this.list = list; } public ArrayList<solodemo> init(){ Session sn=Util.getSessionFactory().openSession(); sn.beginTransaction(); Query qry=sn.createQuery(" from solodemo p"); list=new ArrayList<solodemo>(qry.list()); System.out.println("yo bitch you have done it"); return list; } } this is the managed bean <h:head> DATA TABLES DEMO </h:head> <h:body> <h:form> output values <p:dataTable value="#{datafromtable.list}" var="so"> <p:column headerText="firstname"> <h:outputText value="#{so.fname}"/> </p:column> <p:column headerText="lanme"> <h:outputText value="#{so.lname}"/> </p:column> </p:dataTable> </h:form> </h:body> this is the xhtml file every time i run this file this should go to managed bean then select query should fetch the data from data base and it should be populated in datatable…
answer count: 1
downvote count: 1
favorite count: 0
has answer: http://stackoverflow.com/a/27374256
has comment: http://stackoverflow.com/comment/43194849
upvote count: 0
type: UnansweredQuestion
has title: primefaces data table from hibernate select not working

http://stackoverflow.com/q/27443958
has title: Internal Exception: java.sql.SQLException: No database selected
possible better answer: http://stackoverflow.com/a/36202293
tagged with: persistence
has answer: http://stackoverflow.com/a/36202293
answer count: 2
has body: I know this question is very common among persistence users. I've visited so many the threads and questions on so many forums and still I'm not getting solution. I've created RESTful web services from database (an option in Netbeans 8.0.2). I've also created connection pool and JNDI for this project. Names are properly given as shown here. Using EclipseLink (JPA 2.1) i.e by default I'm getting this kind of response: GET RequestFailed RequestFailed --> Status: (500) Response: { HTTP Status 500 - Internal Server Error type Exception report messageInternal Server Error descriptionThe server encountered an internal error that prevented it from fulfilling this request. exception javax.servlet.ServletException: javax.ejb.EJBException root cause javax.ejb.EJBException root cause javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: No database selected Error Code: 1046 Call: SELECT id, access_expires, access_token, address, bank_account_type, created, device_id, device_type, email, facebook_id, grazie_code, latitude, longitude, password, phone_number, profile_pic, refresh_expires, refresh_token, reg_id, token_created, total_balance, type_work, user_name, user_type FROM users Query: ReadAllQuery(referenceClass=Users sql="SELECT id, access_expires, access_token, address, bank_account_type, created, device_id, device_type, email, facebook_id, grazie_code, latitude, longitude, password, phone_number, profile_pic, refresh_expires, refresh_token, reg_id, token_created, total_balance, type_work, user_name, user_type FROM users") root cause Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: No database selected Error Code: 1046 Call: SELECT id, access_expires, access_token, address, ba…
downvote count: 0
favorite count: 0
accepted answer: http://stackoverflow.com/a/28019191
tagged with: rest
tagged with: web-services
type: AnsweredQuestion
score: 3
upvote count: 3
tagged with: java
tagged with: mysql
type: Question
has answer: http://stackoverflow.com/a/28019191

http://stackoverflow.com/q/27396574
answer count: 2
has body: I am doing a program in which I have to wait a process to finish to continue their execution. I made the next: synchronized (obj) { try{ Process p = Runtime.getRuntime().exec(command); p.waitFor(); obj.notifyAll(); System.out.println("The program command has finished"); ... } catch(InterruptedException e){ e.printStackTrace(); } } where: command is an string which contains the process command to execute obj is is an object of the class object I realized that sometimes the sentence "The program command has finished" is not written. It sometimes is solved changing the call to notifyAll to notify and viceversa. My question is: which is the best way to do this without problems like this?
tagged with: wait
score: 0
has answer: http://stackoverflow.com/a/27396827
type: UnansweredQuestion
tagged with: process
has comment: http://stackoverflow.com/comment/43239807
tagged with: java
has answer: http://stackoverflow.com/a/27403793
tagged with: notify
has title: How to know when process finishes always?
type: Question

http://stackoverflow.com/comment/43226532
score: 0
type: Comment
type: QuestionComment
has text: `PropertyChangeEvent`?
comment on: http://stackoverflow.com/q/27389225

http://stackoverflow.com/a/27341539
type: Answer
score: 0
answers question: http://stackoverflow.com/q/27341530
has body: Override the toString method in your Card class. Then use the same code to print out the Card objects. That should do it. Object.toString

http://stackoverflow.com/q/27381747
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43233448
has comment: http://stackoverflow.com/comment/43274368
has comment: http://stackoverflow.com/comment/43258380
tagged with: java
type: Question
has comment: http://stackoverflow.com/comment/43258613
tagged with: network-programming
has answer: http://stackoverflow.com/a/27382000
tagged with: udpclient
score: 0
tagged with: udp
answer count: 1
has title: JAVA UDP Receive not working in different Network
has body: I made a little tool to receive/send certain UDP packets. It works without problems in my home network, whether the packets come from this very PC, my Android phone or another PC in the Network. But if I try to use it in the network it's supposed to be used, the receiving part stop working. The Firewall is not the problem since I see the received UDP packets in Wireshark. Here is the part of the code that's the problem (if it is caused by the code): static byte[] buffer = new byte[16]; ..... //more code + sending part of the program while (true){ DatagramPacket receivePacket = new DatagramPacket(buffer, buffer.length); //"buffer" serverSocket.receive(receivePacket); System.out.println("Packet received!"); // Convert the contents to a string, and display them String msg = new String(buffer, 0, receivePacket.getLength()); System.out.println(receivePacket.getAddress().getHostName() + ": " + msg); // Reset the length of the packet before reusing it. receivePacket.setLength(buffer.length); //irrelevant stuff.... .... } If I run the program in my home network and send a packet to my PC from anywhere I get this output: "192.168.0.XXX: ContentsOfThePacket" and I can work with the msg string. But in the other network nothing happens when serverSocket.receive(receivePacket); is reached, even though the excat same packet as on the home network is being received by the pc (confirmed via wireshark), so it doen't seems to be caused by the Firewall that is set up there. Also the whole "sending packets to a certain pc in the network" part is working flawlessly... Edit: I also ran the program on my Notebook now and it worked without problems, not matter who sends the packet (other pc, phone) and also no matter which interface I use to connect to the network (usb-ethernet adapter or wlan) (in the home network again), but with the notebook it also didn't work for the other network

http://stackoverflow.com/comment/43169573
type: Comment
type: QuestionComment
score: 1
has text: @ZouZou Although not necessarily custom: a convention would probably arise that a class has a `Comparator<MyClass> NATURAL_ORDER` or similar. Not very convenient, though.
comment on: http://stackoverflow.com/q/27358513

http://stackoverflow.com/comment/43095475
type: Comment
has text: Thanks for the suggestion, i used pdfbox before. The main problem is not generating the pdf, but to parse the email and render it propertly.
score: 0
comment on: http://stackoverflow.com/a/27318023
type: AnswerComment

http://stackoverflow.com/comment/43337834
has text: are those files in your client package, I mean in the source patch defined in your module.gwt.xml? superdev mode only recompiles changes in gwt src folders inherited in your module
type: Comment
comment on: http://stackoverflow.com/a/27443399
score: 1
type: AnswerComment

http://stackoverflow.com/a/27453381
answers question: http://stackoverflow.com/q/27453113
type: Answer
downvote count: 0
has body: Just call getWidth() and getHeight() on the current Scene. If you don't have a reference to the current scene, you can get one with stage.getScene().
score: 1
upvote count: 1

http://stackoverflow.com/a/27473371
has comment: http://stackoverflow.com/comment/43387497
type: Answer
upvote count: 1
score: 1
has body: Turns out i had a wrong assignment in my Listener class. I had p = port instead of port = p. Solved. Through my own stupidity.
downvote count: 0
answers question: http://stackoverflow.com/q/27473144
has comment: http://stackoverflow.com/comment/43383042
has comment: http://stackoverflow.com/comment/43386059

http://stackoverflow.com/comment/95822329
comment on: http://stackoverflow.com/a/27489048
has text: Weird. I did this and now I get a crazy error in the console that just constantly flickers. I actually can't even copy it because it is flickering.
score: 0
type: AnswerComment
type: Comment

http://stackoverflow.com/a/27438685
has comment: http://stackoverflow.com/comment/43317293
type: Answer
has body: try giving the absolute path in the File constructor and in the absolute path replace \ by \\ in order to get rid of the escape sequence
has comment: http://stackoverflow.com/comment/43317447
has comment: http://stackoverflow.com/comment/43317318
has comment: http://stackoverflow.com/comment/43317278
has comment: http://stackoverflow.com/comment/43317301
has comment: http://stackoverflow.com/comment/43317295
has comment: http://stackoverflow.com/comment/43317488
answers question: http://stackoverflow.com/q/27438572
score: 0

http://stackoverflow.com/comment/43167888
type: Comment
type: QuestionComment
has text: @DonRoby I have in knowledge the snake and the pieces it consists of. Each piece holds info of its position in the board. I'm not going to hold information of pieces that don't exist.
comment on: http://stackoverflow.com/q/27357702
score: 0

http://stackoverflow.com/comment/43100149
type: AnswerComment
has text: check your output, try a clean!
type: Comment
comment on: http://stackoverflow.com/a/27320430
score: 0

http://stackoverflow.com/a/27370233
has body: Add a 'print' method to your Application class. This class will print the specifics of the particular instance of the Application. Then add a method called 'print' to your Applications class. This method should have a loop similar to the one you have above, but the innards should be something like applications[i].print();. Now you can say something like this from a main routine: Applications apps = new Applications(); apps.print(); The point here is to let the Application class handle the specifics of an Application. The Applications class should be handing details of managing groups of Application. edit - finally, don't let the array of Applications leave the Applications class. If you do, you'll be unable to control the use of them.
score: 0
answers question: http://stackoverflow.com/q/27370159
type: Answer

http://stackoverflow.com/q/27366384
has title: Send image and additional informtion with AJAX to Servlet
upvote count: 3
type: Question
tagged with: java
tagged with: servlets
has body: Bonjour, I need to send an Image from a &lt;input type="file"&gt; element to a servlet. currently using ajax var files; $("input[type='file']").on("change",function(e) { files = e.target.files; $("#Submit-Button").prop({"disabled":false}); }); $("#Submit-Button").on("click", function(){ var data = new FormData(); $.each(files, function(key, value){ data.append(key, value); }); $.ajax({ url: "UploadServlet", type : "POST", data: data, cache: false, dataType: JSON, processData : false, contentType: false, success: function(data, textStatus, jqXHR){ //SUCCESS }, error: function(jqXHR, textStatus, errorThrown){ //ERROR } }); }) }); This is working and my servlet is receiving the file. However i want to send some additional information to the servlet. I tried (in the js ajax method) data : {data: data, userID : userID, username: username}, and (in the java servlet) String Filename = request.getParameter("uid") + request.getParameter("username")+".png"; Collection&lt;Part&gt; Parts = request.getParts(); which is obviously not working. And now I can't think of anything that would solve my problem.
answer count: 1
downvote count: 0
tagged with: javascript
tagged with: jquery
favorite count: 0
tagged with: ajax
type: UnansweredQuestion
score: 3
has answer: http://stackoverflow.com/a/27367243

http://stackoverflow.com/a/27328771
score: 0
accepted answer of: http://stackoverflow.com/q/27328527
answers question: http://stackoverflow.com/q/27328527
type: AcceptedAnswer
has body: The ternary operator here is used to do a null-safe equals-check. Sometimes, when you don't control the content of the List it's necessary to do such checks because you can't use the e.equals(obj) when eis null. Better would be if the List would not return nullvalues. To figure out we it does we can refactor it. In the first step we replace the expression of the if statement by a method call. Because we don't know what it does we call the method foo, we'll rename it later. It will return a boolean and takes two arguments of type E one for the e and one for the it.next(). After the refactoring it looks something like: public int indexOf(E e) { for (ListIterator&lt;E&gt; it = listIterator(); it.hasNext(); ){ if (foo(e, it.next()) return it.previousIndex();} // Element not found return -1; } public boolean foo(E e, E next) { // in the first step we take the expression as it is return e == null ? next == null : e.equals(next); } Then we split the ?: operator into if else statements public boolean foo(E e, E next) { if (e == null) return next == null; else return e.equals(next); } Now we see what it does. If the passed Element e is null it checks if next also is null and in this case it returns true, false otherwise. If eitself is not null it compares e with next using the equals method of E. So it's a null-safe or null-aware equals comparison. We now after we know what it does we rename foo into something useful like isEqual et voilà public int indexOf(E e) { for (ListIterator&lt;E&gt; it = listIterator(); it.hasNext(); ){ if (isEqual(e, it.next())) return it.previousIndex();} // Element not found return -1; } // null safe equals check public boolean isEqual(E e, E next) { if (e == null) // when e is null check if next / it.next() is also null return next == null; else // else compare left and right return e.equals(next); }
type: Answer

http://stackoverflow.com/a/27349818
type: Answer
has body: println prints a new line after the input.
answers question: http://stackoverflow.com/q/27349644
score: 0

import
type: Tag
tag name: import
tags question: http://stackoverflow.com/q/27347144
tags question: http://stackoverflow.com/q/27409922
tags question: http://stackoverflow.com/q/27335138
tags question: http://stackoverflow.com/q/27380608
tags question: http://stackoverflow.com/q/27334767
tags question: http://stackoverflow.com/q/27366596

http://stackoverflow.com/comment/43132368
type: Comment
comment on: http://stackoverflow.com/a/27337777
has text: Given that you wrote the code for JDK8, why aren't you using `LocalDate`, `DateTimeFormatter` and `Comparator.thenComparing` and all their friends?
score: 0
type: AnswerComment

http://stackoverflow.com/comment/43252215
score: 0
type: AnswerComment
type: Comment
has text: indeed, [0.0,0.0] is an array, try JSONArray innerObj = (JSONArray) it.next();
comment on: http://stackoverflow.com/a/27402084

http://stackoverflow.com/q/27388678
downvote count: 0
has body: what is the difference between @Configuration class ConfigA extends ConfigB { //Some bean definitions here } and @Configuration @Import({ConfigB.class}) class ConfigA { //Some bean definitions here } And also if we are importing multiple configuration files, how does the ordering happen among the various config. And what happens if the imported files have dependencies between them
answer count: 1
favorite count: 0
has title: Difference between Spring configuration inheritance and @Import
type: UnansweredQuestion
tagged with: spring
has answer: http://stackoverflow.com/a/27394053
tagged with: java
tagged with: spring-java-config
type: Question
score: 20
upvote count: 20

http://stackoverflow.com/comment/43280257
type: Comment
comment on: http://stackoverflow.com/a/27418590
has text: Surely there's a more efficient solution, though?
type: AnswerComment
score: 0

http://stackoverflow.com/comment/43222571
score: 0
type: Comment
comment on: http://stackoverflow.com/a/27387193
type: AnswerComment
has text: Didn't make any difference

http://stackoverflow.com/q/27471822
answer count: 0
tagged with: java
tagged with: loops
downvote count: 1
type: Question
tagged with: polygon
has title: Drawing a hexagon board in java
tagged with: jpanel
tagged with: for-loop
score: 1
has comment: http://stackoverflow.com/comment/44075381
favorite count: 0
upvote count: 2
type: UnansweredQuestion
has body: I am trying to draw board in java that is composed of hexagons. The hexagons are supposed to be touching each other and when a new row is created they are supposed to be shifted so that the center of the hexagon in the first row lines up with the left edge of the hexagon in the second row. Currently I have completed a hexagon which we have a class called Hextile to represent. I am having trouble getting the board to draw on the jpanel however. I am using two for loops to add the hextiles to an array of arrays. I am then using a paint component to paint these JButtons on (the hextiles are jbuttons). After using the for loops, I am using setBounds in order to place the hextiles in specific locations and so that they will be touching and not have any spacing in between. However the hextiles are not being drawn correctly. Only half of the hexagon is being drawn even when I change the height and width in setBounds. I am wondering if there is a way to do this without using setBounds because it seems to be cutting off the painting of the hexagon. Any help would be greatly appreciated as I am stuck and cannot figure out anything that will fix this issue.

http://stackoverflow.com/q/27330884
has body: I have a peice of code that scans for all files in a directory and it should delete those files. But for some reason it's not deleting them. What I have is this: String path = Environment.getExternalStorageDirectory().getAbsolutePath()+"/Images/"; File f = new File(path); File file[] = f.listFiles(); for (File aFile : file) { boolean isDeleted = aFile.delete(); if(isDeleted) { log.d("file", "is deleted"); } } When I debug this code then it says for every file that isDeleted is true. But when I check the "Gallery/Images" folder on my phone I see that all images are still there... I also have the following two permission in my manifest: &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /&gt; &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt; Anyone any idea why the files aren't deleted, eventhough it says isDeleted is true?
tagged with: android
type: AnsweredQuestion
score: 2
tagged with: android-external-storage
has title: Android 4.4.2 not deleting files
downvote count: 0
tagged with: java
has answer: http://stackoverflow.com/a/27331074
accepted answer: http://stackoverflow.com/a/27331074
type: Question
upvote count: 2
linked to: http://stackoverflow.com/q/1248292
has comment: http://stackoverflow.com/comment/43120053
answer count: 1
has comment: http://stackoverflow.com/comment/43120599
has comment: http://stackoverflow.com/comment/43119719
favorite count: 0

cryptography
tag name: cryptography
tags question: http://stackoverflow.com/q/27400357
type: Tag
tags question: http://stackoverflow.com/q/27341489
tags question: http://stackoverflow.com/q/27351197
tags question: http://stackoverflow.com/q/27373124
tags question: http://stackoverflow.com/q/27322235
tags question: http://stackoverflow.com/q/27364143
tags question: http://stackoverflow.com/q/27451775

http://stackoverflow.com/comment/43270959
type: QuestionComment
score: 0
has text: we are implemnting in Spring MVC
comment on: http://stackoverflow.com/q/27395493
type: Comment

http://stackoverflow.com/a/27470347
score: 0
type: Answer
has body: Here is your code revised a little bit: import java.util.Random; import java.util.Scanner; public class pGenerator { public static void main(String[] args) { final String characters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; //gives possible character selections final int N = characters.length(); Random r = new Random(); //creates a new random function Scanner input = new Scanner(System.in); //scanner enables user to input something System.out.println("Enter number of characters you would like your password to be:"); //asks user the amount of characters they would like their password to be int passwordcharacters = (int) input.nextDouble(); // while (passwordcharacters &gt;0) { //while the number of characters is more that 0, continue with following code System.out.print(characters.charAt(r.nextInt(N))); //prints out a random character from the String characters --passwordcharacters; //minuses 1 from number inputed and continues with code if it is more that 0 } if (input.nextDouble() &lt; 0.0) { //tests for if number is less than 0.0 System.out.println("The number you have entered is less than 0"); } else if (input.nextDouble() == 0.0); { //tests for if number is 0.0 System.out.println("The number you have entered is 0"); } else if(input.hasNextInt()) { System.out.println("No integers please!"); } } Else/If Statements are handy in situations where just if statements and regular else statements wont work. They work by adding more conditions to "else". Integers and Doubles look different. 0 is the integer version of "zero" and 0.0 is the double precious version of "zero. (Very simplified explanation) I hope that helps. Happy coding!
answers question: http://stackoverflow.com/q/27470229

http://stackoverflow.com/comment/43268863
type: Comment
comment on: http://stackoverflow.com/q/27412096
score: 0
has text: Maybe try set the look and feel to the system look and feel.
type: QuestionComment

http://stackoverflow.com/comment/43134030
comment on: http://stackoverflow.com/a/27338699
score: 0
type: Comment
has text: seems like the likely cause
type: AnswerComment

http://stackoverflow.com/q/27374200
upvote count: 1
tagged with: collections
linked to: http://stackoverflow.com/q/6493605
type: AnsweredQuestion
tagged with: guava
has body: I was using Multiset to have easy access to the freq of elements, but I realize there is Collections#frequency(Collection&lt;?&gt;, Object) that does the same for any collection. What is the point of using Multiset then? Is performance an issue here?
tagged with: java
has answer: http://stackoverflow.com/a/27374489
type: Question
has title: Using Guava multisets or Collections.frequency()?
accepted answer: http://stackoverflow.com/a/27374489
answer count: 1
downvote count: 0
favorite count: 0
tagged with: multiset
score: 1

http://stackoverflow.com/comment/43209228
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27380013
has text: Ok. I have not read everything. The problem is that you first get `x = Math.min(x,x2)` and then `w = Math.abs(x-x2)`. Swap them, i.e. first `abs` then `min`. Now when x2 < x you have w = 0.
type: Comment

http://stackoverflow.com/q/27407855
answer count: 19
has comment: http://stackoverflow.com/comment/54371658
has answer: http://stackoverflow.com/a/33333655
has answer: http://stackoverflow.com/a/31542154
has answer: http://stackoverflow.com/a/38326413
upvote count: 69
has comment: http://stackoverflow.com/comment/43262232
downvote count: 0
has answer: http://stackoverflow.com/a/32538382
has answer: http://stackoverflow.com/a/44582381
has comment: http://stackoverflow.com/comment/43260271
favorite count: 0
has answer: http://stackoverflow.com/a/30847316
has comment: http://stackoverflow.com/comment/43262060
has answer: http://stackoverflow.com/a/34010614
has comment: http://stackoverflow.com/comment/64934252
tagged with: android
has answer: http://stackoverflow.com/a/31731984
possible better answer: http://stackoverflow.com/a/31447763
has answer: http://stackoverflow.com/a/27966767
tagged with: android-studio
has answer: http://stackoverflow.com/a/31028554
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/31447763
has answer: http://stackoverflow.com/a/40605971
has answer: http://stackoverflow.com/a/48294305
tagged with: java
score: 69
has answer: http://stackoverflow.com/a/30864068
has answer: http://stackoverflow.com/a/31739012
type: Question
has answer: http://stackoverflow.com/a/32372637
has body: When I try to run an Android emulator, I get the following error screen. The same occurs when I export the apk. When I go to the directory where the apk will be saved, the apk file is not there. Thank you, christophe
linked to: http://stackoverflow.com/q/27397250
has answer: http://stackoverflow.com/a/40625888
has answer: http://stackoverflow.com/a/32449654
has title: Android Studio: failed to complete gradle execution, cause is empty
accepted answer: http://stackoverflow.com/a/27966767
has comment: http://stackoverflow.com/comment/55661174
has comment: http://stackoverflow.com/comment/43262027
has answer: http://stackoverflow.com/a/34780780

http://stackoverflow.com/q/27349493
has answer: http://stackoverflow.com/a/27349506
favorite count: 0
linked to: http://stackoverflow.com/q/413898
type: UnansweredQuestion
upvote count: 1
has body: There's an error in my code on the last line of functioning code. package Class; import java.util.Scanner; public class Bicycle { public int units; public int courseNum; public String courseName; public Bicycle(int startUnits, int startNum, String startName) { units = startUnits; courseNum = startNum; courseName = startName; } public int setUnits(int newValue) { units = newValue; return units; } public int setNum(int newValue) { courseNum = newValue; return courseNum; } public String setName(String newValue) { courseName = newValue; return courseName; } public class subClass extends Bicycle { public int randVariable; public subClass(int startUnits, int startNum, String startName) { super(startUnits, startNum, startName); } public void randVariable(int newValue) { randVariable = newValue; } } public static void main(String args[]) { int BaseUnits; int BaseCourseNum; String BaseCourseName; int FinalUnits; int FinalcourseNum; String FinalcourseName; Scanner entries = new Scanner(System.in); BaseUnits = entries.nextInt(); BaseCourseNum = entries.nextInt(); BaseCourseName = entries.nextLine(); FinalUnits = setUnits(BaseUnits); } } The error states that I cannot reference a non-static method from a static context. So I then proceeded to look up questions on Stack about static and non-static methods, but the answers were all pretty confusing - possibly due to the fact that I am a beginner in programming.
has comment: http://stackoverflow.com/comment/43153694
tagged with: java
has comment: http://stackoverflow.com/comment/43153848
has comment: http://stackoverflow.com/comment/43153754
tagged with: methods
has comment: http://stackoverflow.com/comment/43153586
has comment: http://stackoverflow.com/comment/43153523
has comment: http://stackoverflow.com/comment/43153587
type: Question
has comment: http://stackoverflow.com/comment/43153535
answer count: 2
has answer: http://stackoverflow.com/a/27349509
score: -3
downvote count: 4
has comment: http://stackoverflow.com/comment/43153559
has title: Java - Error in my code?

http://stackoverflow.com/comment/43215786
has text: In what way do they seem random? You aren't really telling us what the problem is.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27383550

http://stackoverflow.com/comment/43355514
comment on: http://stackoverflow.com/q/27344009
score: 0
type: Comment
type: QuestionComment
has text: But doesn't change the results ;-(

http://stackoverflow.com/a/27345663
downvote count: 0
has body: On my system I get the following values for System.getProperty("user.home") and your file f: C:\Users\Luke C:\Users\LukeAppData\Local\DataDude\pass You missed a backslash before AppData, or assumed that System.getProperty("user.home") would end with one, so the logged-in username and AppData have been concatenated into one directory name. I don't believe this is what you want.
type: Answer
score: 2
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27345197
answers question: http://stackoverflow.com/q/27345197
type: AcceptedAnswer

http://stackoverflow.com/a/27381827
has body: Or you can use like this, public class JEnhancedOptionPane extends JOptionPane { public static String showInputDialog(final Object message, final Object[] options) throws HeadlessException { final JOptionPane pane = new JOptionPane(message, QUESTION_MESSAGE, OK_CANCEL_OPTION, null, options, null); pane.setWantsInput(true); pane.setComponentOrientation((getRootFrame()).getComponentOrientation()); pane.setMessageType(QUESTION_MESSAGE); pane.selectInitialValue(); final String title = UIManager.getString("OptionPane.inputDialogTitle", null); final JDialog dialog = pane.createDialog(null, title); dialog.setVisible(true); dialog.dispose(); final Object value = pane.getInputValue(); return (value == UNINITIALIZED_VALUE) ? null : (String) value; } } and call it like JEnhancedOptionPane.showInputDialog("Number:", new Object[]{"Yes", "No"}); //here you can change to any text Actually this is taken from here http://stackoverflow.com/questions/14407804/how-to-change-the-default-text-of-buttons-in-joptionpane-showinputdialog
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27381621

http://stackoverflow.com/comment/43370167
type: Comment
has text: Spencer Wieczorek should I be rephrasing in some kind of inequality like jamesTotalQuarter > 60 || jamesTotalQuarter < 60 ?
score: 0
type: QuestionComment
comment on: http://stackoverflow.com/q/27466970

http://stackoverflow.com/a/27334025
upvote count: 2
accepted answer of: http://stackoverflow.com/q/27333998
type: AcceptedAnswer
type: Answer
score: 2
has body: Method 1: 1) Create a loop that processes each line. 2) In the loop, use the String.contains() function to see if the line contains "_JJ" or "_NN" 3) If the condition fails, skip that line. 4) If the condition passes, output that line. Method 2: Fiddle at regex101.com until you get a working regex: foo = bar.replaceAll( "(?m)^.+(?&lt;!JJ|NN)(\n|$)", "" );
downvote count: 0
answers question: http://stackoverflow.com/q/27333998

http://stackoverflow.com/a/27417212
score: 1
upvote count: 1
has body: its address of internal lock construct(monitor object) for hotspot JVM. code for your reference oop o = _locked_monitors-&gt;at(i); instanceKlass* ik = instanceKlass::cast(o-&gt;klass()); st-&gt;print_cr("\t- locked &lt;" INTPTR_FORMAT "&gt; (a %s)", (address)o, ik-&gt;external_name());
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27416364

http://stackoverflow.com/a/27380322
has comment: http://stackoverflow.com/comment/43210624
has comment: http://stackoverflow.com/comment/43480200
score: 0
type: Answer
answers question: http://stackoverflow.com/q/27379431
has body: You can try using RestEasy. In RestEasy you can bind a handler before and after a REST call has been executed. You can than store a REST call on the before handler and acknowledge the execution once finished. If the REST was not executed ... it can be retried, or it's action repeated. The code would look something like this (REQUEST): @Provider public class RestInterceptor implements ContainerRequestFilter { @Override public void filter(ContainerRequestContext context) { (RESPONSE) @Provider public class EventFilter implements ContainerResponseFilter { @Override public void filter(ContainerRequestContext containerRequestContext, ContainerResponseContext containerResponseContext) throws IOException { The question arises WHY? REST calls should be simple atomic tasks executed in less than 30s. Plus they should be (if possible) idempotent. If you would like to trigger and monitor long running tasks with REST calls then this is the way to go. But the job itself should be separated and monitored on some other level (not the HTTP stack).

http://stackoverflow.com/a/27387018
score: 1
has comment: http://stackoverflow.com/comment/43222101
downvote count: 0
has body: You need an application called Enterprise Architect sold by Sparx Systems to open .eap files.
answers question: http://stackoverflow.com/q/27385818
has comment: http://stackoverflow.com/comment/43222172
has comment: http://stackoverflow.com/comment/43240278
type: Answer
has comment: http://stackoverflow.com/comment/43222619
upvote count: 1
has comment: http://stackoverflow.com/comment/43222325
has comment: http://stackoverflow.com/comment/43222448

http://stackoverflow.com/q/27380399
favorite count: 0
has comment: http://stackoverflow.com/comment/43210965
has answer: http://stackoverflow.com/a/39519804
has comment: http://stackoverflow.com/comment/43209888
has body: I started using Hibernate today and tested a simple example but I'm getting the error: hibernate.cfg.xml not found. I putted the hibernate.cfg.xml file in the src folder and here is its content: <?xml version='1.0' encoding='utf-8'?> <hibernate-configuration> com.mysql.jdbc.Driver jdbc:mysql://localhost:3306/test test test 1 org.hibernate.dialect.MySQLDialect thread org.hibernate.cache.internal.NoCacheProvider true update <mapping resource="com/mycompany/model/Product.hbm.xml"/> </hibernate-configuration> And I putted the HibernateUtil.java file under util folder (src/util) and here is its content package util; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; public class HibernateUtil { private static final SessionFactory sessionFactory = buildSessionFactory(); private static SessionFactory buildSessionFactory() { try { // Create the SessionFactory from hibernate.cfg.xml return new Configuration().configure("hibernate.cgf.xml").buildSessionFactory(); } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { return sessionFactory; } public static void shutdown() { // Close caches and connection pools getSessionFactory().close(); } } I also have the Jars added to the build path. My class Test.java : import ... public class Test { public static void main(String[] args) { // TODO Auto-generated method stub ProductDao pd = new ProductDao(); try { Product p = new Product("PC", 1000L); pd.add(p); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } The add method : public void add(Product p) { Session session = HibernateUtil.getSessionFactory().openSession(); Transaction tx = session.beginTransaction(); session.beginTransaction(); session.save(p); tx.commit(); } Thanks in advance
type: UnansweredQuestion
has answer: http://stackoverflow.com/a/27380435
has title: hibernate.cfg.xml not found (eclipse)
has comment: http://stackoverflow.com/comment/43210222
downvote count: 0
score: 1
tagged with: java
tagged with: hibernate
has comment: http://stackoverflow.com/comment/43210972
type: Question
tagged with: eclipse
answer count: 2
upvote count: 1

http://stackoverflow.com/a/27435511
has body: Optional is not intended to replace exceptions, especially if there are different kinds of exceptions and the caller is expected to deal with them. If your method never returns null unless there is an exception, then introducing Optional to a type that was @NotNull before seems like quite a step backwards regarding type/null-safety. Just keep the exceptions.
type: AcceptedAnswer
accepted answer of: http://stackoverflow.com/q/27435476
score: 4
answers question: http://stackoverflow.com/q/27435476
downvote count: 1
upvote count: 5
type: Answer

http://stackoverflow.com/comment/44734738
score: 3
has text: Actually there's a way without running the AppleScript: edit `.bash_profile` (if this file doesn't exist, please create a new one), put `export STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk1.8.0_31.jdk`, quit terminal (or any text editors you're using to edit this file), run the Android Studio and viola. Tested with OSX 10.10 and Android 1.0.1
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27370525

http://stackoverflow.com/a/27351910
has body: For the Paddle-Ball collisions, I think calling this method on a timer might suffice: public void checkPaddleCollisions(){ Rectangle a = new Rectangle(pTop.getX(), pTop.getY(), pTop.getWidth(), pTop.getHeight()); Rectangle b = ... //Do this for all the paddles. Rectangle ball = new Rectangle(ball.getX(), ball.getY(), ball.getWidth(), ball.getHeight()); if(a.intersects(ball) || b.intersects(ball) || c.intersects(ball) || d.intersects(ball)){ //Increment score and bounce ball. } } As for collisions with the edge, I think you could do something similar, just create 4 rectangles representing the edges of the screen.
answers question: http://stackoverflow.com/q/27348650
score: 0
type: Answer
has comment: http://stackoverflow.com/comment/43220508
has comment: http://stackoverflow.com/comment/43225780
accepted answer of: http://stackoverflow.com/q/27348650
has comment: http://stackoverflow.com/comment/43195020
type: AcceptedAnswer

http://stackoverflow.com/q/27327762
tagged with: jtextfield
downvote count: 1
type: Question
tagged with: database
has title: Setting database records into jtextfield
has answer: http://stackoverflow.com/a/27327806
upvote count: 0
answer count: 1
favorite count: 0
score: -1
type: UnansweredQuestion
has body: The problem of my code is that it can't set the data from my database onto my jtextfield. Every time I run my code, it says StackOverflowError. How could I fix this error? Here's my code public class DataConnect extends DatabaseGUI { private Connection dataCon; private Statement dataStmt; private ResultSet dataRS; private String name, address; int age; public DataConnect(){ try{ Class.forName("com.mysql.jdbc.Driver"); dataCon = DriverManager.getConnection("jdbc:mysql://localhost:3306/studentrec","root",""); dataStmt = dataCon.createStatement(); dataRS = dataStmt.executeQuery("Select * from studentrecords"); }catch(Exception exc){ System.out.println(exc.getMessage()); } } public void setData(){ try{ dataRS.next(); name = dataRS.getString("Name"); age = dataRS.getInt("Age"); address = dataRS.getString("Address"); DatabaseGUI dbGui = new DatabaseGUI (); dbGui.jtfData[0].setText(name); dbGui.jtfData[1].setText(Integer.toString(age)); dbGui.jtfData[2].setText(address); //System.out.println(name+" "+age+" "+address); }catch(Exception exc){ } } }
tagged with: java

http://stackoverflow.com/comment/43393999
score: 0
type: AnswerComment
comment on: http://stackoverflow.com/a/27433800
type: Comment
has text: So are you actually trying to make the entire UDH 7 Bit, or the payload? If the former, then the way we used to do it at orange was just to start the actual SMS where the 4 xxxx bits are above, effectively shortening the message by 4 bits, be aware though, this didn't always work though. Compress the message itself by all means but if possible you should keep the udh at 8 bits.

http://stackoverflow.com/comment/43307187
has text: change it to (int y = 0; y < GRID_HEIGHT-2; y++) since you're adding to y like you did in the first loop
score: 0
type: AnswerComment
type: Comment
comment on: http://stackoverflow.com/a/27432500

http://stackoverflow.com/q/27451982
has comment: http://stackoverflow.com/comment/43343045
type: UnansweredQuestion
has comment: http://stackoverflow.com/comment/43343107
type: Question
has comment: http://stackoverflow.com/comment/43343173
tagged with: ear
has body: I'm dealing with an issue with static singleton that we create for log4j. As per the document here, jboss 4.x and prior used a unified class loader. Meaning, a class deployed in one .ear file can access access class of another ear deployed. So, if one .ear file has already loaded that class, then 2nd .ear does not load it again as it is already loaded. Does anyone know if this is same for Weblogic 8.1 server? If that is true, I need to change the design of our application. Update: Issue i'm dealing with here
has title: Classloading in Weblogic 8.1
has comment: http://stackoverflow.com/comment/43342981
has comment: http://stackoverflow.com/comment/43434680
tagged with: weblogic8.x
score: 0
tagged with: java
linked to: http://stackoverflow.com/q/24066299
tagged with: weblogic
answer count: 0

http://stackoverflow.com/comment/43305452
score: 0
comment on: http://stackoverflow.com/q/27430675
type: Comment
has text: Ok I see what you mean now. SocketException is a checked exception but the AmazonS3Client is not passing it up, right?
type: QuestionComment

http://stackoverflow.com/q/27379216
type: AnsweredQuestion
has answer: http://stackoverflow.com/a/27379301
has body: When I create my ApplicationContext the myBean Constructors are used successfully. But after creation the beans are null using @Autowired tag. I though @Autowired would replace getBean() somehow? Am I getting this wrong? Why do I need to call GetBean, when I already created my Beans (during ApplicationContext startup) and also Autowired them? Here is what I have done so far: Main: @EnableAutoConfiguration @Configuration @ComponentScan("com.somePackage") public class Main { ApplicationContext ctx= new AnnotationConfigApplicationContext(AppConfig.class); SomeBean myBean = ctx.getBean(SomeBean.class); myBean.doSomething();//succeeds AnyOtherClass aoc = new AnyOtherClass();//Nullpointer (see AnyOtherClass.class for details) } AnyOtherClass: public class AnyOtherClass { @Autowired protected SomeBean someBean; public AnyOtherClass(){ someBean.doSomething();//Nullpointer } AppConfig: @Configuration public class AppConfig { @Bean @Autowired public SomeBean BeanSomeBean() { return new SomeBean(); } } MyBean: public class SomeBean { public SomeBean (){} public void doSomething() { System.out.println("do Something.."); } } Note: Interface ApplicationContextAware works fine but without @Autowired. And I would really like to go with @Autowired since it sounds more comfortable and less errorprone to me.
score: 1
tagged with: java
upvote count: 1
has comment: http://stackoverflow.com/comment/43207919
type: Question
has answer: http://stackoverflow.com/a/27379263
accepted answer: http://stackoverflow.com/a/27379263
duplicate of: http://stackoverflow.com/q/19896870
possible better answer: http://stackoverflow.com/a/27379301
answer count: 2
has title: @Autowired Spring NullPointerException Null Beans after ApplicationContext Creation
downvote count: 0
linked to: http://stackoverflow.com/q/19896870
favorite count: 0
tagged with: spring

http://stackoverflow.com/comment/43191073
score: 0
type: AnswerComment
has text: so what exactly does the static modifier here do? i'm just looking for a simple clarification because i am utterly confused.
type: Comment
comment on: http://stackoverflow.com/a/27369641

http://stackoverflow.com/q/27404709
tagged with: java
type: Question
has title: Apache FTP Server - Create user programmatically
score: 0
tagged with: apache
answer count: 1
has answer: http://stackoverflow.com/a/29349471
has body: I am using Apache FTP Server embedded in my code. I used the example from the Apache Website and did indeed embed the server in 5 mins (as shown) Apache Example here This example uses the users.properties file which is fine. However, I would like to create my user in the code. I don't want users to be able to change attributes. I've found various examples on the web but all seem incomplete and don't quite seem to have everything I need. In a nutshell I would like to create a user in code based on the following properties configurations # Password is "admin" ftpserver.user.admin.userpassword=21232F297A57A5A743894A0E4A801FC3 ftpserver.user.admin.homedirectory=/home/ftproot ftpserver.user.admin.enableflag=true ftpserver.user.admin.writepermission=true ftpserver.user.admin.maxloginnumber=0 ftpserver.user.admin.maxloginperip=0 ftpserver.user.admin.idletime=0 ftpserver.user.admin.uploadrate=0 ftpserver.user.admin.downloadrate=0 I've tried a few things including the following to no avail: UserFactory uf = new UserFactory(); uf.setName( "admin" ); uf.setPassword( "admin" ); uf.setHomeDirectory( "/home/ftproot" ); uf.setMaxIdleTime( 0 ); uf.setEnabled(true); uf.createUser(); I'm missing something and am unable to find any complete/working examples on the web. EDIT This is the error message I get C:\WINDOWS&gt;ftp localhost Connected to localhost. 220 Service ready for new user. User (localhost:(none)): admin 331 User name okay, need password for admin. Password: 530 Authentication failed. Login failed. ftp&gt;
type: UnansweredQuestion
tagged with: ftp

http://stackoverflow.com/comment/43134512
has text: What do I set the size of the array to?
comment on: http://stackoverflow.com/a/27338980
type: AnswerComment
score: 0
type: Comment

http://stackoverflow.com/q/27437629
tagged with: http://stackoverflow.com/tag/pdf
tagged with: http://stackoverflow.com/tag/html
answer count: 1
has body: I am trying to convert html into pdf using itextpdf but it is giving nosuchmethoderror even i used latest version of itextpdf Dependency com.itextpdf.tool xmlworker 5.5.3 Imports import com.itextpdf.text.Document; import com.itextpdf.text.DocumentException; import com.itextpdf.text.pdf.PdfWriter; import com.itextpdf.tool.xml.XMLWorkerHelper; .... Source Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("/home/test.pdf")); document.open(); String file = "/home/test.html"; XMLWorkerHelper.getInstance().parseXHtml(writer, document, new FileInputStream(file)); /* **line 191** */ document.close(); Exception Exception in thread "main" java.lang.NoSuchMethodError: com.itextpdf.text.pdf.PdfPTable.addCell(Lcom/itextpdf/text/pdf/PdfPCell;)Lcom/itextpdf/text/pdf/PdfPCell; at com.itextpdf.tool.xml.html.table.Table.end(Table.java:433) at com.itextpdf.tool.xml.html.AbstractTagProcessor.endElement(AbstractTagProcessor.java:192) at com.itextpdf.tool.xml.pipeline.html.HtmlPipeline.close(HtmlPipeline.java:207) at com.itextpdf.tool.xml.XMLWorker.endElement(XMLWorker.java:142) at com.itextpdf.tool.xml.parser.XMLParser.endElement(XMLParser.java:396) at com.itextpdf.tool.xml.parser.state.ClosingTagState.process(ClosingTagState.java:71) at com.itextpdf.tool.xml.parser.XMLParser.parseWithReader(XMLParser.java:236) at com.itextpdf.tool.xml.parser.XMLParser.parse(XMLParser.java:214) at com.itextpdf.tool.xml.parser.XMLParser.parse(XMLParser.java:175) at com.itextpdf.tool.xml.XMLWorkerHelper.parseXHtml(XMLWorkerHelper.java:220) at com.itextpdf.tool.xml.XMLWorkerHelper.parseXHtml(XMLWorkerHelper.java:182) at com.jvr.util.CommonUtil.pdf(CommonUtil.java:191)
type: UnansweredQuestion
tagged with: nosuchmethoderror
tagged with: itextpdf
score: 0
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27438193
has title: java XMLWorkerHelper - NoSuchMethodError: com.itextpdf.text.pdf.PdfPTable.addCell

http://stackoverflow.com/comment/43232472
has text: Okay. My program read in 10 ints from the keyboard, and store them in an array. It finds the position (or index) of the maximum and minimum values in the array, and swap them (move the biggest element to the position of the smallest, and move the smallest element to the position of the biggest). What I'm trying to figure now is how to create a InputMismatchException if ever I entered a string.
score: 0
type: QuestionComment
type: Comment
comment on: http://stackoverflow.com/q/27392432

http://stackoverflow.com/comment/43104176
has text: You should learn something about "Inversion of control" - in this case this means that when the user changes a value in the gui, the GUI Object (JTextField) initiates the change of the value in the class. This usually is done by using listeners, like the OnChange-Listener. A listener can be told what to, if some event (the changing of a value in this case) occurs.
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27322409

http://stackoverflow.com/comment/43183342
score: 0
type: Comment
type: QuestionComment
comment on: http://stackoverflow.com/q/27365318
has text: @jtahlborn I am not getting any exception but the application hangs. I am calling the executeBatch method from main method.

http://stackoverflow.com/q/27327488
answer count: 2
upvote count: 0
score: -2
has comment: http://stackoverflow.com/comment/43114269
has body: import java.util.Scanner; public class Hi { public static void main(String[] args) { // For you to test //int[][] testArray = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } }; int[][] testArray = { { randomNumber(), randomNumber(), randomNumber() }, { randomNumber(), randomNumber(), randomNumber() }, { randomNumber(), randomNumber(), randomNumber() } }; // // TO DISPLAY ARRAY printArray(testArray); } // end main // TO DISPLAY TABLES private static void printArray(int[][] array) { Scanner sc = new Scanner(System.in); //Ask the user System.out.println("How many rows: "); int rows= sc.nextInt(); System.out.println("How many columns: "); int columns= sc.nextInt(); for (int row = 0; row &lt; array.length; rows++) { for (int col = 0; col &lt; array[rows].length; col++) { System.out.print(array[rows][columns] + " "); } System.out.println(); } } private static int randomNumber() { int random = (int) (Math.random() * 9); return random; } } Currently my program is working only with three rows and three columns. How can I make work so that it works with any rows and columns the user inserts?. And then my methods work with whatever the user insert?
favorite count: 0
has answer: http://stackoverflow.com/a/27327734
has title: How can I fix my program so that it can work with any number of rows and column user asks?
accepted answer: http://stackoverflow.com/a/27327734
has comment: http://stackoverflow.com/comment/43113991
downvote count: 2
type: Question
possible better answer: http://stackoverflow.com/a/27327626
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43114198
tagged with: java
has answer: http://stackoverflow.com/a/27327626

http://stackoverflow.com/q/27381333
accepted answer: http://stackoverflow.com/a/27383445
answer count: 1
downvote count: 0
has comment: http://stackoverflow.com/comment/43215762
favorite count: 0
has comment: http://stackoverflow.com/comment/43211834
has body: I am working with a spanish dictionary that has definitions like the following: l. a. c. Buitre, alimoche. adj. Persona alelada. (Cornago). GOICOECHEA. // 2. f. Persona torpe, despistada e irreflexiva. // 3. Estar mirando a los abantos. fr. fig. Ser despistado, soñador, no apercibirse de la realidad. Autol. RUIZ. // 4. f. esto es una prueba Where the following rules apply: Each definition MAY contain one (and never more than one) of the following categories: l. a. c. f. m. The category is always at the start of a definition The first definition starts from the begining, if there are more definitions, they start with \\ n. where 'n' is a number (could be more than one digit) For the example I gave, the following definitions should be parsed: (Category: l.a.c.) Buitre, alimoche. adj. Persona alelada. (Cornago). GOICOECHEA (Category: f.) Persona torpe, despistada e irreflexiva. (No category) Estar mirando a los abantos. fr. fig. Ser despistado, soñador, no apercibirse de la realidad. Autol. RUIZ. (Category: f.) esto es una prueba I am trying to make a regex to capture every definition (that is 0 or 1 category + meaning). This is what I have (?:(m\.|l\. a\. c\.|f\.) )?(.*?) (?:$|(?:\/\/ \d+. (?:(m\.|l\. a\. c\.|f\.) )?(.*?))+) I am testing it here This is how I wrote it: (?: (m\.|l\. a\. c\.|f\.) &lt;-- First: unnamed group containing the named group for the category and one space )? (.*?) &lt;-- Named group for the meaning (?: &lt;-- Unnamed group for end of line OR another definition $ &lt;--- (end of line) | &lt;--- (OR) (?:\/\/ \d+. &lt;--- (Definition separator &amp; number) (?:(m\.|l\. a\. c\.|f\.) )?(.*?) &lt;-- Another definition )+ &lt;-- There may be more than one definition, so we add '+' ) I have serveral problems: I am not sure why it does not work. It seems like the last capture group (.*?) is not expanding until the next \\. How can I fix it? The group (m\.|l\. a\. c\.|f\.) should be larger (there are more categories) How can I avoid repeating it? There a…
has comment: http://stackoverflow.com/comment/43212382
has comment: http://stackoverflow.com/comment/43212064
tagged with: regex
has comment: http://stackoverflow.com/comment/43214908
tagged with: parsing
has answer: http://stackoverflow.com/a/27383445
has title: How to fix this regex (matching dictionary entries)
score: 1
tagged with: java
upvote count: 1
type: Question
type: AnsweredQuestion

http://stackoverflow.com/q/27466797
type: Question
has title: Erase cookie in websphere- how to log out
has body: I am using another webpage that passes the user authentication( AD login ) to WebSphere by URL. When I am logging out I am redirecting towards the log-in page and is already logged in since my session is never closed. I tried a few things to disable the cookie with WebSphere but nothing worked. Is there an easy way to delete the cookies with a java code when I press the log out button? Any help is very appreciated.
tagged with: websphere
answer count: 1
downvote count: 0
has answer: http://stackoverflow.com/a/27473251
favorite count: 0
tagged with: logout
score: 2
upvote count: 2
tagged with: cookies
type: UnansweredQuestion
tagged with: java

http://stackoverflow.com/comment/43359056
comment on: http://stackoverflow.com/a/27461333
type: Comment
has text: I agree with @Takendarkk _"Your for loop check for min/max in condition which is wrong"_ But why? If the op ask this question it's certainly because it's not obvious for him to see what's wrong. Try to put some efforts to explain why and making it a better answer (with small examples or explanations).
score: 0
type: AnswerComment

algorithm
tags question: http://stackoverflow.com/q/27367207
tags question: http://stackoverflow.com/q/27379864
tags question: http://stackoverflow.com/q/27323903
tags question: http://stackoverflow.com/q/27423991
tag name: algorithm
tags question: http://stackoverflow.com/q/27436842
tags question: http://stackoverflow.com/q/27347915
tags question: http://stackoverflow.com/q/27467047
tags question: http://stackoverflow.com/q/27427892
tags question: http://stackoverflow.com/q/27319776
tags question: http://stackoverflow.com/q/27368264
tags question: http://stackoverflow.com/q/27364922
tags question: http://stackoverflow.com/q/27447357
tags question: http://stackoverflow.com/q/27406050
tags question: http://stackoverflow.com/q/27323303
tags question: http://stackoverflow.com/q/27416346
tags question: http://stackoverflow.com/q/27354375
tags question: http://stackoverflow.com/q/27456075
tags question: http://stackoverflow.com/q/27438667
tags question: http://stackoverflow.com/q/27418320
tags question: http://stackoverflow.com/q/27401462
tags question: http://stackoverflow.com/q/27327404
tags question: http://stackoverflow.com/q/27319734
tags question: http://stackoverflow.com/q/27357702
type: Tag
tags question: http://stackoverflow.com/q/27474055
tags question: http://stackoverflow.com/q/27419024
tags question: http://stackoverflow.com/q/27462543
tags question: http://stackoverflow.com/q/27389263
tags question: http://stackoverflow.com/q/27341953
tags question: http://stackoverflow.com/q/27450536
tags question: http://stackoverflow.com/q/27465934
tags question: http://stackoverflow.com/q/27324457
tags question: http://stackoverflow.com/q/27358979
tags question: http://stackoverflow.com/q/27329026
tags question: http://stackoverflow.com/q/27365196
tags question: http://stackoverflow.com/q/27385418
tags question: http://stackoverflow.com/q/27471746
tags question: http://stackoverflow.com/q/27381638
tags question: http://stackoverflow.com/q/27343607
tags question: http://stackoverflow.com/q/27375197
tags question: http://stackoverflow.com/q/27390879
tags question: http://stackoverflow.com/q/27341502
tags question: http://stackoverflow.com/q/27428319

http://stackoverflow.com/comment/43216089
type: Comment
comment on: http://stackoverflow.com/a/27380324
has text: That just creates an `i` for each method call, and not a single `i` attribute for the object.
score: 0
type: AnswerComment

http://stackoverflow.com/q/27392407
type: UnansweredQuestion
has title: Is it possible to add an OnClick Intent to one of these markers?
tagged with: android
has answer: http://stackoverflow.com/a/27392727
tagged with: java
downvote count: 1
type: Question
score: -1
has body: I want to add an onClick to each one of these markers so I cant open a new activity for each one of them, is that possible an array of markers? For some reason it will not let me post my code, any suggestions?
tagged with: google-maps
upvote count: 0
answer count: 1
tagged with: marker
favorite count: 0

http://stackoverflow.com/a/27330422
has body: You should type your classes, not just your methods. Try this: import java.util.EnumMap; import java.util.HashMap; public abstract class AbstractClazz&lt;K extends Enum&lt;K&gt;&gt; { public abstract boolean isVisible(EnumMap&lt;K, Object&gt; visibleConditions); } And: import java.util.EnumMap; public class Clazz extends AbstractClazz&lt;Numbers&gt; { @Override public boolean isVisible(EnumMap&lt;Numbers, Object&gt; visibleConditions) { return false; } } EDIT: To make it work, put the Numbers enum in its own file: public enum Numbers { ONE, TWO, THREE }
score: 2
accepted answer of: http://stackoverflow.com/q/27330303
has comment: http://stackoverflow.com/comment/43118878
upvote count: 2
answers question: http://stackoverflow.com/q/27330303
type: AcceptedAnswer
downvote count: 0
type: Answer
has comment: http://stackoverflow.com/comment/43118927

http://stackoverflow.com/a/27376201
accepted answer of: http://stackoverflow.com/q/27376129
score: 5
has comment: http://stackoverflow.com/comment/43202237
has body: Problem seems to be on this line: String argName = _getArgNamePattern.matcher( attr ).group( 1 ); You cannot call matcher#group() before calling matcher#find() or matcher#matches() methods.
has comment: http://stackoverflow.com/comment/43202190
type: AcceptedAnswer
has comment: http://stackoverflow.com/comment/43208757
upvote count: 5
type: Answer
has comment: http://stackoverflow.com/comment/43202111
downvote count: 0
answers question: http://stackoverflow.com/q/27376129

http://stackoverflow.com/comment/43272445
type: Comment
type: QuestionComment
has text: Think of an array as a pile of books, when you remove one from any position, the other books have to come down, so this means you need to `rotate` every book from the removed book position up to the end. This will prevent you from having holes or breaks in your array.
comment on: http://stackoverflow.com/q/27414176
score: 1

http://stackoverflow.com/a/27387278
answers question: http://stackoverflow.com/q/27383988
has body: The idea in RMI is to define remote method parameters and return values as the remote interface, not the remote object. So the cast in the delete() method should be to MyRemoteInterface, not to RemoteMyObject. Likewise: public Collection&lt;RemoteMyObject&gt; getItems() throws RemoteException { Change that signature to: public Collection&lt;MyRemoteInterface&gt; getItems() throws RemoteException {
has comment: http://stackoverflow.com/comment/43237273
score: 0
has comment: http://stackoverflow.com/comment/43604547
type: Answer
has comment: http://stackoverflow.com/comment/43267432

design-patterns
tags question: http://stackoverflow.com/q/27463477
tag name: design-patterns
tags question: http://stackoverflow.com/q/27455531
tags question: http://stackoverflow.com/q/27372213
tags question: http://stackoverflow.com/q/27362559
tags question: http://stackoverflow.com/q/27418988
tags question: http://stackoverflow.com/q/27336380
tags question: http://stackoverflow.com/q/27433696
type: Tag
tags question: http://stackoverflow.com/q/27445075
tags question: http://stackoverflow.com/q/27364922
tags question: http://stackoverflow.com/q/27464425
tags question: http://stackoverflow.com/q/27463241
tags question: http://stackoverflow.com/q/27437177
tags question: http://stackoverflow.com/q/27462420
tags question: http://stackoverflow.com/q/27328994
tags question: http://stackoverflow.com/q/27365309
tags question: http://stackoverflow.com/q/27333119
tags question: http://stackoverflow.com/q/27352702
tags question: http://stackoverflow.com/q/27383780

http://stackoverflow.com/comment/43113300
has text: It's a bad idea what you're doing.
type: Comment
type: QuestionComment
score: 0
comment on: http://stackoverflow.com/q/27327078

http://stackoverflow.com/comment/43131850
type: Comment
score: 1
comment on: http://stackoverflow.com/a/27335326
has text: Thanks, that did it. Now it's about the same number of loc as the old streams implementation.
type: AnswerComment

http://stackoverflow.com/q/27467589
tagged with: java
type: Question
has answer: http://stackoverflow.com/a/27468729
has title: spring batch: scope("step") failed
downvote count: 0
answer count: 1
accepted answer: http://stackoverflow.com/a/27468729
favorite count: 0
score: 6
tagged with: spring
upvote count: 6
has body: I could use scope="step" in xml configuration without any issue, but if use it as annotation as below . it throws the following error Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'step1' defined in class path resource [BatchConfiguration.class]: Unsatisfied dependency expressed through constructor argument with index 1 of type [org.springframework.batch.item.ItemReader]: : Error creating bean with name 'reader': Scope 'step' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No context holder available for step scope; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'reader': Scope 'step' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No context holder available for step scope The main point is: Scope 'step' is not active for the current thread; what's the root cause? public class BatchConfiguration { @Bean @Scope("step") public ItemReader<Source> reader(@Value("#{jobParameters['fileName']}") String fileName) { System.out.println("*****************************"); System.out.println("read file of "+fileName); System.out.println("*****************************"); FlatFileItemReader<Source> reader = new FlatFileItemReader<Source>(); reader.setResource(new FileSystemResource(fileName)); reader.setLineMapper(new DefaultLineMapper<Source>() {{ setLineTokenizer(new DelimitedLineTokenizer() {{ setNames(new String[] { "firstName", "lastName" }); }}); setFieldSetMapper(new BeanWrapperFieldSetMapper<Source>() {{ setTargetType(Source.class); }}); }}); return reader; }
type: AnsweredQuestion

http://stackoverflow.com/q/27362264
has body: In Java I want to create a data type, let's say Atom, which contains an index number, and when that index = 0, the Atom will contain a String datum, otherwise the Atom is just an index (Integer). How can I do that? I guess it would save some space if most Atoms are just indexes and only some contain Strings.
type: Question
has answer: http://stackoverflow.com/a/27362333
type: AnsweredQuestion
tagged with: java
possible better answer: http://stackoverflow.com/a/27362333
has answer: http://stackoverflow.com/a/27362479
has answer: http://stackoverflow.com/a/27362320
answer count: 3
tagged with: types
has title: Data type of variable size in Java?
tagged with: data-structures
score: 0
has comment: http://stackoverflow.com/comment/43176519
accepted answer: http://stackoverflow.com/a/27362479
has comment: http://stackoverflow.com/comment/43176507

http://stackoverflow.com/q/27395782
favorite count: 0
tagged with: axis
tagged with: soap
accepted answer: http://stackoverflow.com/a/27397129
tagged with: yodlee
upvote count: 1
has answer: http://stackoverflow.com/a/27397129
has body: When updating our .wsdl files to the latest Yodlee SOAP API (2014_Q4), errors started being thrown in the area of the code where it wasn't before. There wasn't any change in the our code dealing with transaction searches. The error being thrown is org.apache.axis2.databinding.ADBException: Unexpected subelement highLevelCategoryReq Which is happening on a executeUserSearchRequest call, i.e. Locators.transactionSearchService.executeUserSearchRequest(userContext, transactionSearchRequest) The setting up of the searchRequest is practically the exact same as what is shown in the sample code (latest Java SDK sample code, with the folder named Aggregation12-JavaSampleApps). A snippet is shown below val transactionSearchRange = new TransactionSearchResultRange() transactionSearchRange.setStartNumber(startRange) transactionSearchRange.setEndNumber(endRange) val transactionSearchRequest = new TransactionSearchRequest() val transactionSearchFilter = new TransactionSearchFilter transactionSearchFilter.setTransactionSplitType(TransactionSplitType.ALL_TRANSACTION) val itemAccountId = new ItemAccountId() itemAccountId.setIdentifier(bankData.getItemAccountId) transactionSearchFilter.setItemAccountId(itemAccountId) transactionSearchRequest.setSearchFilter(transactionSearchFilter) transactionSearchRequest.setIgnorePaymentTransactions(false) transactionSearchRequest.setIncludeAggregatedTransactions(true) transactionSearchRequest.setResultRange(transactionSearchRange) transactionSearchRequest.setContainerType("all") transactionSearchRequest.setSearchClients(TransactionSearchClients.DEFAULT_SERVICE_CLIENT) transactionSearchRequest.setIgnoreUserInput(true) Locators.transactionSearchService.executeUserSearchRequest(userContext, transactionSearchRequest) Stacktrace up to what is relevant is as follows org.apache.axis2.databinding.ADBException: Unexpected subelement highLevelCategoryReq at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222) at org.apache.axis.me…
has title: Unexpected subelement highLevelCategoryReq, Transaction Search
type: AnsweredQuestion
score: 1
tagged with: java
tagged with: apache-axis
type: Question
downvote count: 0
answer count: 1

http://stackoverflow.com/comment/43152223
has text: Try to remove all `android-support-v13.jar` from libs and add `compile 'com.android.support:support-v13:21.0.2'`instead
comment on: http://stackoverflow.com/q/27347534
type: Comment
type: QuestionComment
score: 1

http://stackoverflow.com/q/27350120
tagged with: java
has body: I'm doing a word shuffle app on android studio for a class project. I need help understanding how I can get the users input and match it to the correct String answer. I tried a few approaches and have fallen short. I tried using an if(word.equals(userAnswer)) statement but having a hard time understanding it. How can I write the if statement for text input/output to match my answer in android studio? (Optional question) Also is public void OnClick(View v) a good approach or should I go with something else? Any help will be greatly appreciated. Thanks in advance! public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } private EditText userAnswer; private TextView answerOutput; private TextView scrambledWord; public void OnClick(View v){ scrambledWord = (TextView) findViewById(R.id.scrambledWord); userAnswer = (EditText) findViewById(R.id.answerInput); answerOutput = (TextView) findViewById(R.id.answerOutput); Button button = (Button) v; String word = "Animals"; // scan for word ArrayList&lt;Character&gt; chars = new ArrayList&lt;Character&gt;(word.length()); // gets array with length of word for ( char c : word.toCharArray() ) { chars.add(c); } Collections.shuffle(chars); //shuffles the characters char[] shuffled = new char[chars.size()]; for ( int i = 0; i &lt; shuffled.length; i++ ) { shuffled[i] = chars.get(i); } String shuffledWord = new String(shuffled); if (word.equals(userAnswer)){ answerOutput.setText("Correct!!"); } else { answerOutput.setText("Sorry try again."); } }
type: Question
score: -2
has answer: http://stackoverflow.com/a/27350240
answer count: 3
upvote count: 0
favorite count: 0
has title: if statement to match users input to string answer
accepted answer: http://stackoverflow.com/a/27350240
downvote count: 2
has answer: http://stackoverflow.com/a/27350205
has answer: http://stackoverflow.com/a/27350248
tagged with: android
type: AnsweredQuestion
possible better answer: http://stackoverflow.com/a/27350205

http://stackoverflow.com/a/27464803
score: 1
upvote count: 1
has body: If you are looking to share Java, you could try to use this: https://github.com/google/j2objc. I am not certain I'd say that it is easier than using C++. Each option will have some challenges. The downside to j2objc is that it is a translation of Java to Obj-C. So if there is a bug in it (note the comment in the desc which indicates it is between alpha and beta quality), you will need to figure out how you deal with it. Admittedly, I have only done limited Android dev, and for that, it used the NDK and had a C++ lib which was shared between iOS and Android. I've also developed apps for iOS that were probably 95%+ C++. BTW, your question is actually a bit vague. If you are talking libs, you should specify what areas you are looking to solve for. Your solution will vary based on your goals.
has comment: http://stackoverflow.com/comment/43367431
downvote count: 0
type: Answer
answers question: http://stackoverflow.com/q/27459135

http://stackoverflow.com/comment/43088020
type: Comment
type: QuestionComment
has text: Can you share the HTML code snippet of it and also your implementation if possible ?
score: 1
comment on: http://stackoverflow.com/q/27313849

http://stackoverflow.com/a/27400846
answers question: http://stackoverflow.com/q/27400700
type: Answer
upvote count: 4
has body: The easiest way to do this is to reuse what you already have. Let's rename your method first: public void sumMonotonic(int a, int b) { int result = 0; while (a &lt;=b) { result+=a; a++; } System.out.println("The sum of all numbers is "+result); } So sumMonotonic() only works if its first argument is no bigger than its second. But now we can define sum() like this: public void sum(int a, int b) { if (a&lt;=b) sumMonotonic(a,b); else sumMonotonic(b,a); } This just invokes the other function with the arguments in the appropriate order. Actually there's one other oddity that we might fix. It seems a little unidiomatic to have a sumMonotonic() method that does the printing. It would be better if it returned the sum, and if the sum() method did the printing. So we'd refactor it like this: public int sumMonotonic(int a, int b) { int result = 0; while (a &lt;=b) { result+=a; a++; } return result; } public void sum(int a, int b) { int result; if (a&lt;=b) result = sumMonotonic(a,b); else result = sumMonotonic(b,a); System.out.println("The sum of all numbers is "+result); }
downvote count: 0
score: 4

http://stackoverflow.com/q/27316011
answer count: 5
type: UnansweredQuestion
tagged with: maven
has answer: http://stackoverflow.com/a/27316141
tagged with: spring
tagged with: spring-mvc
score: 2
has answer: http://stackoverflow.com/a/27317481
has comment: http://stackoverflow.com/comment/43092028
has answer: http://stackoverflow.com/a/27316310
has title: Spring boot MVC template - tomcat7 giving 404 error
downvote count: 0
tagged with: java
has comment: http://stackoverflow.com/comment/43092064
has body: if i call the default url for my tomcat server, i will see an error 404. The program is running without any problems, but perhaps the restcontroller is disabled (i don't known, normally not). There are no erros in the log. The start page is a html-format. I set the default path (see below). Im using Spring Boot and tomcat7. The requested resource (/dashboard/) is not available. Spring Boot path src\main\resources\templates\index.html Index.html path in war: ..\tomcat7\webapps\dashboard\WEB-INF\classes\templates\index.html Main @Configuration @EnableAutoConfiguration @ComponentScan(basePackages = "com.###.dashboard") @EnableJpaRepositories @EntityScan(basePackages = "com.###.dashboard.domain") public class Dashboard extends SpringBootServletInitializer { public static void main(String[] args) { SpringApplication.run(new Object[] {Dashboard.class, DashboardController.class}, args); } @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Dashboard.class); } } RestController @RestController public class DashboardController { /** *... */ @RequestMapping("/") public String setPage(Model model) { // ... return "index"; } } pom 4.0.0 com.###.dashboard Dashboard war 1.0 Dashboard http://maven.apache.org org.springframework.boot spring-boot-starter-parent 1.1.8.RELEASE org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter-mobile org.springframework.boot spring-boot-starter-thymeleaf com.h2database h2 org.springframework.data spring-data-commons org.springframework.boot spring-boot-starter-data-jpa org.springframework.boot spring-boot-starter-tomcat provided com.###.dashboard.main.Dashboard org.springframework.boot spring-boot-maven-plugin tomcat7 server 2014-12-05 13:31:46.836 INFO 28052 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/],methods=[],param s=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String com.###.dashboard.d…
has comment: http://stackoverflow.com/comment/43971940
type: Question
upvote count: 2
has answer: http://stackoverflow.com/a/65759402
has comment: http://stackoverflow.com/comment/43091973
tagged with: tomcat
has comment: http://stackoverflow.com/comment/43092038
has answer: http://stackoverflow.com/a/27316159
favorite count: 0
linked to: http://stackoverflow.com/q/2511301
has comment: http://stackoverflow.com/comment/43596581

http://stackoverflow.com/q/27390395
downvote count: 1
has answer: http://stackoverflow.com/a/27390542
tagged with: http://stackoverflow.com/tag/c
has body: What I know in Windows: please rectify : file.C->gcc.exe->Assembly code->assembler of windows->file.O->link.exe->file.exe->CPU file.java->javac.exe=>file.class->java.exe=>Assembly code->assembler of windows->...(don't know)...->...->CPU I'm really confused each time I seek for these processes could any one give me the details in C and java from source code to CPU in windows and giving names of programs such as compilers and assemblers
has answer: http://stackoverflow.com/a/27390453
has title: C and java compilation process in Windows
type: AnsweredQuestion
has comment: http://stackoverflow.com/comment/43228809
accepted answer: http://stackoverflow.com/a/27390542
favorite count: 0
possible better answer: http://stackoverflow.com/a/27390453
type: Question
has comment: http://stackoverflow.com/comment/43229051
answer count: 2
score: 0
tagged with: java
upvote count: 1

http://stackoverflow.com/comment/43237726
has text: ... so it is not the error message you actually specified in your question.
type: Comment
comment on: http://stackoverflow.com/q/27391135
score: 0
type: QuestionComment